Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(desktop): make the work-panel header buttons one group
ZeroY87c04e01de8f
diff --git a/apps/desktop/src/styles/tokens.css b/apps/desktop/src/styles/tokens.cssindex 39814b7d2..e3241e727 100644--- a/apps/desktop/src/styles/tokens.css+++ b/apps/desktop/src/styles/tokens.css@@ -163,7 +163,12 @@cannot drift away from the viewport-fixed toggle. */--ds-work-panel-toggle-size: 28px;--ds-work-panel-toggle-inset: 12px;- --ds-work-panel-toggle-gap: 20px;+ /* The one gap between adjacent controls in the panel header row: the tab+ strip to the action group, between `+` and maximize, and — through the+ lane reserve that spends this token — between that group and the+ viewport-fixed collapse toggle. One value keeps the three buttons reading+ as one group instead of a rail behind its own divider. */+ --ds-work-panel-control-gap: 4px;/* Preview-mode shell actions are two chrome controls (the same 28px square asthe toggle beside them) with a 4px gap and an additional 8px buffer beforethe panel's first tab. Derived from the control it reserves room for, so thediff --git a/apps/desktop/src/styles/work-panel.css b/apps/desktop/src/styles/work-panel.cssindex ed6c11feb..2f48ee3ae 100644--- a/apps/desktop/src/styles/work-panel.css+++ b/apps/desktop/src/styles/work-panel.css@@ -126,14 +126,16 @@height: var(--ds-toolbar-height);flex: 0 0 auto;align-items: center;- gap: 4px;+ gap: var(--ds-work-panel-control-gap);background: var(--ds-bg-dock-raised);- /* Keep the fixed work-panel toggle in its own hit-target lane. The reserve- is shared with the toggle's size/inset tokens and leaves a real gap. */+ /* Keep the fixed work-panel toggle in its own hit-target lane. The reserve is+ spent from the toggle's size/inset tokens plus the header's own control+ gap, so the last panel control ends exactly one button gap before the+ toggle instead of behind a divider. */padding: 0calc(var(--ds-work-panel-toggle-size) + var(--ds-work-panel-toggle-inset) +- var(--ds-work-panel-toggle-gap)+ var(--ds-work-panel-control-gap))0 12px;-webkit-app-region: drag;@@ -270,14 +272,14 @@color: var(--ds-text-primary);}+/* One button group with the viewport-fixed collapse toggle: the same control+ gap the header reserves for it, and no divider, inset, or margin of its own.+ The rule owns spacing only — the controls keep their own sizes and seats. */.work-panel-actions {display: flex;flex: 0 0 auto;align-items: center;- gap: 4px;- margin-right: 8px;- padding-right: 8px;- border-right: 1px solid var(--ds-border-subtle);+ gap: var(--ds-work-panel-control-gap);}.work-panel-subagent-back {diff --git a/apps/desktop/test/work-panel.test.mjs b/apps/desktop/test/work-panel.test.mjsindex 755be4487..f63eabd25 100644--- a/apps/desktop/test/work-panel.test.mjs+++ b/apps/desktop/test/work-panel.test.mjs@@ -69,15 +69,38 @@ test("a viewport-fixed toggle is the sole pointer collapse control", () => {);assert.match(globalStyles,- /--ds-work-panel-toggle-gap:\s*20px/,+ /--ds-work-panel-control-gap:\s*4px/,);+ // One gap for the whole header row: the same token spaces the strip-to-actions+ // gap, the `+`/maximize pair, and the reserve that ends the content one gap+ // before the viewport-fixed toggle.+ assert.doesNotMatch(globalStyles, /--ds-work-panel-toggle-gap/);assert.match(globalStyles,- /\.work-panel-header \{[^}]*padding:\s*0\s+calc\([\s\S]*?var\(--ds-work-panel-toggle-size\)[\s\S]*?var\(--ds-work-panel-toggle-inset\)[\s\S]*?var\(--ds-work-panel-toggle-gap\)[\s\S]*?\)\s+0 12px;/s,+ /\.work-panel-header \{[^}]*gap:\s*var\(--ds-work-panel-control-gap\);/s,);assert.match(globalStyles,- /\.work-panel-actions \{[^}]*margin-right:\s*8px;[^}]*padding-right:\s*8px;[^}]*border-right:\s*1px solid var\(--ds-border-subtle\);/s,+ /\.work-panel-header \{[^}]*padding:\s*0\s+calc\([\s\S]*?var\(--ds-work-panel-toggle-size\)[\s\S]*?var\(--ds-work-panel-toggle-inset\)[\s\S]*?var\(--ds-work-panel-control-gap\)[\s\S]*?\)\s+0 12px;/s,+ );+ // The action group states spacing only: the divider, inset, and margin that+ // used to set the three panel buttons apart are gone, so they read as one+ // group with the fixed collapse toggle at the shared control gap.+ assert.match(+ globalStyles,+ /\.work-panel-actions \{[^}]*gap:\s*var\(--ds-work-panel-control-gap\);/s,+ );+ assert.doesNotMatch(+ globalStyles,+ /\.work-panel-actions \{[^}]*margin-right:/s,+ );+ assert.doesNotMatch(+ globalStyles,+ /\.work-panel-actions \{[^}]*padding-right:/s,+ );+ assert.doesNotMatch(+ globalStyles,+ /\.work-panel-actions \{[^}]*border-right:/s,);assert.match(globalStyles,diff --git a/scripts/e2e-three-column-layout.mjs b/scripts/e2e-three-column-layout.mjsindex 867c6bf9e..e92558b6e 100644--- a/scripts/e2e-three-column-layout.mjs+++ b/scripts/e2e-three-column-layout.mjs@@ -494,6 +494,42 @@ async function main() {() => cdp.evaluate(`!!document.querySelector(".work-panel-tab")`),"work panel tab mounted before preview mode",);+ // The panel's `+`, maximize, and the viewport-fixed collapse toggle are one+ // button group. Only the rendered box proves it: a stylesheet contract+ // cannot catch a rule that re-states its own inset or divider.+ const panelActionGroup = await cdp.evaluate(`(() => {+ const actions = document.querySelector(".work-panel-actions");+ const maximize = document.querySelector(".work-panel-maximize");+ const toggle = document.querySelector(".app-work-panel-toggle");+ if (!actions || !maximize || !toggle) return null;+ const actionsStyle = getComputedStyle(actions);+ return {+ tokenGap: parseFloat(+ getComputedStyle(document.documentElement).getPropertyValue(+ "--ds-work-panel-control-gap",+ ),+ ),+ groupGap: parseFloat(actionsStyle.rowGap),+ gapToToggle: Math.round(+ toggle.getBoundingClientRect().left - maximize.getBoundingClientRect().right,+ ),+ borderRight: parseFloat(actionsStyle.borderRightWidth),+ paddingRight: parseFloat(actionsStyle.paddingRight),+ marginRight: parseFloat(actionsStyle.marginRight),+ };+ })()`);+ check(+ panelActionGroup !== null &&+ Number.isFinite(panelActionGroup.tokenGap) &&+ panelActionGroup.tokenGap > 0 &&+ panelActionGroup.groupGap === panelActionGroup.tokenGap &&+ Math.abs(panelActionGroup.gapToToggle - panelActionGroup.tokenGap) <= 1 &&+ panelActionGroup.borderRight === 0 &&+ panelActionGroup.paddingRight === 0 &&+ panelActionGroup.marginRight === 0,+ "the panel actions and the fixed collapse toggle share one control gap",+ JSON.stringify(panelActionGroup),+ );const beforeMaximize = await measure();await cdp.evaluate(`document.querySelector(".work-panel-maximize")?.dispatchEvent(new MouseEvent("click", { bubbles: true }))`,