"use client"; import { use } from "react"; import Link from "next/link"; import { AppShell } from "@/components/app-shell"; import { Card, CardContent } from "@/components/ui/card"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { Button } from "@/components/ui/button"; import { Skeleton } from "@/components/ui/skeleton"; import { CaseHeader } from "@/components/cases/case-header"; import { CaseEditDialog } from "@/components/cases/case-edit-dialog"; import { StatusHero } from "@/components/cases/status-hero"; import { DocumentsPanel } from "@/components/cases/documents-panel"; import { DraftsPanel } from "@/components/cases/drafts-panel"; import { DecisionBlocksPanel } from "@/components/cases/decision-blocks-panel"; import { LegalArgumentsPanel } from "@/components/cases/legal-arguments-panel"; import { AgentActivityFeed } from "@/components/cases/agent-activity-feed"; import { AgentActivityPreview } from "@/components/cases/agent-activity-preview"; import { UploadSheet } from "@/components/documents/upload-sheet"; import { useCase, useStartWorkflow } from "@/lib/api/cases"; import { toast } from "sonner"; import { Play, Loader2 } from "lucide-react"; /* * Next 16 breaking change: route params are now a Promise. * The `use()` hook unwraps them inside a client component. */ export default function CaseDetailPage({ params, }: { params: Promise<{ caseNumber: string }>; }) { const { caseNumber } = use(params); const { data, isPending, error, refetch } = useCase(caseNumber); const startWorkflow = useStartWorkflow(caseNumber); const canStartWorkflow = data?.status === "new" || data?.status === "documents_ready"; // Only take over the whole page when there is NO data to show. A transient // 5xx on the 5s background refetch must not blow away an already-loaded page. if (error && !data) { return (

שגיאה בטעינת התיק

{error.message}

); } const tabsList = ( {[ ["overview", "סקירה"], ["arguments", "טיעונים"], ["decision", "ההחלטה"], ["drafts", "טיוטות והערות"], ["agents", "סוכנים"], ].map(([value, label]) => ( {label} ))} ); const bandActions = ( <> {data && } {canStartWorkflow && ( )} ); return ( {/* parchment band — header (title/chips/parties/actions) + tab strip */} {isPending ? (
) : ( )} {/* full-width tab content — status lives ONLY in the overview hero (mockup 18b); the other tabs lose the status rail entirely (INV-IA1). */}
{/* ★ STATUS HERO — the single home for case status (INV-IA1/INV-UI7) */} {/* documents + agents two-column below the hero (mockup 18b) */}
{/* decision-editor CTA moved to the band actions (visible on all tabs) */}
); }