"use client"; import React from "react"; import { listInvestigations, restartInvestigation } from "@/lib/storage/investigation-storage"; import Link from "next/link"; import { useRouter } from "next/navigation"; function Portfolio() { const router = useRouter(); const [summaries, setSummaries] = React.useState([]); const [hydrated, setHydrated] = React.useState(false); const [loadError, setLoadError] = React.useState(null); const [showRestartConfirm, setShowRestartConfirm] = React.useState(false); React.useEffect(() => { let active = true; (async () => { try { const investigations = await listInvestigations(); if (active) setSummaries(investigations); } catch (error) { if (active) setLoadError(error); } finally { if (active) setHydrated(true); } })(); return () => { active = false; }; }, []); return (

Confidence Engine

Investigator's notebook — index of persisted investigations.

{/* Investigation collection */} {summaries.length > 0 && (

Investigations

{summaries.map((summary) => (

{summary.scenario || "Untitled investigation"}

{summary.reportExists ? (
View report {summary.reportGeneratedFromRevision === summary.investigationRevision ? ( Current ) : ( Update available )}
) : null} Continue investigation {showRestartConfirm === summary.id && (
setShowRestartConfirm(null)} >
e.stopPropagation()} >

Restart this investigation?

Your current investigation, findings, clarified questions, and report will be lost. Are you sure you want to continue?

)}
))}
)} {/* No investigations */} {!hydrated && (

Investigations

Loading investigations…

)} {hydrated && loadError && (

Investigations

Unable to load investigations.

)} {hydrated && !loadError && summaries.length === 0 && (

Investigations

No investigations yet.

)}
); } export default Portfolio;