feat(confidence-engine): place zero-Open-Questions milestone at Open Questions position

Move the milestone invitation from after Clarified Questions to occupy
the same spatial position as Open Questions — between Current Understanding
and Questions we have clarified. Uses ternary: openUnknowns > 0 ? OpenQuestionsUI : milestoneAllowed ? MilestoneInvitation : null, followed by ClarifiedQuestionsUI unconditionally. No duplication of clarified cards or Re-open controls.
This commit is contained in:
2026-09-02 12:02:55 +01:00
parent 043ba5f264
commit a061428711
3 changed files with 211 additions and 8 deletions
+26 -8
View File
@@ -1180,7 +1180,7 @@ function FocusedInvestigationWorkspace({
function OpenQuestionsPanel({
graph, selectedPresentationItemId, focusedPresentationItemId, hasFocusedContent,
focused, formulationStep, formulateMsg, processingStep, deconstructMsg, doneForNowIds,
focused, formulationStep, formulateMsg, processingStep, deconstructMsg, doneForNowIds, cuSynthesisLoading,
startFocused, handleDeconstructSubmit, retryFormulation, setSelectedPresentationItemId,
setFocusedPresentationItemId, setFocusedAnswer, focusedAnswer, setDoneForNowIds,
setFollowUpQuestion, focusedContributions, focusedInvestigations, setIsFocusedWorkspaceOpen,
@@ -1194,8 +1194,9 @@ function OpenQuestionsPanel({
(n) => n.kind === "unknown" && !resolvedIds.has(n.id) && !doneForNowIds.includes(n.id),
);
if (openNodes.length <= 0) return null;
// Zero open questions: delegate to inline ReasoningWorkspace section for invitation + clarifications rendering
// No Open Questions cards to render when zero — invitation rendered inline instead
// The panel itself returns null; see ReasoningWorkspace inline section for the milestone UI.
// Check whether a node has a completed focused result stored locally.
const hasCompletedInvestigation = (nid) => {
const inv = focusedInvestigations?.[nid];
@@ -1795,7 +1796,7 @@ export default function ReasoningWorkspace({
{/* Current Understanding + Situation — independent vertical flow */}
<div className="flex gap-3 items-start flex-wrap">
{/* Current Understanding — prominent orienting surface */}
<div className={`rounded-xl border-[2.5px] border-teal-300/70 bg-gradient-to-b from-teal-50/60 to-white px-8 pt-7 pb-8 shadow-sm flex-1 min-w-0 relative ${hasGraph ? 'lg:max-w-2xl' : ''}`}>
<div id="cu-scroll-target" className={`rounded-xl border-[2.5px] border-teal-300/70 bg-gradient-to-b from-teal-50/60 to-white px-8 pt-7 pb-8 shadow-sm flex-1 min-w-0 relative ${hasGraph ? 'lg:max-w-2xl' : ''}`}>
<h2 className="mb-4 text-[11px] font-bold tracking-[.18em] uppercase text-teal-700/60">
Current Understanding
</h2>
@@ -1857,8 +1858,8 @@ export default function ReasoningWorkspace({
return (
<>
{/* OPEN QUESTIONS — unknown nodes (clickable → focused investigation) */}
{openUnknowns.length > 0 && (
{/* OPEN QUESTIONS or zero-Open-Questions milestone invitation (exclusive) */}
{openUnknowns.length > 0 ? (
<div className="space-y-3">
<h2 className="text-[11px] font-semibold tracking-widest uppercase text-gray-500">
Open Questions
@@ -1935,7 +1936,23 @@ export default function ReasoningWorkspace({
);
})()}
</div>
)}
) : openUnknowns.length === 0 && clarifiedQuestions.length > 0 && !cuSynthesisLoading ? (
<div className="rounded-xl border-[2.5px] border-teal-300/60 bg-gradient-to-b from-teal-50/40 to-white px-7 pt-5 pb-6">
<p className="text-sm leading-relaxed text-gray-700 mb-4">
{'You\'ve now worked through all of the questions we surfaced. Would you like to see an overview of what we understand so far?'}
</p>
<button
onClick={() => {
const el = document.getElementById("cu-scroll-target");
if (el) el.scrollIntoView({ behavior: "smooth", block: "start" });
}}
style={{ cursor: "pointer" }}
className="rounded-lg border border-teal-600 bg-white px-4 py-2 text-sm font-medium text-teal-700 hover:bg-teal-50 transition"
>
Review current understanding
</button>
</div>
) : null}
{/* QUESTIONS WE HAVE CLARIFIED — resolved unknowns shown post-Done */}
{clarifiedQuestions.length > 0 && (
@@ -2005,7 +2022,7 @@ export default function ReasoningWorkspace({
{/* Current Understanding — independent row, full-width of left area (cols 1-2) */}
{propUnderstanding && hasCurrentSummaryCondition && postAnalyseStatus !== "success" && (
<div className="lg:row-start-1 lg:col-span-full rounded-xl border-[2.5px] border-teal-300/70 bg-gradient-to-b from-teal-50/60 to-white px-8 pt-7 pb-8 shadow-sm relative">
<div id="cu-scroll-target" className="lg:row-start-1 lg:col-span-full rounded-xl border-[2.5px] border-teal-300/70 bg-gradient-to-b from-teal-50/60 to-white px-8 pt-7 pb-8 shadow-sm relative">
<CurrentUnderstandingCard currentSummary={graph?.currentSummary || result?.updatedSituationGraph?.currentSummary} plainLanguage={propUnderstanding} />
</div>
)}
@@ -2028,6 +2045,7 @@ export default function ReasoningWorkspace({
processingStep={processingStep}
deconstructMsg={deconstructMsg}
doneForNowIds={doneForNowIds}
cuSynthesisLoading={cuSynthesisLoading}
startFocused={startFocused}
handleDeconstructSubmit={handleDeconstructSubmit}
retryFormulation={retryFormulation}