import { FileSpreadsheet, FileText, Presentation } from "lucide-react"; import { humanSize, type AttachmentView } from "@peppa/core"; /** * PEP-159: files of a message, a comment or a story — pictures as thumbnails that open large, * everything else as a row with the name and the size (a PDF opens, the rest downloads). */ export function Attachments({ files }: { files?: AttachmentView[] }) { if (!files?.length) return null; const images = files.filter((f) => f.kind === "image"); const rest = files.filter((f) => f.kind !== "image"); return (
{images.length > 0 && (
{images.map((f) => ( {/* eslint-disable-next-line @next/next/no-img-element */} {f.name} ))}
)} {rest.length > 0 && ( )}
); }