"use client"; import { useEffect, useState } from "react"; import { AlertTriangle, Download, FileSearch, LayoutGrid, ScrollText, Table2, } from "lucide-react"; import type { Citation, DocumentDetail } from "@/lib/types"; import DocumentViewer from "@/components/DocumentViewer"; import FieldsPanel from "@/components/FieldsPanel"; import ClassifyPanel from "@/components/ClassifyPanel"; import SummaryPanel from "@/components/SummaryPanel"; import ExportPanel from "@/components/ExportPanel"; import ProcessingBar from "@/components/ProcessingBar"; type Tab = "viewer" | "fields" | "classify" | "summary" | "export"; const TABS: { id: Tab; label: string; icon: any }[] = [ { id: "viewer", label: "Viewer", icon: FileSearch }, { id: "fields", label: "Fields & Tables", icon: Table2 }, { id: "classify", label: "Classification", icon: LayoutGrid }, { id: "summary", label: "Summary", icon: ScrollText }, { id: "export", label: "Export", icon: Download }, ]; export default function Workspace({ detail, provider, focusCitation, onRefresh, }: { detail: DocumentDetail | null; provider: string | null; focusCitation: Citation | null; onRefresh: () => void; }) { const [tab, setTab] = useState("viewer"); useEffect(() => { if (focusCitation) setTab("viewer"); }, [focusCitation]); const anomalyCount = detail?.anomalies?.length ?? 0; if (!detail) { return (

Your workspace

Upload a document to view it here alongside extracted fields, classification, summary, and export controls.

{[ ["Viewer", "See pages with source highlights"], ["Fields", "Structured data + confidence"], ["Classify", "Auto document-type detection"], ["Export", "JSON · CSV · Excel"], ].map(([t, d]) => (

{t}

{d}

))}
); } return (
{/* tabs */}
{TABS.map((t) => { const Icon = t.icon; const active = tab === t.id; return ( ); })}
{/* body */}
{tab === "viewer" && ( )} {tab === "fields" && ( )} {tab === "classify" && ( )} {tab === "summary" && ( )} {tab === "export" && }
); }