diff --git a/src/features/posts/Post.js b/src/features/posts/Post.js index 1b7096b..51c833b 100644 --- a/src/features/posts/Post.js +++ b/src/features/posts/Post.js @@ -20,6 +20,7 @@ export default function Post({data, key}) { const [body, setBody] = useState(selftext); const [visible, setVisible] = useState('show '); const [commentStyle, setCommentStyle] = useState('comments-hidden'); + const [crosspost, setCrosspost] = useState(undefined); const postDate = new Date(time * 1000); // handles conversion from unix timestamp to local time and date strings const localTime = postDate.toLocaleTimeString(); @@ -66,6 +67,19 @@ export default function Post({data, key}) { } setBody(selftext.substring(0,limit) + '...'); } + + const handleCrosspost = () => { + if (data.crosspost_parent_list[0].is_video) { + return ( + <> + +

Crosspost from {data.crosspost_parent_list[0].subreddit_name_prefixed}

+ + ); + } else { + return; + } + } return ( <> @@ -76,8 +90,18 @@ export default function Post({data, key}) { :

[untitled]

} {media ? {title} : ''} + {data.crosspost_parent_list ? handleCrosspost() : ''} + {data.crosspost_parent_list ? + (data.crosspost_parent_list[0].is_video ? + + : null) + : null} - {video ? + {data.gallery_data ? +

View the gallery of photos corresponding to this post here.

+ : null} + + {video ? : ''}