import { Download, File, FileCode, FileText, ImageIcon } from "lucide-react"; import { cn } from "../lib/utils"; import type { ChatFile } from "@paperclipai/shared"; interface ChatFileCardProps { file: ChatFile; contentPath: string; className?: string; } export function formatFileSize(bytes: number): string { if (bytes < 1024) return `${bytes} B`; if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`; return `${(bytes / (1024 * 1024)).toFixed(1)} MB`; } function FileIcon({ category }: { category: ChatFile["category"] }) { const cls = "h-5 w-5 shrink-0 text-muted-foreground"; switch (category) { case "image": return ; case "code": return ; case "document": return ; default: return ; } } export function ChatFileCard({ file, contentPath, className }: ChatFileCardProps) { return (
{file.originalFilename} {formatFileSize(file.sizeBytes)}
e.stopPropagation()} >
); }