terry-staging #8
@@ -19,6 +19,7 @@ function AttachmentRow({ postId, att }: { postId: string; att: Attachment }) {
|
||||
const { Icon, color } = fileIcon({ mime: att.mime, filename: att.filename });
|
||||
const displayFilename = filenameWithExtension(att.filename, att.mime);
|
||||
const [isDownloading, setIsDownloading] = useState(false);
|
||||
const [previewFailed, setPreviewFailed] = useState(false);
|
||||
|
||||
const handleDownload = async () => {
|
||||
if (isDownloading) return;
|
||||
@@ -39,11 +40,12 @@ function AttachmentRow({ postId, att }: { postId: string; att: Attachment }) {
|
||||
|
||||
return (
|
||||
<div className="group flex h-[52px] items-center gap-3">
|
||||
{previewUrl ? (
|
||||
{previewUrl && !previewFailed ? (
|
||||
<img
|
||||
src={previewUrl}
|
||||
alt={displayFilename}
|
||||
alt=""
|
||||
loading="lazy"
|
||||
onError={() => setPreviewFailed(true)}
|
||||
className="h-[52px] w-[52px] shrink-0 rounded-full object-cover"
|
||||
/>
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user