import { useState } from "react";
import { Download, File, FileCode, FileText, FolderUp, ImageIcon } from "lucide-react";
import { cn } from "../lib/utils";
import type { ChatFile } from "@paperclipai/shared";
import { chatApi } from "../api/chat";
interface ChatFileCardProps {
file: ChatFile;
contentPath: string;
className?: string;
projectId?: string | null;
onPromoted?: (file: ChatFile) => void;
}
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