"use client"; import { ImageIcon } from "lucide-react"; import type { AttachmentRecord } from "@/lib/types"; interface AttachmentsGridProps { attachments: AttachmentRecord[]; onImageClick?: (index: number) => void; } export function AttachmentsGrid({ attachments, onImageClick, }: AttachmentsGridProps) { if (attachments.length === 0) return null; const images = attachments.filter((a) => a.type?.startsWith("image/")); const others = attachments.filter((a) => !a.type?.startsWith("image/")); return (
{images.length > 0 && (
{images.map((att, i) => (
{images.length > 1 && ( {i + 1}/{images.length} )}
))}
)} {others.length > 0 && (
{others.map((att) => (
{att.filename}
))}
)}
); }