diff --git a/src/components/feed-post/feed-post.tsx b/src/components/feed-post/feed-post.tsx index 6a9cb8b0..0e4700d5 100644 --- a/src/components/feed-post/feed-post.tsx +++ b/src/components/feed-post/feed-post.tsx @@ -15,13 +15,13 @@ const FeedPost: FC = ({ post, index }) => { const { t } = useTranslation(); const [expandoVisible, setExpandoVisible] = useState(false); const commentMediaInfo = utils.getCommentMediaInfo(post); - const hasMedia = post.link && commentMediaInfo && - (commentMediaInfo.type === 'image' || - commentMediaInfo.type === 'video' || - (commentMediaInfo.type === 'webpage' && commentMediaInfo.thumbnail)) + const hasMedia = + post.link && + commentMediaInfo && + (commentMediaInfo.type === 'image' || commentMediaInfo.type === 'video' || (commentMediaInfo.type === 'webpage' && commentMediaInfo.thumbnail)) ? true : false; - const initialButtonType = hasMedia ? 'playButton' : 'textButton'; + const initialButtonType = hasMedia || commentMediaInfo?.type === 'audio' ? 'playButton' : 'textButton'; const [buttonType, setButtonType] = useState<'textButton' | 'playButton' | 'closeButton'>(initialButtonType); const toggleExpando = () => { setExpandoVisible(!expandoVisible); @@ -30,14 +30,14 @@ const FeedPost: FC = ({ post, index }) => { let displayWidth, displayHeight; - if (post.linkWidth && post.linkHeight) { - let scale = Math.min(1, 70 / Math.max(post.linkWidth, post.linkHeight)); - displayWidth = `${post.linkWidth * scale}px`; - displayHeight = `${post.linkHeight * scale}px`; - } else { - displayWidth = '70px'; - displayHeight = '70px'; - } + if (post.linkWidth && post.linkHeight) { + let scale = Math.min(1, 70 / Math.max(post.linkWidth, post.linkHeight)); + displayWidth = `${post.linkWidth * scale}px`; + displayHeight = `${post.linkHeight * scale}px`; + } else { + displayWidth = '70px'; + displayHeight = '70px'; + } return (
@@ -47,15 +47,12 @@ const FeedPost: FC = ({ post, index }) => {
{hasMedia && ( - + e.preventDefault()}> - {commentMediaInfo?.type === 'image' && - thumbnail} - {commentMediaInfo?.type === 'video' && (commentMediaInfo.thumbnail ? - thumbnail : - )} @@ -113,16 +110,14 @@ const FeedPost: FC = ({ post, index }) => {
- {hasMedia && ( + {(hasMedia || commentMediaInfo?.type === 'audio') && (
e.preventDefault()}> - {commentMediaInfo?.type === 'image' && - thumbnail} - {commentMediaInfo?.type === 'video' && (commentMediaInfo.thumbnail ? - thumbnail : -
)}