test(ui): explore provisional branch pause and reopen
This commit is contained in:
@@ -229,6 +229,10 @@ export default function ScenarioForm() {
|
||||
// Pre-seed Competitor development with a late result for RTO.27A testing
|
||||
const [branchNewResults, setBranchNewResults] = useState({ "branch-a": true });
|
||||
|
||||
/* ── RTO.27B — provisional done-for-now state (experimental) ── */
|
||||
|
||||
const [doneForNowBranchIds, setDoneForNowBranchIds] = useState([]);
|
||||
|
||||
/* ── RTO.26B — experimental branch-scoped reasoning fixture ───── */
|
||||
|
||||
const branchScoped = useBranchScopedFixture();
|
||||
@@ -270,15 +274,22 @@ export default function ScenarioForm() {
|
||||
}, [activeBranch, branchScoped]);
|
||||
|
||||
// Determine which non-active branches have new results for passive indicator
|
||||
// (RTO.27B: also include done-for-now branches so pause state is visible)
|
||||
const inactiveBranchNewResults = useMemo(() => {
|
||||
const result = {};
|
||||
BRANCHES.forEach(b => {
|
||||
if (b.id !== activeBranchId && b.id in branchNewResults) {
|
||||
result[b.id] = true;
|
||||
if (b.id !== activeBranchId) {
|
||||
if (b.id in branchNewResults) {
|
||||
result[b.id] = true;
|
||||
}
|
||||
// Show pause indicator on any done-for-now branch
|
||||
if (doneForNowBranchIds.includes(b.id)) {
|
||||
result[b.id] = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}, [activeBranchId, BRANCHES, branchNewResults]);
|
||||
}, [activeBranchId, BRANCHES, branchNewResults, doneForNowBranchIds]);
|
||||
|
||||
/* Restore persisted session on mount (Phase 3) ─────────── */
|
||||
useEffect(() => {
|
||||
@@ -472,6 +483,17 @@ export default function ScenarioForm() {
|
||||
branchLocalContributions={experimentalBranchContributions.length > 0 ? experimentalBranchContributions : undefined}
|
||||
branchLocalLateResults={experimentalBranchLateResults.length > 0 ? experimentalBranchLateResults : undefined}
|
||||
inactiveBranchNewResults={Object.keys(inactiveBranchNewResults).length > 0 ? inactiveBranchNewResults : undefined}
|
||||
activeBranchIdForNotebook={activeBranchId}
|
||||
doneForNowBranchIds={doneForNowBranchIds}
|
||||
onDoneForNow={() => {
|
||||
if (activeBranchId && !doneForNowBranchIds.includes(activeBranchId)) {
|
||||
setDoneForNowBranchIds(prev => [...prev, activeBranchId]);
|
||||
}
|
||||
}}
|
||||
onReopenBranch={(id) => {
|
||||
setDoneForNowBranchIds(prev => prev.filter(x => x !== id));
|
||||
setActiveBranchId(id);
|
||||
}}
|
||||
onRestart={() => { setStatus("idle"); setResult(null); setScenario(""); }}
|
||||
/>
|
||||
);
|
||||
@@ -484,14 +506,30 @@ export default function ScenarioForm() {
|
||||
branches={BRANCHES}
|
||||
activeBranchId={activeBranchId}
|
||||
branchNewResults={branchNewResults}
|
||||
branchPauseState={doneForNowBranchIds}
|
||||
onBranchSelect={(id) => {
|
||||
if (id !== activeBranchId) {
|
||||
setActiveBranchId(id);
|
||||
if (id === activeBranchId) return;
|
||||
// Reopen: if the selected branch is paused, clear its pause state
|
||||
if (doneForNowBranchIds.includes(id)) {
|
||||
setDoneForNowBranchIds(prev => prev.filter(x => x !== id));
|
||||
}
|
||||
setActiveBranchId(id);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{/* ── RTO.27B — simulated late update for paused branch (experimental dev control) ─ */}
|
||||
<div className="mt-2 flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => {
|
||||
// Simulate a late result arriving on the customer-demand branch while paused
|
||||
setBranchNewResults(prev => ({ ...prev, "branch-b": true }));
|
||||
}}
|
||||
className="rounded border border-purple-200/60 bg-purple-50 px-3 py-1.5 text-xs text-purple-700 hover:bg-purple-100 transition"
|
||||
>
|
||||
Simulate late update on Customer demand
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -669,6 +707,17 @@ export default function ScenarioForm() {
|
||||
branchLocalContributions={experimentalBranchContributions.length > 0 ? experimentalBranchContributions : undefined}
|
||||
branchLocalLateResults={experimentalBranchLateResults.length > 0 ? experimentalBranchLateResults : undefined}
|
||||
inactiveBranchNewResults={Object.keys(inactiveBranchNewResults).length > 0 ? inactiveBranchNewResults : undefined}
|
||||
activeBranchIdForNotebook={activeBranchId}
|
||||
doneForNowBranchIds={doneForNowBranchIds}
|
||||
onDoneForNow={() => {
|
||||
if (activeBranchId && !doneForNowBranchIds.includes(activeBranchId)) {
|
||||
setDoneForNowBranchIds(prev => [...prev, activeBranchId]);
|
||||
}
|
||||
}}
|
||||
onReopenBranch={(id) => {
|
||||
setDoneForNowBranchIds(prev => prev.filter(x => x !== id));
|
||||
setActiveBranchId(id);
|
||||
}}
|
||||
onRestart={() => {
|
||||
clearSession();
|
||||
setStatus("idle");
|
||||
@@ -691,11 +740,14 @@ export default function ScenarioForm() {
|
||||
branches={BRANCHES}
|
||||
activeBranchId={activeBranchId}
|
||||
branchNewResults={branchNewResults}
|
||||
branchPauseState={doneForNowBranchIds}
|
||||
onBranchSelect={(id) => {
|
||||
/* User intentionally navigates — nothing more */
|
||||
if (id !== activeBranchId) {
|
||||
setActiveBranchId(id);
|
||||
if (id === activeBranchId) return;
|
||||
// Reopen: if the selected branch is paused, clear its pause state
|
||||
if (doneForNowBranchIds.includes(id)) {
|
||||
setDoneForNowBranchIds(prev => prev.filter(x => x !== id));
|
||||
}
|
||||
setActiveBranchId(id);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user