From 0d986491a91809ec75759da6e826b20f4f71f0f6 Mon Sep 17 00:00:00 2001 From: LHaghfoss Date: Tue, 24 Nov 2026 14:40:26 +0100 Subject: [PATCH 1/2] feat(desktop): fold Settings details and glide the section highlight --- apps/desktop/src/design.test.ts | 2 +- apps/desktop/src/ui/Capabilities.tsx | 15 ++-- apps/desktop/src/ui/Fold.tsx | 58 +++++++++++++ apps/desktop/src/ui/Harnesses.tsx | 5 +- apps/desktop/src/ui/Settings.tsx | 43 ++-------- apps/desktop/src/ui/SettingsSectionList.tsx | 95 +++++++++++++++++++++ apps/desktop/src/ui/Sidebar.tsx | 37 +------- apps/desktop/src/ui/settingsKit.tsx | 7 +- docs/design.md | 3 +- scripts/comment-baseline.txt | 2 +- 10 files changed, 183 insertions(+), 84 deletions(-) create mode 100644 apps/desktop/src/ui/Fold.tsx create mode 100644 apps/desktop/src/ui/SettingsSectionList.tsx diff --git a/apps/desktop/src/design.test.ts b/apps/desktop/src/design.test.ts index 959a89cb5..c5f19d3ea 100644 --- a/apps/desktop/src/design.test.ts +++ b/apps/desktop/src/design.test.ts @@ -74,7 +74,7 @@ const PILL_ALLOWED: [file: string, part: string, why: string][] = [ "a glyph in the machine icon picker; its fill marks the one chosen", ], ["ui/ShortcutSettings.tsx", "recording ?", "the keycap button; its fill marks recording"], - ["ui/Settings.tsx", "aria-current={s.id === section", "a settings section row"], + ["ui/SettingsSectionList.tsx", "aria-current={current", "a settings section row"], ]; /** diff --git a/apps/desktop/src/ui/Capabilities.tsx b/apps/desktop/src/ui/Capabilities.tsx index 8c29e6da9..1c570cbfb 100644 --- a/apps/desktop/src/ui/Capabilities.tsx +++ b/apps/desktop/src/ui/Capabilities.tsx @@ -17,6 +17,7 @@ import { failureSummary, mcpCopy, runOnMachines, secretTargetReason } from "../s import { machineRequest, useLoadScopeSettings, useScope } from "../state/settingsScope"; import { askConfirm, errorText, toast, useApp } from "../state/store"; import { createSkillWithAgent } from "../state/threadOpen"; +import { Fold } from "./Fold"; import { ChevronRight, Copy, Ellipsis, FolderOpen, Pencil, RefreshCw, Search } from "./icons"; import { cardInset, cx, MenuContent, menuItem, noTextHelpers, Spinner, Switch, Tooltip } from "./primitives"; import { SettingsScopeBar } from "./SettingsScope"; @@ -461,7 +462,9 @@ function McpSection({ } footer={data.configPath ? `Saved in ${data.configPath}` : undefined} > - {adding && setAdding(false)} />} + + setAdding(false)} /> + {shown.length === 0 && !adding && ( - {open && ( -
+ +
Command
@@ -728,7 +731,7 @@ function McpRow({ )}
- )} +
); } @@ -844,7 +847,9 @@ function SkillsSection({ } /> - {creating && setCreating(false)} />} + + setCreating(false)} /> + {groups.length === 0 && ( diff --git a/apps/desktop/src/ui/Fold.tsx b/apps/desktop/src/ui/Fold.tsx new file mode 100644 index 000000000..528767da9 --- /dev/null +++ b/apps/desktop/src/ui/Fold.tsx @@ -0,0 +1,58 @@ +import { type ReactNode, useEffect, useState } from "react"; +import { cx } from "./primitives"; + +/** + * Rows that unfold with a height transition and fold back before they unmount. Folded rows are + * not rendered at all, so a long list costs nothing until opened. Opening waits two frames, so + * the folded state is painted before the unfold starts; the clip lifts, and a closed fold + * unmounts, when its height transition ends. An open fold is not clipped, so a dragged row can + * travel past its last row. + */ +/** When a fold settles even if no `transitionend` arrives (a hidden parent, a toggle mid-frame). */ +const FOLD_SETTLE_MS = 400; + +export function Fold({ + open, + children, + className, +}: { + open: boolean; + children: ReactNode; + className?: string; +}) { + const [mounted, setMounted] = useState(open); + const [shown, setShown] = useState(open); + const [still, setStill] = useState(open); + useEffect(() => { + if (open) { + setMounted(true); + let frame = requestAnimationFrame(() => { + frame = requestAnimationFrame(() => setShown(true)); + }); + const settle = setTimeout(() => setStill(true), FOLD_SETTLE_MS); + return () => { + cancelAnimationFrame(frame); + clearTimeout(settle); + }; + } + setStill(false); + setShown(false); + const settle = setTimeout(() => setMounted(false), FOLD_SETTLE_MS); + return () => clearTimeout(settle); + }, [open]); + if (!mounted) return null; + return ( +
{ + if (e.target !== e.currentTarget || e.propertyName !== "grid-template-rows") return; + if (open) setStill(true); + else setMounted(false); + }} + > +
{children}
+
+ ); +} diff --git a/apps/desktop/src/ui/Harnesses.tsx b/apps/desktop/src/ui/Harnesses.tsx index ba88d3876..a2375f1c5 100644 --- a/apps/desktop/src/ui/Harnesses.tsx +++ b/apps/desktop/src/ui/Harnesses.tsx @@ -56,6 +56,7 @@ import { useApp, } from "../state/store"; import { HarnessCommandFields } from "./AddHarness"; +import { Fold } from "./Fold"; import { HarnessIcon } from "./HarnessIcon"; import { Check, ChevronRight, Minus, Plus, RefreshCw, X } from "./icons"; import { CopyButton } from "./Markdown"; @@ -581,7 +582,7 @@ export function HarnessCard({ harness }: { harness: Harness }) { detail={result ? result.text : harness.error} /> )} - {open && ( +
{hasAccounts && }
@@ -642,7 +643,7 @@ export function HarnessCard({ harness }: { harness: Harness }) { )}
- )} +
); } diff --git a/apps/desktop/src/ui/Settings.tsx b/apps/desktop/src/ui/Settings.tsx index 9ac515735..779f98aa2 100644 --- a/apps/desktop/src/ui/Settings.tsx +++ b/apps/desktop/src/ui/Settings.tsx @@ -120,6 +120,7 @@ const StatisticsPage = lazy(() => import("./StatisticsPage").then((m) => ({ defa import { refreshServerService, useMachines } from "../state/machines"; import { useSettingsAttention } from "../state/settingsAttention"; +import { type SettingsNavPage, SettingsSectionList } from "./SettingsSectionList"; import { type SettingEntry, searchSettings } from "./settingsIndex"; import { Action, @@ -141,11 +142,7 @@ import { const UsagePage = lazy(() => import("./UsagePage").then((m) => ({ default: m.UsagePage }))); -interface Page { - id: SettingsSection; - label: string; - icon: typeof Gear; -} +type Page = SettingsNavPage; /** * The nav, top to bottom: pages, then groups of pages under a heading. One @@ -1044,36 +1041,12 @@ export function SettingsNav() {

Nothing matches “{query.trim()}”.

) ) : ( - NAV.map((group) => ( -
- {group.heading && ( -
{group.heading}
- )} - {group.pages.map((s) => ( - - ))} -
- )) + openSettings(id)} + /> )} diff --git a/apps/desktop/src/ui/SettingsSectionList.tsx b/apps/desktop/src/ui/SettingsSectionList.tsx new file mode 100644 index 000000000..e1d75dd21 --- /dev/null +++ b/apps/desktop/src/ui/SettingsSectionList.tsx @@ -0,0 +1,95 @@ +import { type ComponentType, useLayoutEffect, useRef, useState } from "react"; +import type { SettingsSection } from "../state/appState"; +import { cx } from "./primitives"; + +export interface SettingsNavPage { + id: SettingsSection; + label: string; + icon: ComponentType<{ size?: number; strokeWidth?: number; className?: string }>; +} + +export interface SettingsNavGroup { + heading?: string; + pages: SettingsNavPage[]; +} + +interface Highlight { + top: number; + height: number; + ready: boolean; +} + +/** + * The Settings pages, grouped under their headings. The open page's fill is one shared pill that + * glides to the page picked next (200ms `--ease-snappy`, transform only), so the eye follows the + * move instead of seeing one row go dark and another light up. + */ +export function SettingsSectionList({ + groups, + section, + attention, + onOpen, +}: { + groups: SettingsNavGroup[]; + section: SettingsSection; + attention: Partial>; + onOpen: (id: SettingsSection) => void; +}) { + const list = useRef(null); + const [highlight, setHighlight] = useState(null); + useLayoutEffect(() => { + const row = list.current?.querySelector(`[data-section="${section}"]`); + if (!row) return setHighlight(null); + setHighlight((prev) => ({ top: row.offsetTop, height: row.offsetHeight, ready: prev !== null })); + }, [section]); + return ( +
+ {highlight && ( + + )} + {groups.map((group) => ( +
+ {group.heading && ( +
{group.heading}
+ )} + {group.pages.map((s) => { + const current = s.id === section; + return ( + + ); + })} +
+ ))} +
+ ); +} diff --git a/apps/desktop/src/ui/Sidebar.tsx b/apps/desktop/src/ui/Sidebar.tsx index 6c72ec2d0..2e91d20d9 100644 --- a/apps/desktop/src/ui/Sidebar.tsx +++ b/apps/desktop/src/ui/Sidebar.tsx @@ -107,6 +107,7 @@ import { } from "../state/topLevel"; import { useWaitingIds } from "../state/waiting"; import { CustomSnooze } from "./CustomSnooze"; +import { Fold } from "./Fold"; import { FOLDER_DROP_ATTR, overFolderDrop } from "./folderDropTarget"; import { NeedsYouRow } from "./Inbox"; import { ChevronDown, ChevronRight, CornerDownRight, FolderPlus, PanelLeft, Search } from "./icons"; @@ -162,42 +163,6 @@ interface Section { projects?: ProjectGroup[]; } -/** - * A section's rows, unfolding with a height transition. Folded rows are not - * rendered at all, so a long Settled section costs nothing until opened. - */ -function Fold({ open, children }: { open: boolean; children: React.ReactNode }) { - const [mounted, setMounted] = useState(open); - const [shown, setShown] = useState(open); - // Open and done unfolding. - const [still, setStill] = useState(open); - useEffect(() => { - if (open) { - setMounted(true); - const frame = requestAnimationFrame(() => setShown(true)); - const t = setTimeout(() => setStill(true), 220); - return () => { - cancelAnimationFrame(frame); - clearTimeout(t); - }; - } - setStill(false); - setShown(false); - const t = setTimeout(() => setMounted(false), 200); - return () => clearTimeout(t); - }, [open]); - if (!mounted) return null; - return ( -
- {/* Clipped only while it folds: an open section lets a dragged row travel past its last row. */} -
{children}
-
- ); -} - /** * The open delegated thread as an indented row directly under the row of the thread that started * it, and the chain of delegates under it. It unfolds in with the list's fold motion and folds diff --git a/apps/desktop/src/ui/settingsKit.tsx b/apps/desktop/src/ui/settingsKit.tsx index 80a6b79db..b46dccbd3 100644 --- a/apps/desktop/src/ui/settingsKit.tsx +++ b/apps/desktop/src/ui/settingsKit.tsx @@ -48,6 +48,7 @@ import { sameValue, } from "../state/pageCache"; import { connectionFor, request, useApp } from "../state/store"; +import { Fold } from "./Fold"; import { Check, ChevronDown, Info, RotateCcw } from "./icons"; import { cx, menuItem, Pill, rowInset, Segments, Skeleton, Switch, Tooltip } from "./primitives"; @@ -157,7 +158,7 @@ export function Group({ ) } /> - {!folded && ( +
{children}
- )} - {footer && !folded &&
{footer}
} + {footer &&
{footer}
} +
); } diff --git a/docs/design.md b/docs/design.md index d46ef64f5..b130aee7e 100644 --- a/docs/design.md +++ b/docs/design.md @@ -449,7 +449,8 @@ that change use `tabular`. - Opening: popovers, menus, tooltips 160ms `--ease-snappy` (fade + 4px); closing 120ms `ease-in`. Dialogs 180ms. - Nothing animates layout on hover. Height transitions only for folding - sections, and for the composer's field, which grows and shrinks with its + sections (`ui/Fold.tsx`: the sidebar's sections, a Settings row's details, + an inline add form, a card a feature switch turns on), and for the composer's field, which grows and shrinks with its lines over 150ms `--ease-snappy` instead of jumping between them; the transcript stays pinned to its end as the card rises, so the last line never goes under it mid-animation. diff --git a/scripts/comment-baseline.txt b/scripts/comment-baseline.txt index 998677fe0..3a11d5fef 100644 --- a/scripts/comment-baseline.txt +++ b/scripts/comment-baseline.txt @@ -561,7 +561,7 @@ 6 apps/desktop/src/ui/SettingsOrchestration.tsx 7 apps/desktop/src/ui/SettingsScope.tsx 13 apps/desktop/src/ui/ShortcutSettings.tsx -180 apps/desktop/src/ui/Sidebar.tsx +178 apps/desktop/src/ui/Sidebar.tsx 2 apps/desktop/src/ui/SidebarDensitySetting.tsx 55 apps/desktop/src/ui/SidebarThreadRow.tsx 2 apps/desktop/src/ui/SidebarToolbar.tsx From 297cb713669896c95b7d9ec571368d3697938579 Mon Sep 17 00:00:00 2001 From: LHaghfoss Date: Tue, 24 Nov 2026 15:10:47 +0100 Subject: [PATCH 2/2] fix(desktop): clip folds while they move and align the settings nav pill --- apps/desktop/src/index.css | 5 ++ apps/desktop/src/ui/Fold.tsx | 5 +- apps/desktop/src/ui/Settings.tsx | 60 +++++++++++---------- apps/desktop/src/ui/SettingsSectionList.tsx | 6 +-- 4 files changed, 43 insertions(+), 33 deletions(-) diff --git a/apps/desktop/src/index.css b/apps/desktop/src/index.css index 08556f6a1..696ef0619 100644 --- a/apps/desktop/src/index.css +++ b/apps/desktop/src/index.css @@ -466,6 +466,11 @@ } /* Centered lanes (Settings) reserve equal gutter on both sides so floating headers stay aligned. */ +@utility gutter-stable { + overflow-y: hidden; + scrollbar-gutter: stable; +} + @utility scroll-stable-both { overflow-y: auto; scrollbar-gutter: stable both-edges; diff --git a/apps/desktop/src/ui/Fold.tsx b/apps/desktop/src/ui/Fold.tsx index 528767da9..86d8b685b 100644 --- a/apps/desktop/src/ui/Fold.tsx +++ b/apps/desktop/src/ui/Fold.tsx @@ -44,7 +44,10 @@ export function Fold({ return (
{ if (e.target !== e.currentTarget || e.propertyName !== "grid-template-rows") return; diff --git a/apps/desktop/src/ui/Settings.tsx b/apps/desktop/src/ui/Settings.tsx index 779f98aa2..ba78cbfcd 100644 --- a/apps/desktop/src/ui/Settings.tsx +++ b/apps/desktop/src/ui/Settings.tsx @@ -967,36 +967,38 @@ export function SettingsNav() { data-focus-area="sections" className="rc-in flex h-full min-h-0 flex-col gap-3 px-3 pb-3 outline-none" > -
- - { - setQuery(e.target.value); - setActive(0); - }} - onKeyDown={onFieldKey} - placeholder="Search settings" - aria-label="Search settings" - {...noTextHelpers} - className="min-w-0 flex-1 bg-transparent font-medium text-fg outline-none placeholder:text-fg-muted" - /> - {query ? ( - - ) : ( - / - )} + onKeyDown={onFieldKey} + placeholder="Search settings" + aria-label="Search settings" + {...noTextHelpers} + className="min-w-0 flex-1 bg-transparent font-medium text-fg outline-none placeholder:text-fg-muted" + /> + {query ? ( + + ) : ( + / + )} +
{query.trim() ? ( diff --git a/apps/desktop/src/ui/SettingsSectionList.tsx b/apps/desktop/src/ui/SettingsSectionList.tsx index e1d75dd21..9b3f0dd29 100644 --- a/apps/desktop/src/ui/SettingsSectionList.tsx +++ b/apps/desktop/src/ui/SettingsSectionList.tsx @@ -49,7 +49,7 @@ export function SettingsSectionList({ aria-hidden data-testid="settings-nav-highlight" className={cx( - "pointer-events-none absolute inset-x-0 top-0 rounded-md bg-fill", + "pointer-events-none absolute inset-x-0 top-0 rounded-lg bg-fill", highlight.ready && "transition-transform duration-200 ease-snappy", )} style={{ height: highlight.height, transform: `translateY(${highlight.top}px)` }} @@ -71,8 +71,8 @@ export function SettingsSectionList({ aria-description={attention[s.id]} onClick={() => onOpen(s.id)} className={cx( - "relative flex h-8 items-center gap-2 rounded-md px-2 text-left font-medium text-body", - current ? "text-fg" : "text-fg-muted hover:bg-fill hover:text-fg", + "relative flex h-8 items-center gap-2 rounded-lg px-2 text-left font-medium text-body", + current ? "text-fg" : "text-fg-muted hover:bg-fill-subtle hover:text-fg", current && !highlight && "bg-fill", )} >