New post view + fix moment location

This commit is contained in:
Adolfo Reyna
2022-12-22 23:06:21 -05:00
parent 3d50977520
commit 1c0dbbbe84
7 changed files with 156 additions and 27 deletions

View File

@@ -5,7 +5,10 @@ import API from './../API.js';
import UserName from './UserName.js';
import { useSnapshot } from 'valtio';
import GlobalState from '../contexts/GlobalState.js';
import Moment from 'moment';
import i18n from "../i18nMessages.js";
import 'moment/min/locales';
Moment.locale(i18n.locale);
let Comment = ({ comment, postid }) => {
const gState = useSnapshot(GlobalState);
@@ -30,7 +33,7 @@ let Comment = ({ comment, postid }) => {
<View style={{flex:8}}>
<Text style={styles.userName}>
<UserName profileid={comment.profileid} key={comment.profileid} />
<Text style={{fontSize: 12, fontWeight: "normal"}}> {Moment(comment.createdAt).fromNow()}</Text>
</Text>
</View>
<View style={{flex:2}}>
@@ -42,6 +45,7 @@ let Comment = ({ comment, postid }) => {
</View>
</View>
<Text style={{fontSize: 16}}>{comment.content}</Text>
</Card.Content>
</Card>
);