diff --git a/packages/pl-fe/src/features/status/components/thread.tsx b/packages/pl-fe/src/features/status/components/thread.tsx index c7b58f54c..1d792ecc4 100644 --- a/packages/pl-fe/src/features/status/components/thread.tsx +++ b/packages/pl-fe/src/features/status/components/thread.tsx @@ -342,6 +342,45 @@ const Thread = ({ return children; }, [thread, linear, status, isModal]); + const meta = useMemo(() => { + const firstAttachment = status.media_attachments && status.media_attachments[0]; + + return ( + + {status.spoiler_text && } + {(firstAttachment?.type === 'image' || firstAttachment?.type === 'gifv') && ( + <> + + + {firstAttachment.mime_type && ( + + )} + {firstAttachment.meta.original && ( + + )} + {firstAttachment.meta.original && ( + + )} + + )} + + + + + + {status.edited_at && } + + {status.account.local === false && } + + ); + }, [status]); + useEffect(() => { setExpandAllStatuses?.(() => { expandStatuses(thread); @@ -357,16 +396,7 @@ const Thread = ({ 'mt-2': !isModal, })} > - - {status.spoiler_text && } - - - - - {status.edited_at && } - - {status.account.local === false && } - + {meta}
{ pathname.endsWith(path), ); + const meta = useMemo(() => { + if (!status) return null; + + const firstAttachment = status.media_attachments && status.media_attachments[0]; + + return ( + + {status.spoiler_text && } + {(firstAttachment?.type === 'image' || firstAttachment?.type === 'gifv') && ( + <> + + + {firstAttachment.mime_type && ( + + )} + {firstAttachment.meta.original && ( + + )} + {firstAttachment.meta.original && ( + + )} + + )} + + + + + + {status.edited_at && } + + {status.account.local === false && } + + ); + }, [status]); + return ( <> - {status?.account.local === false && ( - - - - )} + {meta}