import { FileText, AlertCircle, RotateCcw, Trash2 } from 'lucide-react'; import { DocumentItem } from '@/store/documents'; import { StatusBadge } from './StatusBadge'; import { ProcessingSteps } from './ProcessingSteps'; import { cn } from '@/lib/utils'; function formatDate(iso: string) { try { return new Date(iso).toLocaleString(undefined, { hour: 'numeric', minute: '2-digit', month: 'short', day: 'numeric', }); } catch { return ''; } } export function DocumentRow({ doc, isSelected, onToggleSelect, onViewDetails, onDelete, onRetry, }: { doc: DocumentItem; isSelected?: boolean; onToggleSelect?: (id: string) => void; onViewDetails?: (doc: DocumentItem) => void; onDelete?: (id: string) => void; onRetry?: (id: string) => void; }) { return (
doc.status === 'COMPLETED' && onViewDetails?.(doc)} >
{doc.status === 'COMPLETED' ? ( { e.stopPropagation(); onToggleSelect?.(doc.id); }} className="h-4 w-4 rounded border-border bg-bg-surface text-accent-violet focus:ring-accent-violet cursor-pointer" /> ) : (
// Spacer to preserve alignment )} {doc.name}
e.stopPropagation()}>
{doc.status === 'PROCESSING' ? (
) : (
{doc.entities !== undefined && {doc.entities} entities} {doc.relationships !== undefined && {doc.relationships} relations} {formatDate(doc.uploadedAt)}
)} {doc.status === 'FAILED' && (
{doc.error || 'Processing failed'}
)}
); }