/** * UploadProgress — file upload status indicators. * * Shows a list of files being uploaded with progress bars, * completion checkmarks, and error states. */ import { AlertCircle, CheckCircle2, FileText, Loader2, RefreshCw, X } from "lucide-react"; import { cn } from "../lib/utils"; export interface UploadFile { id: string; name: string; size: number; status: "pending" | "uploading" | "complete" | "error"; progress?: number; // 0-100 error?: string; } export interface UploadProgressProps { files: UploadFile[]; onRemove?: (id: string) => void; onRetry?: (id: string) => void; className?: string; } function formatSize(bytes: number): string { if (bytes < 1024) return `${bytes}B`; if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(0)}KB`; return `${(bytes / (1024 * 1024)).toFixed(1)}MB`; } export function UploadProgress({ files, onRemove, onRetry, className }: UploadProgressProps) { if (files.length === 0) return null; return (
{file.error}
)}