import { CheckCircleIcon, AlertCircleIcon, XCircleIcon } from "lucide-react"; import { useUITranslation } from "@vertesia/ui/i18n"; import { UploadResultCategory } from "./UploadResultCategory"; /** * Processed file information */ export interface ProcessedFile { /** The name of the file */ name: string; /** The status of the file upload */ status: 'success' | 'updated' | 'skipped' | 'failed'; /** Error message if status is 'failed' */ error?: string; } /** * Props for the UploadSummary component */ export interface UploadSummaryProps { /** List of processed files */ files: ProcessedFile[]; /** Optional class name for styling */ className?: string; /** Optional folder location where files were uploaded */ location?: string; /** Optional collection name where files were uploaded */ collection?: string; } /** * Displays a summary of upload results with collapsible categories * * @example * */ export function UploadSummary({ files, className = "", location, collection }: UploadSummaryProps) { const { t } = useUITranslation(); // Group files by status const successFiles = files.filter(f => f.status === 'success'); const updatedFiles = files.filter(f => f.status === 'updated'); const skippedFiles = files.filter(f => f.status === 'skipped'); const failedFiles = files.filter(f => f.status === 'failed'); // Calculate counts const successCount = successFiles.length; const updatedCount = updatedFiles.length; const skippedCount = skippedFiles.length; const failedCount = failedFiles.length; const totalCount = files.length; return (

{t('upload.filesProcessed', { count: totalCount })} {collection ? t('upload.inCollection', { collection }) : ""} {location ? t('upload.inFolder', { location }) : ""}

{/* Upload results categories */}
{/* Successful uploads */} {successCount > 0 && ( } items={successFiles.map(f => f.name)} /> )} {/* Updated files */} {updatedCount > 0 && ( } items={updatedFiles.map(f => f.name)} /> )} {/* Skipped files */} {skippedCount > 0 && ( } items={skippedFiles.map(f => f.name)} /> )} {/* Failed uploads */} {failedCount > 0 && ( } items={failedFiles.map(f => f.name)} /> )}
); }