diff --git a/src/components/post/post.tsx b/src/components/post/post.tsx index 03122321..5920fe21 100644 --- a/src/components/post/post.tsx +++ b/src/components/post/post.tsx @@ -18,7 +18,7 @@ interface PostProps { const Post = ({ post, index }: PostProps) => { const { - author: { shortAddress }, + author, cid, content, downvoteCount, @@ -27,7 +27,6 @@ const Post = ({ post, index }: PostProps) => { linkHeight, linkWidth, replyCount, - spoiler, subplebbitAddress, timestamp, title, @@ -38,14 +37,15 @@ const Post = ({ post, index }: PostProps) => { const { t } = useTranslation(); const { isPendingView, isPostView } = useCurrentView(); - const [isInPostView, setIsInPostView] = useState(isPostView || isPendingView); - const toggleExpanded = () => setIsInPostView(!isInPostView); + const isInPostView = isPostView || isPendingView; + const [isExpanded, setIsExpanded] = useState(isInPostView); + const toggleExpanded = () => setIsExpanded(!isExpanded); const commentMediaInfo = utils.getCommentMediaInfoMemoized(post); const hasThumbnail = utils.hasThumbnail(commentMediaInfo, link); const linkUrl = utils.getHostname(link); - const postAuthor = isPendingView ? account?.author?.shortAddress : shortAddress; + const postAuthor = isPendingView ? account?.author?.shortAddress : author?.shortAddress; const postScore = upvoteCount === 0 && downvoteCount === 0 ? '•' : upvoteCount - downvoteCount || '•'; const postTitleOrContent = (title?.length > 300 ? title?.slice(0, 300) + '...' : title) || (content?.length > 300 ? content?.slice(0, 300) + '...' : content); @@ -106,7 +106,7 @@ const Post = ({ post, index }: PostProps) => { { )}

{t('post_submitted')} {utils.getFormattedTime(timestamp)} {t('post_by')}{' '} - e.preventDefault()}> + e.preventDefault()}> u/{postAuthor}  {t('post_to')} @@ -123,11 +123,11 @@ const Post = ({ post, index }: PostProps) => { p/{subplebbit?.shortAddress}

- + - + ); };