TheYuchen commited on
Commit
bdf2f0e
·
1 Parent(s): 7ece09e

Visual calm pass: fewer simultaneous strips, chips, keys

Browse files

(a) RibbonLegend: still mounts only after the session's first run
(verified — the parent gates on the in-memory `run`), and now fades
out on its own after 20s (unmounts at 21s; mount-scoped timer, so
re-runs don't resurrect it). The × dismissal remains the only
persisted state. (b) Guidance-strip budget — at most ONE strip per
view, demo banner > hint: the Multiverse orientation hint collapses
to its header "?" while the demo banner is up (explicit "?" click
force-shows it for the session); the History-tab archive-io strip
starts collapsed to an "archive…" reopen chip when the banner
renders. (c) Evidence-pane header chip budget: at most two chips —
the seed chip absorbs the cached state as "cached · no seed" (a
precomputed response IS a response no seed was drawn for), replacing
the separate cached chip. (d) Node tiles audited: the post-run strip
cannot exceed glyph + headline/chips row + micro-CI row (chips row is
flex-nowrap, headline min-w-0 truncate, ≤3 shrink-0 chips); the
layout contract is now documented at RunResultStrip.

frontend/src/components/FlowCanvas.tsx CHANGED
@@ -1647,10 +1647,30 @@ function RibbonLegend() {
1647
  return false;
1648
  }
1649
  });
1650
- if (dismissed) return null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1651
  return (
1652
  <div
1653
- className="absolute left-16 z-10 panel-alt px-2.5 py-2 text-[10px] leading-relaxed text-mute shadow-md max-w-[250px] space-y-1"
 
 
1654
  style={{ bottom: "calc(env(safe-area-inset-bottom, 0px) + 1rem)" }}
1655
  role="note"
1656
  aria-label="Canvas encoding key"
 
1647
  return false;
1648
  }
1649
  });
1650
+ // Visual-calm contract: the key teaches, then leaves. It only mounts
1651
+ // after the session's FIRST run (the parent gates on `run`, which is
1652
+ // in-memory store state — a fresh session starts without it), fades
1653
+ // out on its own after 20 s and unmounts a second later so it stops
1654
+ // occluding the canvas. The timer is mount-scoped, so later runs in
1655
+ // the same session don't resurrect it. The × dismissal stays the
1656
+ // only PERSISTED state — an auto-faded key returns next session
1657
+ // until explicitly dismissed.
1658
+ const [fading, setFading] = useState(false);
1659
+ const [expired, setExpired] = useState(false);
1660
+ useEffect(() => {
1661
+ const t1 = setTimeout(() => setFading(true), 20_000);
1662
+ const t2 = setTimeout(() => setExpired(true), 21_000);
1663
+ return () => {
1664
+ clearTimeout(t1);
1665
+ clearTimeout(t2);
1666
+ };
1667
+ }, []);
1668
+ if (dismissed || expired) return null;
1669
  return (
1670
  <div
1671
+ className={`absolute left-16 z-10 panel-alt px-2.5 py-2 text-[10px] leading-relaxed text-mute shadow-md max-w-[250px] space-y-1 transition-opacity duration-1000 ${
1672
+ fading ? "opacity-0 pointer-events-none" : "opacity-100"
1673
+ }`}
1674
  style={{ bottom: "calc(env(safe-area-inset-bottom, 0px) + 1rem)" }}
1675
  role="note"
1676
  aria-label="Canvas encoding key"
frontend/src/components/MultiverseBoard.tsx CHANGED
@@ -392,6 +392,12 @@ export function MultiverseBoard() {
392
  return false;
393
  }
394
  });
 
 
 
 
 
 
395
  useEffect(() => {
396
  let alive = true;
397
  listRuns(200)
@@ -409,6 +415,10 @@ export function MultiverseBoard() {
409
  const groups = useMemo(() => buildGroups(runs ?? []), [runs]);
410
  const baseline = useMemo(() => pickBaseline(groups), [groups]);
411
 
 
 
 
 
412
  const openConfig = (g: ConfigGroup) => {
413
  const src = g.latestOk;
414
  if (!src) return;
@@ -447,13 +457,16 @@ export function MultiverseBoard() {
447
  </>
448
  )}
449
  </div>
450
- {hintDismissed && (
451
  <button
452
  type="button"
453
  className="shrink-0 p-0.5 rounded text-mute hover:text-ink hover:bg-surfaceAlt"
454
  title="Show the board orientation hint (what a card is and what Open / A/B do)"
455
  aria-label="Show multiverse orientation hint"
456
  onClick={() => {
 
 
 
457
  setHintDismissed(false);
458
  try {
459
  localStorage.removeItem(MULTIVERSE_HINT_LS_KEY);
@@ -481,14 +494,16 @@ export function MultiverseBoard() {
481
  />
482
  </div>
483
 
484
- {runs != null && runs.some((r) => r.demo) && <DemoArchiveBanner />}
485
 
486
  {/* Orientation one-liner (marker: multiverse-hint): the board's
487
  only guidance once cards exist — the empty state teaches, the
488
  tour is skippable, and the header key is lg-only. One line,
489
  task language, pinned above the grid; dismissal persists and
490
- the header "?" brings it back. */}
491
- {!hintDismissed && groups.length > 0 && (
 
 
492
  <div
493
  className="multiverse-hint flex items-center gap-2 border-b border-edge/60 bg-surfaceAlt/40 px-3 py-1.5 text-[11px] text-mute"
494
  role="note"
@@ -506,6 +521,7 @@ export function MultiverseBoard() {
506
  title="Dismiss (remembered on this device — the ? in the header brings it back)"
507
  aria-label="Dismiss multiverse orientation hint"
508
  onClick={() => {
 
509
  setHintDismissed(true);
510
  try {
511
  localStorage.setItem(MULTIVERSE_HINT_LS_KEY, "1");
 
392
  return false;
393
  }
394
  });
395
+ // Guidance-strip budget (visual-calm pass): at most ONE strip at a
396
+ // time on this board, priority demo banner > orientation hint. While
397
+ // the demo banner is up the hint collapses to its "?" reopen
398
+ // affordance; clicking "?" is explicit intent, so it force-shows the
399
+ // hint for the session (hintForced) even alongside the banner.
400
+ const [hintForced, setHintForced] = useState(false);
401
  useEffect(() => {
402
  let alive = true;
403
  listRuns(200)
 
415
  const groups = useMemo(() => buildGroups(runs ?? []), [runs]);
416
  const baseline = useMemo(() => pickBaseline(groups), [groups]);
417
 
418
+ const demoBannerVisible = runs != null && runs.some((r) => r.demo);
419
+ const hintVisible =
420
+ groups.length > 0 && (hintForced || (!hintDismissed && !demoBannerVisible));
421
+
422
  const openConfig = (g: ConfigGroup) => {
423
  const src = g.latestOk;
424
  if (!src) return;
 
457
  </>
458
  )}
459
  </div>
460
+ {!hintVisible && (
461
  <button
462
  type="button"
463
  className="shrink-0 p-0.5 rounded text-mute hover:text-ink hover:bg-surfaceAlt"
464
  title="Show the board orientation hint (what a card is and what Open / A/B do)"
465
  aria-label="Show multiverse orientation hint"
466
  onClick={() => {
467
+ // Explicit reopen beats the one-strip rule AND any
468
+ // persisted dismissal.
469
+ setHintForced(true);
470
  setHintDismissed(false);
471
  try {
472
  localStorage.removeItem(MULTIVERSE_HINT_LS_KEY);
 
494
  />
495
  </div>
496
 
497
+ {demoBannerVisible && <DemoArchiveBanner />}
498
 
499
  {/* Orientation one-liner (marker: multiverse-hint): the board's
500
  only guidance once cards exist — the empty state teaches, the
501
  tour is skippable, and the header key is lg-only. One line,
502
  task language, pinned above the grid; dismissal persists and
503
+ the header "?" brings it back. Suppressed while the demo
504
+ banner is up (one guidance strip at a time) unless the user
505
+ explicitly reopened it. */}
506
+ {hintVisible && (
507
  <div
508
  className="multiverse-hint flex items-center gap-2 border-b border-edge/60 bg-surfaceAlt/40 px-3 py-1.5 text-[11px] text-mute"
509
  role="note"
 
521
  title="Dismiss (remembered on this device — the ? in the header brings it back)"
522
  aria-label="Dismiss multiverse orientation hint"
523
  onClick={() => {
524
+ setHintForced(false);
525
  setHintDismissed(true);
526
  try {
527
  localStorage.setItem(MULTIVERSE_HINT_LS_KEY, "1");
frontend/src/components/QNode.tsx CHANGED
@@ -369,7 +369,18 @@ function LiveEvidenceStrip({
369
  /** After-run strip at the bottom of the node tile: headline metric +
370
  * duration chip + cache indicator. None of these are interactive,
371
  * but they make the canvas itself a glanceable dashboard once a run
372
- * has happened. */
 
 
 
 
 
 
 
 
 
 
 
373
  function RunResultStrip({
374
  kind,
375
  step,
 
369
  /** After-run strip at the bottom of the node tile: headline metric +
370
  * duration chip + cache indicator. None of these are interactive,
371
  * but they make the canvas itself a glanceable dashboard once a run
372
+ * has happened.
373
+ *
374
+ * Layout contract (visual-calm audit, 2026-07-10): the strip is at
375
+ * most the stretched glyph + TWO further rows — (1) headline+chips,
376
+ * (2) the 3px micro-CI bar — at ANY tile width. The chips row cannot
377
+ * wrap: it is flex-nowrap, the headline block is min-w-0 + truncate
378
+ * (it gives way first), the chips are shrink-0, and at most three
379
+ * small chips can coexist (⏹ shots · one cached/live chip —
380
+ * RunStatusChips renders at most one — · duration). Worst case
381
+ * ≈130px of chips against the 180px min tile width, so the headline
382
+ * truncates rather than the row wrapping. If a chip is ever added
383
+ * here, re-audit against that budget. */
384
  function RunResultStrip({
385
  kind,
386
  step,
frontend/src/components/ResultsPane.tsx CHANGED
@@ -108,29 +108,37 @@ export function ResultsPane({ onCollapse }: { onCollapse?: () => void } = {}) {
108
  view={`evidence-${tab}`}
109
  />
110
  )}
111
- {run?.seed_mode && (
 
 
 
 
 
 
112
  <span
113
- className={`chip ${run.seed_mode === "pinned" ? "!border-accent/40 !text-accent" : ""}`}
 
 
 
 
114
  title={
115
- run.seed_mode === "pinned"
116
- ? `Replayed with pinned root seed ${run.root_seed} — stochastic steps reproduce exactly.`
117
- : run.root_seed != null
118
- ? `Fresh draw. Recorded root seed ${run.root_seed} — replay it any time from the “This configuration” tab.`
119
- : "Served from the precomputed cache — no seed was drawn for this response."
 
 
120
  }
121
  >
122
- {run.seed_mode === "pinned" ? `seed ${run.root_seed}` : "fresh"}
 
 
 
 
123
  <TipIcon hint={gloss("seed")} size={10} position="below" />
124
  </span>
125
  )}
126
- {run?.from_cache && (
127
- <span
128
- className="chip !border-accent/40 !text-accent"
129
- title="Served from a precomputed cache (this circuit + pipeline combo was run ahead of time). Swap in your own circuit or tweak the graph to trigger a fresh run."
130
- >
131
- cached
132
- </span>
133
- )}
134
  {run && (
135
  <span className="chip">
136
  {run.steps.length} step{run.steps.length === 1 ? "" : "s"}
 
108
  view={`evidence-${tab}`}
109
  />
110
  )}
111
+ {/* Chip budget (visual-calm pass): at most TWO chips in this
112
+ header — the seed-state chip and the step count. The seed
113
+ chip ABSORBS the cached state ("cached · no seed" — a
114
+ precomputed-cache response is exactly a response no seed
115
+ was drawn for), instead of stacking a third chip that
116
+ overflowed narrow panes. */}
117
+ {run && (run.seed_mode || run.from_cache) && (
118
  <span
119
+ className={`chip ${
120
+ run.seed_mode === "pinned" || run.from_cache
121
+ ? "!border-accent/40 !text-accent"
122
+ : ""
123
+ }`}
124
  title={
125
+ run.from_cache
126
+ ? "Served from a precomputed cache (this circuit + pipeline combo was run ahead of time) — no seed was drawn for this response. Swap in your own circuit or tweak the graph to trigger a fresh, seeded run."
127
+ : run.seed_mode === "pinned"
128
+ ? `Replayed with pinned root seed ${run.root_seed} — stochastic steps reproduce exactly.`
129
+ : run.root_seed != null
130
+ ? `Fresh draw. Recorded root seed ${run.root_seed} — replay it any time from the “This configuration” tab.`
131
+ : "No seed was drawn for this response."
132
  }
133
  >
134
+ {run.from_cache
135
+ ? "cached · no seed"
136
+ : run.seed_mode === "pinned"
137
+ ? `seed ${run.root_seed}`
138
+ : "fresh"}
139
  <TipIcon hint={gloss("seed")} size={10} position="below" />
140
  </span>
141
  )}
 
 
 
 
 
 
 
 
142
  {run && (
143
  <span className="chip">
144
  {run.steps.length} step{run.steps.length === 1 ? "" : "s"}
frontend/src/components/RunHistory.tsx CHANGED
@@ -371,9 +371,36 @@ function KeyItem({
371
  * fields in the file are never trusted) and skips run_ids already
372
  * present, so importing twice — or importing on top of the bundled
373
  * demo records — is safe. */
374
- function ArchiveIO({ count }: { count: number }) {
 
 
 
 
 
 
375
  const [msg, setMsg] = useState<string | null>(null);
376
  const fileRef = useRef<HTMLInputElement>(null);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
377
  const onExport = () => {
378
  exportArchive()
379
  .then((n) => setMsg(`exported ${n} run${n === 1 ? "" : "s"}`))
@@ -640,7 +667,12 @@ export function RunHistory({ embedded = false }: { embedded?: boolean } = {}) {
640
  configuration.
641
  </div>
642
  <LineageLegend />
643
- <ArchiveIO count={records.length} />
 
 
 
 
 
644
  {records.some((r) => r.demo) && <DemoArchiveBanner />}
645
  {/* Compare needs TWO runs, but nothing used to acknowledge the
646
  first checkbox beyond a "1" on a tab the user may never
 
371
  * fields in the file are never trusted) and skips run_ids already
372
  * present, so importing twice — or importing on top of the bundled
373
  * demo records — is safe. */
374
+ function ArchiveIO({
375
+ count,
376
+ collapsed = false,
377
+ }: {
378
+ count: number;
379
+ collapsed?: boolean;
380
+ }) {
381
  const [msg, setMsg] = useState<string | null>(null);
382
  const fileRef = useRef<HTMLInputElement>(null);
383
+ // Guidance-strip budget (visual-calm pass): at most ONE strip at a
384
+ // time in this tab, and the demo banner outranks this one. While the
385
+ // banner is up the parent passes collapsed=true and the strip
386
+ // shrinks to a single reopen affordance; expanding it back is
387
+ // explicit user intent, so it wins for the session.
388
+ const [userOpened, setUserOpened] = useState(false);
389
+ if (collapsed && !userOpened)
390
+ return (
391
+ <div className="archive-io flex justify-end border-b border-edge/40 px-1.5 py-0.5">
392
+ <button
393
+ type="button"
394
+ className="flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] text-mute hover:text-ink hover:bg-surfaceAlt"
395
+ title="Show the archive hand-off controls: export this browser's runs to a JSON file, or import one from another device"
396
+ aria-label="Show archive export/import controls"
397
+ onClick={() => setUserOpened(true)}
398
+ >
399
+ <Download className="w-3 h-3" />
400
+ archive…
401
+ </button>
402
+ </div>
403
+ );
404
  const onExport = () => {
405
  exportArchive()
406
  .then((n) => setMsg(`exported ${n} run${n === 1 ? "" : "s"}`))
 
667
  configuration.
668
  </div>
669
  <LineageLegend />
670
+ {/* One guidance strip at a time: when the demo banner below
671
+ renders, the archive-io strip starts collapsed. */}
672
+ <ArchiveIO
673
+ count={records.length}
674
+ collapsed={records.some((r) => r.demo)}
675
+ />
676
  {records.some((r) => r.demo) && <DemoArchiveBanner />}
677
  {/* Compare needs TWO runs, but nothing used to acknowledge the
678
  first checkbox beyond a "1" on a tab the user may never