Toolbar calm-down: authoring vs evidence clusters
Browse filesThe canvas toolbar mixed authoring (preset, wiring, share, export,
clear) with evidence controls (replicates, target, seed, cost, Run).
Now two visually separated clusters: LEFT = workspace toggle +
authoring (counters, preset, Auto-connect, camera, Clear, ⋯ menu);
RIGHT = evidence group (pinned seed, ×N, precision target, cost chip,
Run) behind a md-gated divider with a faint "evidence" group label —
the toolbar reads as "what am I composing?" vs "what will the next
run measure?". Share + Export .py are demoted into the ⋯ MoreMenu at
EVERY width (their rows always render; Auto-connect/Clear rows are
md:hidden so exactly one reachable copy of each action exists at any
width) — two fewer permanent buttons, plus the Theater button already
removed by the three-scales commit. ShareButton toolbar instance and
its import dropped; MoreMenu's stale breakpoint-close guard removed;
NextStepsHint points at the ⋯ menu for Export .py.
|
@@ -21,7 +21,6 @@ import {
|
|
| 21 |
AlertTriangle,
|
| 22 |
Box,
|
| 23 |
Check,
|
| 24 |
-
Code2,
|
| 25 |
Link2,
|
| 26 |
Loader2,
|
| 27 |
Play,
|
|
@@ -71,7 +70,6 @@ import { QNode, type QNodeData } from "./QNode";
|
|
| 71 |
import { RibbonEdge } from "./RibbonEdge";
|
| 72 |
import { PresetPicker } from "./PresetPicker";
|
| 73 |
import { WorkspaceToggle } from "./WorkspaceToggle";
|
| 74 |
-
import { ShareButton } from "./ShareButton";
|
| 75 |
import { EmptyCanvas } from "./EmptyCanvas";
|
| 76 |
import { MoreMenu } from "./MoreMenu";
|
| 77 |
import { FigureExportButton } from "./FigureExportButton";
|
|
@@ -753,9 +751,9 @@ export function FlowCanvas() {
|
|
| 753 |
setNotice(null);
|
| 754 |
};
|
| 755 |
|
| 756 |
-
// Share flow
|
| 757 |
-
//
|
| 758 |
-
//
|
| 759 |
const handleShareFromMenu = async () => {
|
| 760 |
const payload = buildSharePayload(nodes, edges, sampleKey);
|
| 761 |
const url = buildShareUrl(payload);
|
|
@@ -1150,11 +1148,19 @@ export function FlowCanvas() {
|
|
| 1150 |
line fits (the common wide case) min-h-12 renders pixel-
|
| 1151 |
identical to the old fixed row. */}
|
| 1152 |
<div className="min-h-12 shrink-0 border-b border-edge px-3 sm:px-4 py-1 flex flex-wrap items-center justify-between gap-x-2 sm:gap-x-4 gap-y-1">
|
| 1153 |
-
{/*
|
| 1154 |
-
|
| 1155 |
-
|
| 1156 |
-
|
| 1157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1158 |
<WorkspaceToggle />
|
| 1159 |
<span className="hidden sm:inline text-edge">·</span>
|
| 1160 |
<span className="hidden sm:inline">{nodes.length} blocks</span>
|
|
@@ -1170,19 +1176,11 @@ export function FlowCanvas() {
|
|
| 1170 |
<Link2 className="w-3 h-3" aria-hidden="true" />
|
| 1171 |
<span className="tabular-nums">{edges.length}</span>
|
| 1172 |
</span>
|
| 1173 |
-
</div>
|
| 1174 |
-
{/* min-w-0 (NOT shrink-0) is what lets flex-wrap actually engage:
|
| 1175 |
-
a shrink-0 cluster would keep its one-line preferred width and
|
| 1176 |
-
overflow the row instead of wrapping its buttons. justify-end
|
| 1177 |
-
keeps continuation lines right-aligned, so Run stays in the
|
| 1178 |
-
bottom-right corner of the toolbar where the eye expects it. */}
|
| 1179 |
-
<div className="flex flex-wrap items-center justify-end gap-1.5 sm:gap-2 gap-y-1 min-w-0">
|
| 1180 |
<PresetPicker onPick={loadPreset} />
|
| 1181 |
-
|
| 1182 |
-
|
| 1183 |
-
|
| 1184 |
-
|
| 1185 |
-
Run pipeline. */}
|
| 1186 |
<button
|
| 1187 |
onClick={runAutoConnect}
|
| 1188 |
disabled={nodes.length < 2}
|
|
@@ -1197,23 +1195,6 @@ export function FlowCanvas() {
|
|
| 1197 |
<Wand2 className="w-3.5 h-3.5" />
|
| 1198 |
<span className="hidden lg:inline">Auto-connect</span>
|
| 1199 |
</button>
|
| 1200 |
-
<ShareButton
|
| 1201 |
-
nodes={nodes}
|
| 1202 |
-
edges={edges}
|
| 1203 |
-
sampleKey={sampleKey}
|
| 1204 |
-
className="hidden md:inline-flex"
|
| 1205 |
-
labelBreakpoint="lg"
|
| 1206 |
-
/>
|
| 1207 |
-
<button
|
| 1208 |
-
onClick={exportPython}
|
| 1209 |
-
disabled={nodes.length === 0}
|
| 1210 |
-
className="btn hidden md:inline-flex disabled:opacity-40 disabled:cursor-not-allowed"
|
| 1211 |
-
title="Export this pipeline as a runnable Python script"
|
| 1212 |
-
aria-label="Export Python script"
|
| 1213 |
-
>
|
| 1214 |
-
<Code2 className="w-3.5 h-3.5" />
|
| 1215 |
-
<span className="hidden lg:inline">Export .py</span>
|
| 1216 |
-
</button>
|
| 1217 |
{/* Paper-figure export of the whole canvas (hybrid path:
|
| 1218 |
foreignObject SVG + hi-res PNG; provenance embedded). */}
|
| 1219 |
<FigureExportButton
|
|
@@ -1232,11 +1213,9 @@ export function FlowCanvas() {
|
|
| 1232 |
<Trash2 className="w-3.5 h-3.5" />
|
| 1233 |
<span className="hidden lg:inline">Clear</span>
|
| 1234 |
</button>
|
| 1235 |
-
|
| 1236 |
-
|
| 1237 |
-
"More" menu. Keeps the toolbar to 3 visible controls on phones. */}
|
| 1238 |
<MoreMenu
|
| 1239 |
-
className="md:hidden"
|
| 1240 |
canAutoConnect={nodes.length >= 2}
|
| 1241 |
hasEdgesToReplace={edges.length > 0}
|
| 1242 |
canClear={nodes.length > 0 || edges.length > 0}
|
|
@@ -1246,7 +1225,30 @@ export function FlowCanvas() {
|
|
| 1246 |
onExport={exportPython}
|
| 1247 |
onClear={clearGraph}
|
| 1248 |
/>
|
| 1249 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1250 |
{/* Pinned-seed chip: visible whenever the next run will replay
|
| 1251 |
a specific draw instead of sampling fresh. The × clears the
|
| 1252 |
pin and returns to fresh sampling. */}
|
|
|
|
| 21 |
AlertTriangle,
|
| 22 |
Box,
|
| 23 |
Check,
|
|
|
|
| 24 |
Link2,
|
| 25 |
Loader2,
|
| 26 |
Play,
|
|
|
|
| 70 |
import { RibbonEdge } from "./RibbonEdge";
|
| 71 |
import { PresetPicker } from "./PresetPicker";
|
| 72 |
import { WorkspaceToggle } from "./WorkspaceToggle";
|
|
|
|
| 73 |
import { EmptyCanvas } from "./EmptyCanvas";
|
| 74 |
import { MoreMenu } from "./MoreMenu";
|
| 75 |
import { FigureExportButton } from "./FigureExportButton";
|
|
|
|
| 751 |
setNotice(null);
|
| 752 |
};
|
| 753 |
|
| 754 |
+
// Share flow for the toolbar's ⋯ menu (Share lives there at every
|
| 755 |
+
// width since the authoring-vs-evidence cluster split). The menu
|
| 756 |
+
// closes on click, so feedback surfaces as a canvas toast.
|
| 757 |
const handleShareFromMenu = async () => {
|
| 758 |
const payload = buildSharePayload(nodes, edges, sampleKey);
|
| 759 |
const url = buildShareUrl(payload);
|
|
|
|
| 1148 |
line fits (the common wide case) min-h-12 renders pixel-
|
| 1149 |
identical to the old fixed row. */}
|
| 1150 |
<div className="min-h-12 shrink-0 border-b border-edge px-3 sm:px-4 py-1 flex flex-wrap items-center justify-between gap-x-2 sm:gap-x-4 gap-y-1">
|
| 1151 |
+
{/* ---- LEFT: workspace + AUTHORING cluster --------------------
|
| 1152 |
+
Two-cluster toolbar (authoring vs evidence). Everything on
|
| 1153 |
+
this side describes or edits the COMPOSITION — mode toggle,
|
| 1154 |
+
block/link counters, preset, wiring, figure snapshot,
|
| 1155 |
+
clear, overflow menu — and none of it changes what the next
|
| 1156 |
+
run MEASURES. Rarely-used authoring actions (Share,
|
| 1157 |
+
Export .py) live in the ⋯ menu at EVERY width: reachable,
|
| 1158 |
+
but two fewer buttons of permanent chrome. min-w-0 +
|
| 1159 |
+
flex-wrap so the cluster wraps instead of clipping in a
|
| 1160 |
+
narrow center column. Counters: full text on ≥sm; on <sm an
|
| 1161 |
+
icon pair (Box = "blocks", Link2 = "links") — a bare "5·4"
|
| 1162 |
+
was unreadable in user testing. */}
|
| 1163 |
+
<div className="flex flex-wrap items-center gap-1.5 sm:gap-2 gap-y-1 min-w-0 text-xs text-mute">
|
| 1164 |
<WorkspaceToggle />
|
| 1165 |
<span className="hidden sm:inline text-edge">·</span>
|
| 1166 |
<span className="hidden sm:inline">{nodes.length} blocks</span>
|
|
|
|
| 1176 |
<Link2 className="w-3 h-3" aria-hidden="true" />
|
| 1177 |
<span className="tabular-nums">{edges.length}</span>
|
| 1178 |
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1179 |
<PresetPicker onPick={loadPreset} />
|
| 1180 |
+
{/* Frequent authoring actions as buttons at ≥md (labels at
|
| 1181 |
+
≥lg); below md they live in the ⋯ menu instead (its
|
| 1182 |
+
Auto-connect/Clear rows are md:hidden — mirrored
|
| 1183 |
+
visibility, exactly one reachable copy at any width). */}
|
|
|
|
| 1184 |
<button
|
| 1185 |
onClick={runAutoConnect}
|
| 1186 |
disabled={nodes.length < 2}
|
|
|
|
| 1195 |
<Wand2 className="w-3.5 h-3.5" />
|
| 1196 |
<span className="hidden lg:inline">Auto-connect</span>
|
| 1197 |
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1198 |
{/* Paper-figure export of the whole canvas (hybrid path:
|
| 1199 |
foreignObject SVG + hi-res PNG; provenance embedded). */}
|
| 1200 |
<FigureExportButton
|
|
|
|
| 1213 |
<Trash2 className="w-3.5 h-3.5" />
|
| 1214 |
<span className="hidden lg:inline">Clear</span>
|
| 1215 |
</button>
|
| 1216 |
+
{/* ⋯ overflow menu (ALL widths): Share + Export .py always
|
| 1217 |
+
live here; Auto-connect + Clear join below md. */}
|
|
|
|
| 1218 |
<MoreMenu
|
|
|
|
| 1219 |
canAutoConnect={nodes.length >= 2}
|
| 1220 |
hasEdgesToReplace={edges.length > 0}
|
| 1221 |
canClear={nodes.length > 0 || edges.length > 0}
|
|
|
|
| 1225 |
onExport={exportPython}
|
| 1226 |
onClear={clearGraph}
|
| 1227 |
/>
|
| 1228 |
+
</div>
|
| 1229 |
+
{/* ---- RIGHT: EVIDENCE cluster --------------------------------
|
| 1230 |
+
Everything here shapes or prices the evidence the next Run
|
| 1231 |
+
buys: pinned seed, replicate count, optional-stopping
|
| 1232 |
+
target, cost estimate, and Run itself. Visually separated
|
| 1233 |
+
from authoring (divider + faint group label at ≥md) so the
|
| 1234 |
+
toolbar reads as two questions — "what am I composing?" vs
|
| 1235 |
+
"what will the next run measure?". min-w-0 (NOT shrink-0)
|
| 1236 |
+
is what lets flex-wrap actually engage; justify-end keeps
|
| 1237 |
+
continuation lines right-aligned, so Run stays in the
|
| 1238 |
+
bottom-right corner where the eye expects it. Below md
|
| 1239 |
+
every control here is hidden (the Run FAB takes over), so
|
| 1240 |
+
the divider is md-gated too. */}
|
| 1241 |
+
<div
|
| 1242 |
+
role="group"
|
| 1243 |
+
aria-label="Evidence controls for the next run"
|
| 1244 |
+
className="flex flex-wrap items-center justify-end gap-1.5 sm:gap-2 gap-y-1 min-w-0 md:border-l md:border-edge/60 md:pl-3"
|
| 1245 |
+
>
|
| 1246 |
+
<span
|
| 1247 |
+
className="hidden lg:inline text-[9px] uppercase tracking-wider text-mute/70 select-none"
|
| 1248 |
+
title="Controls for the next run's evidence: replicates, stopping target, seed, estimated cost."
|
| 1249 |
+
>
|
| 1250 |
+
evidence
|
| 1251 |
+
</span>
|
| 1252 |
{/* Pinned-seed chip: visible whenever the next run will replay
|
| 1253 |
a specific draw instead of sampling fresh. The × clears the
|
| 1254 |
pin and returns to fresh sampling. */}
|
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import { useCallback,
|
| 2 |
import {
|
| 3 |
Code2,
|
| 4 |
Link as LinkIcon,
|
|
@@ -9,21 +9,18 @@ import {
|
|
| 9 |
import { useDismissOn } from "../lib/useDismissOn";
|
| 10 |
|
| 11 |
/**
|
| 12 |
-
*
|
|
|
|
| 13 |
*
|
| 14 |
-
*
|
| 15 |
-
*
|
| 16 |
-
*
|
| 17 |
-
*
|
| 18 |
-
*
|
|
|
|
|
|
|
| 19 |
*
|
| 20 |
-
*
|
| 21 |
-
* - outside click
|
| 22 |
-
* - Escape keypress
|
| 23 |
-
* - viewport growing past `md` (i.e. the menu's wrapper flips to
|
| 24 |
-
* `display:none`; without this guard the React `open` state would
|
| 25 |
-
* silently stay `true` and the menu would pop back open if the
|
| 26 |
-
* user shrinks the viewport again)
|
| 27 |
*/
|
| 28 |
export function MoreMenu({
|
| 29 |
className = "",
|
|
@@ -51,22 +48,6 @@ export function MoreMenu({
|
|
| 51 |
|
| 52 |
useDismissOn(open, rootRef, useCallback(() => setOpen(false), []));
|
| 53 |
|
| 54 |
-
// Responsive guard: if the viewport grows past the `md` breakpoint
|
| 55 |
-
// while the menu is open, the wrapper becomes `display:none` but the
|
| 56 |
-
// React `open` state is unchanged. Resizing back to mobile would then
|
| 57 |
-
// re-reveal the menu in an "open" state the user never asked for.
|
| 58 |
-
// `matchMedia` fires the moment the breakpoint is crossed so we can
|
| 59 |
-
// close the menu eagerly.
|
| 60 |
-
useEffect(() => {
|
| 61 |
-
if (typeof window === "undefined") return;
|
| 62 |
-
const mq = window.matchMedia("(min-width: 768px)");
|
| 63 |
-
const onChange = () => {
|
| 64 |
-
if (mq.matches) setOpen(false);
|
| 65 |
-
};
|
| 66 |
-
mq.addEventListener("change", onChange);
|
| 67 |
-
return () => mq.removeEventListener("change", onChange);
|
| 68 |
-
}, []);
|
| 69 |
-
|
| 70 |
const items: {
|
| 71 |
key: string;
|
| 72 |
icon: React.ReactNode;
|
|
@@ -74,6 +55,9 @@ export function MoreMenu({
|
|
| 74 |
sub?: string;
|
| 75 |
disabled?: boolean;
|
| 76 |
tone?: "default" | "danger";
|
|
|
|
|
|
|
|
|
|
| 77 |
onClick: () => void;
|
| 78 |
}[] = [
|
| 79 |
{
|
|
@@ -84,6 +68,7 @@ export function MoreMenu({
|
|
| 84 |
? "Re-wire all blocks (replaces existing links)"
|
| 85 |
: "Wire all blocks into a sensible chain",
|
| 86 |
disabled: !canAutoConnect,
|
|
|
|
| 87 |
onClick: onAutoConnect,
|
| 88 |
},
|
| 89 |
{
|
|
@@ -108,6 +93,7 @@ export function MoreMenu({
|
|
| 108 |
sub: "Remove every block and link",
|
| 109 |
disabled: !canClear,
|
| 110 |
tone: "danger",
|
|
|
|
| 111 |
onClick: onClear,
|
| 112 |
},
|
| 113 |
];
|
|
@@ -145,7 +131,7 @@ export function MoreMenu({
|
|
| 145 |
it.onClick();
|
| 146 |
setOpen(false);
|
| 147 |
}}
|
| 148 |
-
className={`flex items-start gap-3 px-3 py-2 rounded-md text-left transition-colors border border-transparent disabled:opacity-40 disabled:cursor-not-allowed ${
|
| 149 |
it.tone === "danger"
|
| 150 |
? "hover:bg-danger/10 hover:border-danger/40 text-ink"
|
| 151 |
: "hover:bg-surfaceAlt hover:border-edge/60 text-ink"
|
|
|
|
| 1 |
+
import { useCallback, useRef, useState } from "react";
|
| 2 |
import {
|
| 3 |
Code2,
|
| 4 |
Link as LinkIcon,
|
|
|
|
| 9 |
import { useDismissOn } from "../lib/useDismissOn";
|
| 10 |
|
| 11 |
/**
|
| 12 |
+
* Overflow menu for the canvas toolbar's AUTHORING cluster — rendered
|
| 13 |
+
* at EVERY width since the authoring-vs-evidence cluster split.
|
| 14 |
*
|
| 15 |
+
* Contents by width:
|
| 16 |
+
* * always: Share + Export .py — rarely-used authoring actions,
|
| 17 |
+
* demoted out of permanent chrome but one click away;
|
| 18 |
+
* * < md only: Auto-connect + Clear join the menu (their standalone
|
| 19 |
+
* toolbar buttons are md-gated), keeping the phone toolbar to
|
| 20 |
+
* three visible controls. The rows carry `md:hidden` so exactly
|
| 21 |
+
* one reachable copy of each action exists at any width.
|
| 22 |
*
|
| 23 |
+
* Closes itself on outside click and Escape (useDismissOn).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
*/
|
| 25 |
export function MoreMenu({
|
| 26 |
className = "",
|
|
|
|
| 48 |
|
| 49 |
useDismissOn(open, rootRef, useCallback(() => setOpen(false), []));
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
const items: {
|
| 52 |
key: string;
|
| 53 |
icon: React.ReactNode;
|
|
|
|
| 55 |
sub?: string;
|
| 56 |
disabled?: boolean;
|
| 57 |
tone?: "default" | "danger";
|
| 58 |
+
/** true = this action has its own toolbar button at ≥md, so its
|
| 59 |
+
* menu row hides there (md:hidden) — one reachable copy only. */
|
| 60 |
+
mobileOnly?: boolean;
|
| 61 |
onClick: () => void;
|
| 62 |
}[] = [
|
| 63 |
{
|
|
|
|
| 68 |
? "Re-wire all blocks (replaces existing links)"
|
| 69 |
: "Wire all blocks into a sensible chain",
|
| 70 |
disabled: !canAutoConnect,
|
| 71 |
+
mobileOnly: true,
|
| 72 |
onClick: onAutoConnect,
|
| 73 |
},
|
| 74 |
{
|
|
|
|
| 93 |
sub: "Remove every block and link",
|
| 94 |
disabled: !canClear,
|
| 95 |
tone: "danger",
|
| 96 |
+
mobileOnly: true,
|
| 97 |
onClick: onClear,
|
| 98 |
},
|
| 99 |
];
|
|
|
|
| 131 |
it.onClick();
|
| 132 |
setOpen(false);
|
| 133 |
}}
|
| 134 |
+
className={`${it.mobileOnly ? "md:hidden " : ""}flex items-start gap-3 px-3 py-2 rounded-md text-left transition-colors border border-transparent disabled:opacity-40 disabled:cursor-not-allowed ${
|
| 135 |
it.tone === "danger"
|
| 136 |
? "hover:bg-danger/10 hover:border-danger/40 text-ink"
|
| 137 |
: "hover:bg-surfaceAlt hover:border-edge/60 text-ink"
|
|
@@ -330,9 +330,9 @@ function NextStepsHint() {
|
|
| 330 |
<div className="flex items-start gap-1.5 text-mute">
|
| 331 |
<Code2 className="w-3 h-3 mt-0.5 text-accent shrink-0" />
|
| 332 |
<span>
|
| 333 |
-
<span className="text-ink">Export .py</span>
|
| 334 |
-
your own Jupyter / slurm setup, or
|
| 335 |
-
to compare.
|
| 336 |
</span>
|
| 337 |
</div>
|
| 338 |
</div>
|
|
|
|
| 330 |
<div className="flex items-start gap-1.5 text-mute">
|
| 331 |
<Code2 className="w-3 h-3 mt-0.5 text-accent shrink-0" />
|
| 332 |
<span>
|
| 333 |
+
<span className="text-ink">Export .py</span> (in the toolbar's ⋯
|
| 334 |
+
menu) to keep iterating in your own Jupyter / slurm setup, or
|
| 335 |
+
tweak parameters and re-run to compare.
|
| 336 |
</span>
|
| 337 |
</div>
|
| 338 |
</div>
|