"use client"; import { motion } from "framer-motion"; import { FileStack, ScrollText } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Badge, EmptyState, Panel, PanelHeader, Skeleton, StatusBadge, } from "@/components/ui/primitives"; import { formatLatency, formatMoney, relativeTime } from "@/lib/utils"; import type { DocumentSummary } from "@/types/api"; export function DocumentTable({ documents, loading, onInspect, }: { documents: DocumentSummary[]; loading: boolean; onInspect: (documentId: string) => void; }) { return ( {documents.length} shown} /> {loading ? (
{[0, 1, 2, 3, 4].map((index) => ( ))}
) : documents.length === 0 ? ( } title="The ledger is empty" hint="Drop a document above, or run `make seed` to load vendor history." /> ) : (
{["Document", "Vendor", "Total", "Status", "Latency", "Received", ""].map( (heading) => ( ), )} {documents.map((document, index) => ( ))}
{heading}

{document.filename}

{document.doc_kind ?? "unknown"} · {document.lane ?? "—"} lane

{document.vendor ?? "—"} {formatMoney(document.total, document.currency)}
{document.anomaly_count > 0 ? ( {document.anomaly_count} ) : null}
{formatLatency(document.latency_ms)} {relativeTime(document.created_at)}
)}
); }