import { cn } from "@/lib/utils"; import type { Attachment } from "@/types/proto/api/v1/attachment_service_pb"; import { getAttachmentThumbnailUrl, getAttachmentType, getAttachmentUrl } from "@/utils/attachment"; interface AttachmentCardProps { attachment: Attachment; onClick?: () => void; className?: string; } const AttachmentCard = ({ attachment, onClick, className }: AttachmentCardProps) => { const attachmentType = getAttachmentType(attachment); const sourceUrl = getAttachmentUrl(attachment); if (attachmentType === "image/*") { return ( {attachment.filename} { const target = e.currentTarget; if (target.src.includes("?thumbnail=true")) { target.src = sourceUrl; } }} decoding="async" loading="lazy" /> ); } if (attachmentType === "video/*") { return