Refresh Look on posts
This commit is contained in:
@@ -11,6 +11,7 @@ import Moment from 'moment';
|
||||
import { useSnapshot } from 'valtio';
|
||||
import GlobalState from '../contexts/GlobalState.js';
|
||||
import i18n from "../i18nMessages.js";
|
||||
import ProfilePhotoCircle from './ProfilePhotoCircle.js';
|
||||
|
||||
|
||||
let Post = (props) => {
|
||||
@@ -21,7 +22,7 @@ let Post = (props) => {
|
||||
let [likes, changeLikes] = useState(Object.keys(post.reactions).length);
|
||||
let [bookmarked, changeBookmarked] = useState(post.bookmarks && post.bookmarks.includes(viewer._id));
|
||||
let toProfileText = post.toProfile && post.toProfile !== post.profileid ?
|
||||
<Text> {">"} <UserName profileid={post.toProfile} /></Text> : undefined;
|
||||
<ProfilePhotoCircle profileid={post.toProfile} small={true} /> : undefined;
|
||||
let cleanContent = post.content.replace(/@[A-z]+:.+\w/g, '');
|
||||
//cleanContent = convertLinks(cleanContent);
|
||||
const newComentAdded = (commentData) => {
|
||||
@@ -60,18 +61,20 @@ let Post = (props) => {
|
||||
return (
|
||||
<Card style={styles.card}>
|
||||
<Card.Content>
|
||||
<Hyperlink linkDefault={ true } linkStyle={ { color: '#2980b9'} }>
|
||||
<Hyperlink linkDefault={true} linkStyle={{ color: '#2980b9' }}>
|
||||
{!post.nonOrganicType ?
|
||||
<View>
|
||||
<Text style={styles.userName}>
|
||||
<UserName profileid={post.profileid}/>
|
||||
<ProfilePhotoCircle profileid={post.profileid} />
|
||||
<View style={{ flexDirection: 'row', alignItems: 'center', margin:0, marginLeft: 35, top: -5 }}>
|
||||
{toProfileText}
|
||||
<Text style={{ fontWeight: 'normal', fontSize: 12 }}>
|
||||
{" " + Moment(post.createdAt).fromNow()}
|
||||
</Text>
|
||||
</Text>
|
||||
<Text style={{ fontSize: 16, paddingBottom:5 }}>{cleanContent}</Text>
|
||||
<Media content={post.content} postId={post._id} post={post} />
|
||||
</View>
|
||||
<Text style={{ fontSize: 15, padding: 0 }}>{cleanContent}</Text>
|
||||
<View style={{paddingTop: 5}}>
|
||||
<Media content={post.content} postId={post._id} post={post} />
|
||||
</View>
|
||||
</View> :
|
||||
<View>
|
||||
<Chip icon="new-releases" style={{ width: 100 }} >{i18n.t("message.news")}</Chip>
|
||||
@@ -81,27 +84,36 @@ let Post = (props) => {
|
||||
}
|
||||
</Hyperlink>
|
||||
</Card.Content>
|
||||
<Card.Actions style={{ flexDirection: "row", flow: 4, justifyContent: 'space-evenly', fontSize: 18 }}>
|
||||
<Card.Actions style={{ flexDirection: "row", flow: 4, fontSize: 16 }}>
|
||||
<Button
|
||||
icon={post.reactions[viewer._id] ? "favorite" : "favorite-border"}
|
||||
labelStyle={{ fontSize: 18 }}
|
||||
labelStyle={{ fontSize: 16 }}
|
||||
style={{ flow: 1 }}
|
||||
onPress={newPostReaction}
|
||||
color="#555"
|
||||
>
|
||||
{likes}
|
||||
</Button>
|
||||
<Button icon="forum" labelStyle={{ fontSize: 18 }} style={{ flow: 1 }} onPress={() => { changeshowCommentsB(!showCommentsB) }} >{post.comments.length}</Button>
|
||||
<Button icon="ios-share" style={{ flow: 1 }} labelStyle={{ fontSize: 18 }} onPress={()=>{
|
||||
Share.share({
|
||||
//message: "https://social.emmint.com/post/" + props.post._id,
|
||||
url: "https://social.emmint.com/feed/post/" + props.post._id
|
||||
});
|
||||
}}></Button>
|
||||
<Button icon="forum" labelStyle={{ fontSize: 16 }} style={{ flow: 1 }}
|
||||
onPress={() => { changeshowCommentsB(!showCommentsB) }}
|
||||
color="#555"
|
||||
>
|
||||
{post.comments.length}
|
||||
</Button>
|
||||
<Button icon="ios-share" style={{ flow: 1 }} labelStyle={{ fontSize: 16 }}
|
||||
color="#555"
|
||||
onPress={() => {
|
||||
Share.share({
|
||||
//message: "https://social.emmint.com/post/" + props.post._id,
|
||||
url: "https://social.emmint.com/feed/post/" + props.post._id
|
||||
});
|
||||
}}></Button>
|
||||
<Button
|
||||
icon={!bookmarked ? "bookmark-outline" : "bookmark"}
|
||||
style={{ flow: 1 }}
|
||||
labelStyle={{ fontSize: 18 }}
|
||||
labelStyle={{ fontSize: 16 }}
|
||||
onPress={newPostBookmark}
|
||||
color="#555"
|
||||
>
|
||||
</Button>
|
||||
</Card.Actions>
|
||||
@@ -129,9 +141,10 @@ const styles = StyleSheet.create({
|
||||
fontSize: 17,
|
||||
},
|
||||
card: {
|
||||
margin: 8,
|
||||
backgroundColor: "#FFFFFF",
|
||||
borderRadius: 5,
|
||||
margin: 0,
|
||||
backgroundColor: "#FFFAFA",
|
||||
borderRadius: 0,
|
||||
marginBottom: 2
|
||||
},
|
||||
comment: {
|
||||
margin: 8,
|
||||
|
||||
Reference in New Issue
Block a user