refactor: unify terminal result cards and simplify history indicators

This commit is contained in:
2026-08-04 19:04:50 +01:00
parent 1f469fdadf
commit cadf74d461
+26 -12
View File
@@ -159,21 +159,31 @@ function hasGenuineCompletion(graph) {
}
// ── Completion card (terminal state when all unknowns resolved) ─
function CompletionCard() {
function CompletionCard({ summary }) {
return (
<div className="rounded-lg border border-green-300 bg-green-50 px-5 py-6 text-center">
<h2 className="mb-1 text-sm font-bold uppercase tracking-wide text-green-700">Investigation complete</h2>
<p className="text-base text-gray-800">The current investigation has reached a justified conclusion.</p>
<p className="text-base text-gray-800 mb-3">The available evidence supports the following understanding.</p>
{summary && (
<div className="mt-4 text-left rounded-md bg-white/60 px-4 py-3 border border-green-100">
<p className="text-sm leading-relaxed text-gray-700">{summary}</p>
</div>
)}
</div>
);
}
// ── Evidence-limit card (terminal state: no next question) ───────
function EvidenceLimitCard() {
function EvidenceLimitCard({ summary }) {
return (
<div className="rounded-lg border border-gray-200 bg-gray-50 px-5 py-6 text-center">
<h2 className="mb-1 text-sm font-bold uppercase tracking-wide text-gray-500">Current evidence limit reached</h2>
<p className="text-base text-gray-700">Further progress requires additional evidence.</p>
{summary && (
<div className="mt-4 text-left rounded-md bg-white/60 px-4 py-3 border border-gray-100">
<p className="text-sm leading-relaxed text-gray-700">{summary}</p>
</div>
)}
<p className="mt-3 text-base text-gray-700">Further progress requires additional evidence.</p>
</div>
);
}
@@ -221,13 +231,11 @@ function InvestigationHistoryCard({ turn }) {
open={!isCollapsed}
>
<summary className="cursor-pointer px-4 py-2 text-sm font-medium text-gray-700 hover:text-gray-900">
{isCollapsed ? "Q: " : " "}
{isCollapsed ? " " : " "}
{"✓ "}
{turn.question.length > 60 && !isCollapsed
? turn.question.slice(0, 60) + "…"
: turn.question}
{!isCollapsed && (
<span className="ml-2 text-xs font-normal text-gray-400"> answered</span>
)}
</summary>
<div className="px-4 pb-3 pt-1 space-y-2">
@@ -518,11 +526,17 @@ export default function ReasoningWorkspace({
)}
{/* ── Terminal state: outcome card (no active question) ─ */}
{status === "success" && !hasSelectedQuestion && graph && genuineCompletion && <CompletionCard />}
{status === "success" && !hasSelectedQuestion && graph && !genuineCompletion && <EvidenceLimitCard />}
{status === "success" && !hasSelectedQuestion && graph && genuineCompletion && (
<CompletionCard summary={resolveCurrentSummary(propUnderstanding || graph?.currentSummary || result?.updatedSituationGraph?.currentSummary)} />
)}
{status === "success" && !hasSelectedQuestion && graph && !genuineCompletion && (
<EvidenceLimitCard summary={resolveCurrentSummary(propUnderstanding || graph?.currentSummary || result?.updatedSituationGraph?.currentSummary)} />
)}
{/* ── Supporting sections (same order for active and terminal) ─ */}
{hasCurrentSummaryCondition && <CurrentUnderstandingCard currentSummary={graph?.currentSummary || result?.updatedSituationGraph?.currentSummary} plainLanguage={propUnderstanding || null} />}
{/* ── Current understanding (active investigation only) ─ */}
{hasCurrentSummaryCondition && !hasSelectedQuestion === false && (
<CurrentUnderstandingCard currentSummary={graph?.currentSummary || result?.updatedSituationGraph?.currentSummary} plainLanguage={propUnderstanding || null} />
)}
<OriginalSituation scenario={scenario} centralStatement={graph?.centralStatement} />