Add photo to comments
This commit is contained in:
@@ -10,6 +10,7 @@ import Moment from 'moment';
|
|||||||
import i18n from "../i18nMessages.js";
|
import i18n from "../i18nMessages.js";
|
||||||
import 'moment/min/locales';
|
import 'moment/min/locales';
|
||||||
Moment.locale(i18n.locale);
|
Moment.locale(i18n.locale);
|
||||||
|
import ProfilePhotoCircle from './ProfilePhotoCircle.js';
|
||||||
|
|
||||||
let Comment = ({ comment, postid }) => {
|
let Comment = ({ comment, postid }) => {
|
||||||
const gState = useSnapshot(GlobalState);
|
const gState = useSnapshot(GlobalState);
|
||||||
@@ -19,7 +20,7 @@ let Comment = ({ comment, postid }) => {
|
|||||||
const newCommentReaction = () => {
|
const newCommentReaction = () => {
|
||||||
if (!comment.reactions[viewer._id]) {
|
if (!comment.reactions[viewer._id]) {
|
||||||
comment.reactions[viewer._id] = { type: "like" };
|
comment.reactions[viewer._id] = { type: "like" };
|
||||||
changeLikes(likes+1);
|
changeLikes(likes + 1);
|
||||||
API.newCommentReaction(postid, comment.createdAt);
|
API.newCommentReaction(postid, comment.createdAt);
|
||||||
} else {
|
} else {
|
||||||
//API.removePostReaction(viewer._id).then(() => {
|
//API.removePostReaction(viewer._id).then(() => {
|
||||||
@@ -31,14 +32,20 @@ let Comment = ({ comment, postid }) => {
|
|||||||
return (
|
return (
|
||||||
<Card style={styles.comment}>
|
<Card style={styles.comment}>
|
||||||
<Card.Content>
|
<Card.Content>
|
||||||
<View style={{flexDirection: "row", alignItems: "center", justifyContent: "center"}}>
|
<View style={{ flexDirection: "row", alignItems: "center", justifyContent: "center" }}>
|
||||||
<View style={{flex:8}}>
|
<View style={{ flex: 8, marginBottom: 8 }}>
|
||||||
<Text style={styles.userName}>
|
<ProfilePhotoCircle profileid={comment.profileid} />
|
||||||
<UserName profileid={comment.profileid} key={comment.profileid} />
|
<Text style={
|
||||||
<Text style={{fontSize: 12, fontWeight: "normal"}}> {Moment(comment.createdAt).fromNow()}</Text>
|
{
|
||||||
</Text>
|
fontSize: 12,
|
||||||
|
fontWeight: "normal",
|
||||||
|
position: "absolute",
|
||||||
|
top: 20,
|
||||||
|
left: 37,
|
||||||
|
}
|
||||||
|
}> {Moment(comment.createdAt).fromNow()}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={{flex:2}}>
|
<View style={{ flex: 2 }}>
|
||||||
<Button
|
<Button
|
||||||
icon={comment.reactions[viewer._id] ? "favorite" : "favorite-border"}
|
icon={comment.reactions[viewer._id] ? "favorite" : "favorite-border"}
|
||||||
dense={true}
|
dense={true}
|
||||||
@@ -46,8 +53,8 @@ let Comment = ({ comment, postid }) => {
|
|||||||
>{likes ? likes : ''}</Button>
|
>{likes ? likes : ''}</Button>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<Text style={{fontSize: 14}}>{cleanContent}</Text>
|
<Text style={{ fontSize: 14 }}>{cleanContent}</Text>
|
||||||
<Media content={comment.content} postId={postid} skiptVideo={true}/>
|
<Media content={comment.content} postId={postid} skiptVideo={true} />
|
||||||
</Card.Content>
|
</Card.Content>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
@@ -60,12 +67,6 @@ const styles = StyleSheet.create({
|
|||||||
margin: 8,
|
margin: 8,
|
||||||
marginTop: 0,
|
marginTop: 0,
|
||||||
},
|
},
|
||||||
userName: {
|
|
||||||
fontSize: 14,
|
|
||||||
fontWeight: 'bold',
|
|
||||||
marginBottom: 5,
|
|
||||||
fontSize: 16
|
|
||||||
},
|
|
||||||
likeComment: {
|
likeComment: {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
margin: 16,
|
margin: 16,
|
||||||
|
|||||||
Reference in New Issue
Block a user