From f114bb237ed237e17decf368b880789466512c55 Mon Sep 17 00:00:00 2001 From: LHaghfoss Date: Sun, 22 Nov 2026 20:27:06 +0100 Subject: [PATCH 1/7] feat(desktop): t3-style thread header and a tighter radius scale The thread title is a breadcrumb crumb that opens the thread's menu, the side panel toggle is a quiet button naming its tab, and the default radius scale drops to 4/6/8/10/12/16/20 with labelled buttons, selects and segmented controls as rounded rectangles. The composer keeps its corner. --- apps/desktop/src/design.test.ts | 1 + apps/desktop/src/index.css | 22 +++---- apps/desktop/src/ui/ChatView.tsx | 57 ++++++++++-------- apps/desktop/src/ui/Settings.tsx | 2 +- apps/desktop/src/ui/SettingsScope.tsx | 6 +- apps/desktop/src/ui/SidebarThreadRow.tsx | 2 +- apps/desktop/src/ui/ThreadTitle.tsx | 73 ++++++++++++++++++++++++ apps/desktop/src/ui/primitives.tsx | 14 ++--- apps/desktop/src/ui/settingsKit.tsx | 24 ++++---- docs/design.md | 46 ++++++++------- docs/desktop.md | 5 +- 11 files changed, 172 insertions(+), 80 deletions(-) create mode 100644 apps/desktop/src/ui/ThreadTitle.tsx diff --git a/apps/desktop/src/design.test.ts b/apps/desktop/src/design.test.ts index 8776f8b01..5168b5ec5 100644 --- a/apps/desktop/src/design.test.ts +++ b/apps/desktop/src/design.test.ts @@ -43,6 +43,7 @@ const SHAPED = /(? = { + details: "Details", + changes: "Changes", + pulls: "Pull requests", + peek: "Thread", +}; + function DetailsHeaderButton() { - const on = useApp((s) => !!s.panel); + const panel = useApp((s) => s.panel); + const remembered = useApp((s) => (s.selectedId ? s.panelByThread[s.selectedId] : undefined)); const key = useShortcutHint("toggle-panel"); + const label = PANEL_LABELS[panel ?? remembered ?? "details"]; return ( - - - + + + ); } @@ -256,7 +265,7 @@ function Header({ / )} -

{title}

+ {thread && machine && ( void runAllHarnessChecks()} disabled={checking} - className="inline-flex size-6 items-center justify-center rounded-full text-fg-muted enabled:hover:bg-fill enabled:hover:text-fg disabled:opacity-60" + className="inline-flex size-6 items-center justify-center rounded-sm text-fg-muted enabled:hover:bg-fill enabled:hover:text-fg disabled:opacity-60" > {checking ? : } diff --git a/apps/desktop/src/ui/SettingsScope.tsx b/apps/desktop/src/ui/SettingsScope.tsx index 73b6ce989..e8bfec490 100644 --- a/apps/desktop/src/ui/SettingsScope.tsx +++ b/apps/desktop/src/ui/SettingsScope.tsx @@ -61,7 +61,7 @@ export function SettingsScopeBar({ machineOnly = false }: { machineOnly?: boolea ...(machineOnly ? [] : [{ value: ALL, label: "All machines" }]), ]; return ( -
+
@@ -134,7 +134,7 @@ export function MixedChip({ breakdown }: { breakdown: ScopeBreakdownEntry[] }) { } > - + Mixed @@ -163,7 +163,7 @@ export function SourceChip({ project }: { project: ProjectRowState }) { } > diff --git a/apps/desktop/src/ui/SidebarThreadRow.tsx b/apps/desktop/src/ui/SidebarThreadRow.tsx index 76df1817d..78a85dd35 100644 --- a/apps/desktop/src/ui/SidebarThreadRow.tsx +++ b/apps/desktop/src/ui/SidebarThreadRow.tsx @@ -132,7 +132,7 @@ import { ThreadQuickActions } from "./ThreadQuickActions"; // One thread row of the sidebar (ThreadRow, PendingRow), its state label and its // context menu (ThreadMenuItems), split out of Sidebar.tsx, which lays the rows out. -function ThreadMenuItems({ +export function ThreadMenuItems({ session, Menu, Item, diff --git a/apps/desktop/src/ui/ThreadTitle.tsx b/apps/desktop/src/ui/ThreadTitle.tsx new file mode 100644 index 000000000..be7144b6f --- /dev/null +++ b/apps/desktop/src/ui/ThreadTitle.tsx @@ -0,0 +1,73 @@ +// The chat header's thread title: the last crumb after the project. It opens the thread's menu +// (the sidebar row's own, ui/SidebarThreadRow.tsx), with a chevron that shows on hover, and its +// Rename edits the title in place. + +import { DropdownMenu } from "radix-ui"; +import { useState } from "react"; +import { useApp } from "../state/store"; +import type { ThreadState } from "../state/thread"; +import { renameThread } from "../state/threadActions"; +import { ChevronDown } from "./icons"; +import { MenuContent } from "./primitives"; +import { ThreadMenuItems } from "./SidebarThreadRow"; + +export function ThreadTitle({ thread, title }: { thread?: ThreadState; title: string }) { + const session = useApp((s) => (thread ? s.sessions.find((x) => x.id === thread.id) : undefined)); + const [renaming, setRenaming] = useState(false); + const [draft, setDraft] = useState(""); + if (!session) return

{title}

; + const startRename = () => { + setDraft(session.title ?? title); + // After the menu closes and gives focus back. + setTimeout(() => setRenaming(true), 0); + }; + const commit = () => { + setRenaming(false); + const next = draft.trim(); + if (next && next !== session.title) void renameThread(session.id, next, { user: true }); + }; + if (renaming) { + return ( + e.currentTarget.select()} + onChange={(e) => setDraft(e.target.value)} + onBlur={commit} + onKeyDown={(e) => { + if (e.key === "Enter") commit(); + if (e.key === "Escape") setRenaming(false); + }} + className="-mx-1 h-6 min-w-0 max-w-[480px] flex-1 rounded-sm bg-fill px-1 font-medium text-body text-fg outline-none" + /> + ); + } + return ( + + + + + + + + + ); +} diff --git a/apps/desktop/src/ui/primitives.tsx b/apps/desktop/src/ui/primitives.tsx index 727b7b187..b26b5567a 100644 --- a/apps/desktop/src/ui/primitives.tsx +++ b/apps/desktop/src/ui/primitives.tsx @@ -133,7 +133,7 @@ export const ChromeButton = forwardRef(function /** A capsule that groups icon buttons, as the toolbar does. */ export function Cluster({ children, className }: { children: ReactNode; className?: string }) { return ( -
+
{children}
); @@ -149,7 +149,7 @@ export const ClusterButton = forwardRef({ {...{ role: tabs ? "tablist" : "radiogroup", "aria-label": label }} className={cx( "relative", - tabs ? "gap-1" : "rounded-full bg-fill p-[2px]", + tabs ? "gap-1" : "rounded-md bg-fill p-[2px]", fill ? "flex w-full" : "inline-flex w-fit", )} > @@ -651,7 +651,7 @@ export function Segments({ aria-hidden className={cx( "absolute top-0 left-0 transition-[transform,width] duration-200 ease-snappy", - tabs ? "h-7 rounded-lg bg-fill" : "h-5 rounded-full bg-knob shadow-knob", + tabs ? "h-7 rounded-md bg-fill" : "h-5 rounded-sm bg-knob shadow-knob", )} style={{ transform: `translate(${thumb.left}px, ${tabs ? 0 : 2}px)`, width: thumb.width }} /> @@ -672,7 +672,7 @@ export function Segments({ onBlur={intent.cancel} className={cx( "relative whitespace-nowrap font-medium disabled:opacity-40", - tabs ? "h-7 rounded-lg px-3 text-callout" : "h-5 rounded-full px-2 text-caption", + tabs ? "h-7 rounded-md px-3 text-callout" : "h-5 rounded-sm px-2 text-caption", fill && "min-w-0 flex-1", o.value === value ? selected : "text-fg-muted hover:text-fg", )} diff --git a/apps/desktop/src/ui/settingsKit.tsx b/apps/desktop/src/ui/settingsKit.tsx index e71fed50a..632d96b2a 100644 --- a/apps/desktop/src/ui/settingsKit.tsx +++ b/apps/desktop/src/ui/settingsKit.tsx @@ -3,14 +3,14 @@ // controls a row holds, and engine data loaded once the engine is ready. // // A page is a column of sections. A section is its name in `fg`, then one -// card: `rounded-xl` on a step of the page's own fill (`bg-surface`), its rows +// card: `rounded-xl` on a step of the page's own fill (`bg-surface`) with a hairline edge, its rows // divided by a hairline. A row is a title, a description, an optional // status line and a control at the right; its own container query stacks the // control under the text when the window is narrow, whatever the nav takes. A // row whose value differs from its default shows a reset button before the // control, on hover or keyboard focus. // -// The controls are one shape — 32px high, `rounded-lg`, a step of their own +// The controls are one shape — 28px high, `rounded-md`, a step of their own // over the card — so a row of buttons, selects and choices reads as one // family, not as pills. // @@ -161,7 +161,7 @@ export function Group({
@@ -361,14 +361,14 @@ export function Row({ // ---------------------------------------------------------------- controls /** - * The field shape a row's control takes: 28px high, `rounded-lg` and a step of + * The field shape a row's control takes: 28px high, `rounded-md` and a step of * its own over the card, so it reads as a control and not as a block. */ /** A switch setting's value as a row reads it. */ export const boolLabel = (value: Json | undefined) => (value ? "On" : "Off"); export const fieldClass = - "h-7 rounded-lg bg-fill px-3 text-callout text-fg placeholder:text-fg-faint hover:bg-fill-strong focus:bg-fill-strong"; + "h-7 rounded-md bg-fill px-3 text-callout text-fg placeholder:text-fg-faint hover:bg-fill-strong focus:bg-fill-strong"; /** * A labelled action in a row: the quiet default (a translucent fill over the @@ -393,7 +393,7 @@ export function Action({ diff --git a/apps/desktop/src/ui/SettingsScope.tsx b/apps/desktop/src/ui/SettingsScope.tsx index e8bfec490..0ce8b8327 100644 --- a/apps/desktop/src/ui/SettingsScope.tsx +++ b/apps/desktop/src/ui/SettingsScope.tsx @@ -134,7 +134,7 @@ export function MixedChip({ breakdown }: { breakdown: ScopeBreakdownEntry[] }) { } > - + Mixed @@ -163,7 +163,7 @@ export function SourceChip({ project }: { project: ProjectRowState }) { } > diff --git a/apps/desktop/src/ui/primitives.tsx b/apps/desktop/src/ui/primitives.tsx index b26b5567a..49a33499e 100644 --- a/apps/desktop/src/ui/primitives.tsx +++ b/apps/desktop/src/ui/primitives.tsx @@ -133,7 +133,7 @@ export const ChromeButton = forwardRef(function /** A capsule that groups icon buttons, as the toolbar does. */ export function Cluster({ children, className }: { children: ReactNode; className?: string }) { return ( -
+
{children}
); @@ -149,7 +149,7 @@ export const ClusterButton = forwardRef({ {...{ role: tabs ? "tablist" : "radiogroup", "aria-label": label }} className={cx( "relative", - tabs ? "gap-1" : "rounded-md bg-fill p-[2px]", + tabs ? "gap-1" : "rounded-full bg-fill p-[2px]", fill ? "flex w-full" : "inline-flex w-fit", )} > @@ -651,7 +651,7 @@ export function Segments({ aria-hidden className={cx( "absolute top-0 left-0 transition-[transform,width] duration-200 ease-snappy", - tabs ? "h-7 rounded-md bg-fill" : "h-5 rounded-sm bg-knob shadow-knob", + tabs ? "h-7 rounded-md bg-fill" : "h-5 rounded-full bg-knob shadow-knob", )} style={{ transform: `translate(${thumb.left}px, ${tabs ? 0 : 2}px)`, width: thumb.width }} /> @@ -672,7 +672,7 @@ export function Segments({ onBlur={intent.cancel} className={cx( "relative whitespace-nowrap font-medium disabled:opacity-40", - tabs ? "h-7 rounded-md px-3 text-callout" : "h-5 rounded-sm px-2 text-caption", + tabs ? "h-7 rounded-md px-3 text-callout" : "h-5 rounded-full px-2 text-caption", fill && "min-w-0 flex-1", o.value === value ? selected : "text-fg-muted hover:text-fg", )} diff --git a/apps/desktop/src/ui/settingsKit.tsx b/apps/desktop/src/ui/settingsKit.tsx index 632d96b2a..4f432ab4e 100644 --- a/apps/desktop/src/ui/settingsKit.tsx +++ b/apps/desktop/src/ui/settingsKit.tsx @@ -10,9 +10,9 @@ // row whose value differs from its default shows a reset button before the // control, on hover or keyboard focus. // -// The controls are one shape — 28px high, `rounded-md`, a step of their own +// The controls are one height — 28px, a step of their own // over the card — so a row of buttons, selects and choices reads as one -// family, not as pills. +// family: fields and selects are rounded rectangles, buttons and choices pills. // // Groups and rows carry `data-setting` with their title, so the panel's search // can scroll to the row it found (Settings.tsx) and light it once. @@ -393,7 +393,7 @@ export function Action({ ); diff --git a/apps/desktop/src/ui/RightPanel.tsx b/apps/desktop/src/ui/RightPanel.tsx index e31dc1f30..9bb996fc8 100644 --- a/apps/desktop/src/ui/RightPanel.tsx +++ b/apps/desktop/src/ui/RightPanel.tsx @@ -436,8 +436,8 @@ export function RightPanel() { }} className={cx( CARD_SURFACE, - // As tall as what it shows, up to the room the row gives it. - "self-start", + // The full height of the row, below the header: a floating sidebar, not a card that ends with its content. + "self-stretch", // Above the header's glass (`z-10`): the header spans the whole view and fades 24px past // its foot, which would otherwise wash over the card's top 12px. The card starts below // the header's band, so nothing of it covers the header's own controls. diff --git a/apps/desktop/src/ui/Settings.tsx b/apps/desktop/src/ui/Settings.tsx index 143b047da..0578bae71 100644 --- a/apps/desktop/src/ui/Settings.tsx +++ b/apps/desktop/src/ui/Settings.tsx @@ -1168,7 +1168,7 @@ function PanelHeader({ label }: { label: string }) { {save.pending ? "Saving…" : save.error ? `Could not save: ${save.error}` : save.saved ? "Saved" : ""} {resets.count > 0 && ( - resets.restore()}> + resets.restore()}> Restore defaults diff --git a/apps/desktop/src/ui/SettingsAppearance.tsx b/apps/desktop/src/ui/SettingsAppearance.tsx index 8e9f48382..25499fbfe 100644 --- a/apps/desktop/src/ui/SettingsAppearance.tsx +++ b/apps/desktop/src/ui/SettingsAppearance.tsx @@ -301,7 +301,7 @@ export function AppearancePage() { action={
{hasShell() && ( - revealPath(userDir)}> + revealPath(userDir)}> Open themes folder )} diff --git a/apps/desktop/src/ui/ThreadDetails.tsx b/apps/desktop/src/ui/ThreadDetails.tsx index 32b7072e6..70555ae6e 100644 --- a/apps/desktop/src/ui/ThreadDetails.tsx +++ b/apps/desktop/src/ui/ThreadDetails.tsx @@ -1,10 +1,11 @@ -// The side panel's Details tab, in titled sections: where the thread runs, its branch and -// uncommitted changes, lineage, a few plain stats (agent, messages, tool calls, cost, age) and -// context usage. +// The side panel's Details tab, Multica-style: foldable sections of label and value rows. The +// thread's properties (status, agent, model, account, machine, project, branch), its uncommitted +// changes, lineage, activity (messages, tool calls, tokens, cost, age) and context usage. // Changes and Pull requests are the panel's other tabs (ui/RightPanel.tsx). import { type ReactNode, useEffect, useMemo, useState } from "react"; -import { modelName } from "../acp/types"; +import { modelName, projectName } from "../acp/types"; +import { STATUS_LABEL } from "../acp/v2"; import { type GitChanges, gitChangeSummary, openPath } from "../lib/native"; import { appPlatform, fileManagerName } from "../lib/platform"; import { contextPercent } from "../state/details"; @@ -13,8 +14,10 @@ import { showPanel, useApp, worktreeOf } from "../state/store"; import { formatTokens, isRunning, type TranscriptItem } from "../state/thread"; import { relativeAge } from "../state/threadFormat"; import { splitThreadKey } from "../state/threadKeys"; +import { statusOf } from "../state/threadStatus"; import { DelegatePreview, delegateBranchCount } from "./DelegateTree"; -import { ChevronRight, FileDiff, FolderOpen, GitBranch, Laptop } from "./icons"; +import { HarnessIcon } from "./HarnessIcon"; +import { ChevronDown, ChevronRight, FileDiff, GitBranch, Laptop } from "./icons"; import { FOLDED_EVENT, isFolded as isFoldedOf, @@ -23,8 +26,10 @@ import { toggleFolded, writeFolded, } from "./overview"; +import { ProjectMark } from "./ProjectMark"; import { cx, Tooltip } from "./primitives"; import { DiffCount } from "./Rows"; +import { StatusIcon } from "./Status"; /** * The thread's working tree against HEAD, read once its turn ends, so a finished turn counts. Only @@ -74,6 +79,7 @@ export function ThreadDetails() { const harnessName = useApp((s) => harnessId ? (s.harnesses?.harnesses.find((h) => h.id === harnessId)?.name ?? harnessId) : undefined, ); + const status = useApp((s) => (s.selectedId ? statusOf(s, s.selectedId) : "idle")); const items = thread?.items; const counts = useMemo(() => threadCounts(items ?? []), [items]); const changes = useChanges(host ? undefined : thread?.cwd, isRunning(thread)); @@ -127,77 +133,109 @@ export function ThreadDetails() { const added = changes?.files.reduce((sum, f) => sum + f.added, 0) ?? 0; const removed = changes?.files.reduce((sum, f) => sum + f.removed, 0) ?? 0; - const row = "flex min-h-8 w-full items-center gap-2 rounded-lg px-3 text-left font-medium text-callout"; - const action = `${row} hover:bg-fill-subtle`; + const project = projectName(worktree?.repo || thread.cwd); + const machineLabel = + machine ?? (host ? "Paired computer" : appPlatform() === "mac" ? "This Mac" : "This computer"); const icon = "shrink-0 text-fg-muted"; + const activity = stats.filter(([label]) => label !== "Agent" && label !== "Account"); - // Titled sections, each a few 32px rows, a hairline between them: the layout T3 Code's thread - // details card uses, holding this panel's own facts. + // Multica-style sections: a title you can fold, then label and value rows, the label in a fixed + // column and the value beside it with its icon, so the eye runs down one edge. return ( -
-
-
- - - {machine ?? (host ? "Paired computer" : appPlatform() === "mac" ? "This Mac" : "This computer")} - -
- {!host && ( - +
+
+ + + {STATUS_LABEL[status]} + + {harnessId && ( + + + {harnessName} + + )} + {model && ( + + {model} + + )} + {account && ( + + {account} + + )} + + + {machineLabel} + + openPath(thread.cwd)} + tip={host ? undefined : `Open in ${fileManagerName(appPlatform())}`} + > + + {project} + + {branch && ( + + + {branch} + )}
- {branch && ( -
- -
- - - {branch} - -
-
- {changes && ( - - )} + {changes && ( +
+ + + } + > +
)} {delegates > 0 && ( -
-
- toggle("delegates")} - /> -
+
+ toggle("delegates")} + />
)} -
-
- {stats.map(([label, value]) => ( -
-
{label}
-
{value}
-
- ))} -
+
+ {activity.map(([label, value]) => ( + + {value} + + ))}
{usage && used !== undefined && ( -
-
+
+
-

{title}

+/** A label in the fixed left column and its value beside it; a value that acts gets a hover fill. */ +function Property({ + label, + children, + onClick, + tip, +}: { + label: string; + children: ReactNode; + onClick?: () => void; + tip?: string; +}) { + const value = + "flex min-h-8 min-w-0 flex-1 items-center gap-2 rounded-md px-2 text-left text-callout text-fg"; + const body = onClick ? ( + + ) : ( +
{children}
+ ); + return ( +
+ {label} + {tip ? {body} : body} +
+ ); +} + +/** A titled group that folds away from its title; the fold is the reader's habit, kept for every thread. */ +function Section({ + id, + title, + folded, + onToggle, + action, + children, +}: { + id: SectionId; + title: string; + folded: boolean; + onToggle: (id: SectionId) => void; + action?: ReactNode; + children: ReactNode; +}) { + return ( +
+
+ + + {action} +
+ {!folded &&
{children}
}
); } diff --git a/apps/desktop/src/ui/overview.ts b/apps/desktop/src/ui/overview.ts index bc8d1bbe1..305f1a130 100644 --- a/apps/desktop/src/ui/overview.ts +++ b/apps/desktop/src/ui/overview.ts @@ -21,6 +21,9 @@ export const OVERVIEW_SECTIONS = [ "deliverables", "log", "details", + "changes", + "activity", + "context", ] as const; export type OverviewSection = (typeof OVERVIEW_SECTIONS)[number]; diff --git a/apps/desktop/src/ui/primitives.tsx b/apps/desktop/src/ui/primitives.tsx index 49a33499e..727b7b187 100644 --- a/apps/desktop/src/ui/primitives.tsx +++ b/apps/desktop/src/ui/primitives.tsx @@ -503,7 +503,7 @@ export function Select({ ({ aria-hidden className={cx( "absolute top-0 left-0 transition-[transform,width] duration-200 ease-snappy", - tabs ? "h-7 rounded-md bg-fill" : "h-5 rounded-full bg-knob shadow-knob", + tabs ? "h-7 rounded-lg bg-fill" : "h-5 rounded-full bg-knob shadow-knob", )} style={{ transform: `translate(${thumb.left}px, ${tabs ? 0 : 2}px)`, width: thumb.width }} /> @@ -672,7 +672,7 @@ export function Segments({ onBlur={intent.cancel} className={cx( "relative whitespace-nowrap font-medium disabled:opacity-40", - tabs ? "h-7 rounded-md px-3 text-callout" : "h-5 rounded-full px-2 text-caption", + tabs ? "h-7 rounded-lg px-3 text-callout" : "h-5 rounded-full px-2 text-caption", fill && "min-w-0 flex-1", o.value === value ? selected : "text-fg-muted hover:text-fg", )} diff --git a/apps/desktop/src/ui/settingsKit.tsx b/apps/desktop/src/ui/settingsKit.tsx index 4f432ab4e..8b3f4a8c7 100644 --- a/apps/desktop/src/ui/settingsKit.tsx +++ b/apps/desktop/src/ui/settingsKit.tsx @@ -49,7 +49,7 @@ import { } from "../state/pageCache"; import { connectionFor, request, useApp } from "../state/store"; import { Check, ChevronDown, Info, RotateCcw } from "./icons"; -import { cx, menuItem, rowInset, Skeleton, Switch, Tooltip } from "./primitives"; +import { cx, menuItem, Pill, rowInset, Skeleton, Switch, Tooltip } from "./primitives"; /** * A section's name, above its card: `text-title3` in `fg`, at the card's own inset. `minor` is a @@ -361,27 +361,23 @@ export function Row({ // ---------------------------------------------------------------- controls /** - * The field shape a row's control takes: 28px high, `rounded-md` and a step of + * The field shape a row's control takes: 28px high, `rounded-lg` and a step of * its own over the card, so it reads as a control and not as a block. */ /** A switch setting's value as a row reads it. */ export const boolLabel = (value: Json | undefined) => (value ? "On" : "Off"); export const fieldClass = - "h-7 rounded-md bg-fill px-3 text-callout text-fg placeholder:text-fg-faint hover:bg-fill-strong focus:bg-fill-strong"; + "h-7 rounded-lg bg-fill px-3 text-callout text-fg placeholder:text-fg-faint hover:bg-fill-strong focus:bg-fill-strong"; /** - * A labelled action in a row: the quiet default (a translucent fill over the - * card), `prominent` for the one primary action, `danger` for a destructive - * one, `quiet` for one that rests without a fill (a section header's "Add"). + * A labelled action in a row: the app's one labelled button (`Pill`), so Settings and the rest of + * the app share its shape and fills. Secondary by default, `prominent` for the one primary action, + * `danger` for a destructive one, `quiet` only for a text-only action that rests without a fill + * (an action with an icon keeps its fill, so it reads as a button). */ export function Action({ - prominent, - danger, - quiet, size = "md", - className, - children, ...rest }: ButtonHTMLAttributes & { prominent?: boolean; @@ -389,26 +385,7 @@ export function Action({ quiet?: boolean; size?: "sm" | "md"; }) { - return ( - - ); + return ; } /** A menu's options arrive as `{ value, label }`; `""` is a real choice here. */ @@ -464,7 +441,7 @@ export function Select({ align="end" sideOffset={6} collisionPadding={8} - className="elevated rounded-xl z-[60] max-h-[min(360px,var(--radix-select-content-available-height))] max-w-[380px] min-w-[var(--radix-select-trigger-width)] overflow-hidden p-2 rc-in" + className="elevated rounded-2xl z-[60] max-h-[min(360px,var(--radix-select-content-available-height))] max-w-[380px] min-w-[var(--radix-select-trigger-width)] overflow-hidden p-2 rc-in" > {options.map((o) => ( diff --git a/docs/design.md b/docs/design.md index 46750c7e9..00e26766b 100644 --- a/docs/design.md +++ b/docs/design.md @@ -104,34 +104,33 @@ the accent marks state (on, selected, linked), it does not shout. | Step | px | Tailwind | Used by | |---|---|---|---| -| xs | 5 | `rounded-xs` | kbd, inline code (on `bg-fill`), tiny badges, checkboxes | -| sm | 7 | `rounded-sm` | 22px icon buttons inside rows, branch chips, small inputs | -| md | 9 | `rounded-md` | Icon buttons, selects, fields, list rows, inputs | -| lg | 11 | `rounded-lg` | Cards (tool output, error card), settings rows, menu items, pictures in replies | -| xl | 14 | `rounded-xl` | Settings group cards, menus, popovers, dialogs, the command palette, large panels, tooltips and hover cards | -| 2xl | 18 | `rounded-2xl` | The settings panel, toasts | -| 3xl | 22 | `rounded-3xl` | The largest floating surface | -| composer | 26 | `--rc-composer-radius` | The composer's box: its own corner, rounder than the scale, so it reads as one soft floating card over the text sliding under it | -| full | — | `rounded-full` | Labelled buttons (`Pill`), segmented controls, status chips, toolbar clusters, switches, avatars, dots, trackbars | +| xs | 6 | `rounded-xs` | kbd, inline code (on `bg-fill`), tiny badges, checkboxes | +| sm | 8 | `rounded-sm` | 22px icon buttons inside rows, branch chips, small inputs | +| md | 10 | `rounded-md` | Icon buttons, fields, list rows, inputs | +| lg | 12 | `rounded-lg` | Cards (tool output, error card), settings rows, menu items, pictures in replies | +| xl | 16 | `rounded-xl` | Settings group cards, menus, popovers, dialogs, the command palette, large panels, tooltips and hover cards | +| 2xl | 20 | `rounded-2xl` | The settings panel, toasts | +| composer | 20 | `--rc-composer-radius` | The composer's box: one floating card a step rounder than menus and popovers, so its corners read soft over the text sliding under it | +| 3xl | 26 | `rounded-3xl` | The largest floating surface (nothing uses it yet) | +| full | — | `rounded-full` | Labelled buttons (`Pill`), selects, segmented controls, status chips, toolbar clusters, switches, avatars, dots, trackbars | In the chat a component names its **role** instead of a step; each role is one of the steps above, so a theme's radius still scales it: | Role | Step (default px) | Tailwind | Used by | |---|---|---|---| -| inline | xs − 2 (3) | `rounded-inline` | Inline code and file references in a reply, keycaps | -| chip | sm (7) | `rounded-chip` | Compact controls H20–28: footer actions, tool rows' hover fill, thread chips | -| row | lg (11) | `rounded-row` | Standard controls H32–40 and single-line rows | -| block | xl (14) | `rounded-block` | Code blocks, diffs, tool output bodies, tables, file and preview cards | -| bubble | 2xl (18) | `rounded-bubble` | A sent message's bubble, independent cards | -| panel | 3xl (22) | `rounded-panel` | Dialogs, panels | +| inline | xs − 2 (4) | `rounded-inline` | Inline code and file references in a reply, keycaps | +| chip | sm (8) | `rounded-chip` | Compact controls H20–28: footer actions, tool rows' hover fill, thread chips | +| row | lg (12) | `rounded-row` | Standard controls H32–40 and single-line rows | +| block | xl (16) | `rounded-block` | Code blocks, diffs, tool output bodies, tables, file and preview cards | +| bubble | 2xl (20) | `rounded-bubble` | A sent message's bubble, independent cards | +| panel | 3xl (26) | `rounded-panel` | The composer, dialogs, panels | A nested inset takes the outer radius minus the inset, and a hover fill keeps its container's radius, so no crescent shows between them. A theme's `radius` (`sharp`, `default`, `round`) scales the steps -(`default`: 5/7/9/11/14/18/22, `sharp`: 2/3/4/6/8/10/12, `round`: -8/10/12/16/20/26/32) and sets the composer's own corner (26, 12, 32); components only ever +(`sharp`: 2/3/4/6/8/10/12, `round`: 8/10/12/16/20/26/32); components only ever name a step. No arbitrary radii (`rounded-[14px]`), no `rounded-4xl`. A child inside a padded parent uses the step below the parent's. @@ -642,9 +641,12 @@ content never shifts when a classic scrollbar appears. Shape rule: **what you press or pick is a pill, what holds content is a rounded rectangle.** Pills (`rounded-full`): labelled buttons (`Pill`, never a circle), segmented controls and their items, status chips, toolbar clusters, -switches, the composer's footer chips, and the chat header's machine pill and -side-panel toggle (a quiet pill that names the tab it opens, "Details"). -Rounded rectangles from the scale: selects and fields (`rounded-md`), icon +switches, selects, the composer's footer chips, and the chat header's machine +pill and side-panel toggle (a quiet pill that names the tab it opens, the +panel icon after the name). A labelled button with an icon always has a fill; +`quiet` (no fill at rest) is for text-only actions. Settings' `Action` is +`Pill`, so every labelled button in the app shares one shape. +Rounded rectangles from the scale: text fields (`rounded-lg`), icon buttons (`rounded-md`, `rounded-sm` in dense rows), cards, rows, menus and panels. Circles only for icon-only round buttons (send, stop). Buttons inside a callout's actions are `rounded-md`, one step below its `rounded-lg`, and centred on its message. From 87bf66c819dc1c7b1bf72e46ba79c6871ee567e1 Mon Sep 17 00:00:00 2001 From: LHaghfoss Date: Sun, 22 Nov 2026 20:41:24 +0100 Subject: [PATCH 4/7] test(desktop): drop the settings Action allowlist entry now that it is a Pill --- apps/desktop/src/design.test.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/apps/desktop/src/design.test.ts b/apps/desktop/src/design.test.ts index 5168b5ec5..a0155763e 100644 --- a/apps/desktop/src/design.test.ts +++ b/apps/desktop/src/design.test.ts @@ -70,11 +70,6 @@ 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/settingsKit.tsx", - "enabled:hover:bg-fill enabled:active:bg-fill-strong", - "a settings row's Action: one control shape in a card", - ], ["ui/Settings.tsx", "aria-current={s.id === section", "a settings section row"], ]; From 58709c2fd8c58b483da69e876e1bedc8c0ee9344 Mon Sep 17 00:00:00 2001 From: LHaghfoss Date: Sun, 22 Nov 2026 20:49:40 +0100 Subject: [PATCH 5/7] feat(desktop): let switches and segmented controls be held and dragged A held knob swells; a switch's knob and a segmented pill follow the pointer and commit on release. Settings' Choice now renders Segments at a row's size, and the segmented track gets a 3px inset around its pill. --- apps/desktop/src/index.css | 9 ++ apps/desktop/src/ui/primitives.tsx | 129 ++++++++++++++++++++++++---- apps/desktop/src/ui/settingsKit.tsx | 62 ++----------- docs/design.md | 19 +++- 4 files changed, 146 insertions(+), 73 deletions(-) diff --git a/apps/desktop/src/index.css b/apps/desktop/src/index.css index c502ad71c..b7fa6b0cd 100644 --- a/apps/desktop/src/index.css +++ b/apps/desktop/src/index.css @@ -1021,6 +1021,11 @@ border-radius: 9999px; background: var(--rc-knob); box-shadow: var(--rc-knob-shadow); + transition: scale 200ms var(--ease-snappy); +} +/* Held, the thumb swells like the switch's knob and the segmented control's pill. */ +.rc-range:active::-webkit-slider-thumb { + scale: 1.15; } .rc-range::-moz-range-track { height: 8px; @@ -1040,6 +1045,10 @@ border-radius: 9999px; background: var(--rc-knob); box-shadow: var(--rc-knob-shadow); + transition: scale 200ms var(--ease-snappy); +} +.rc-range:active::-moz-range-thumb { + scale: 1.15; } /* diff --git a/apps/desktop/src/ui/primitives.tsx b/apps/desktop/src/ui/primitives.tsx index 727b7b187..b4fe98123 100644 --- a/apps/desktop/src/ui/primitives.tsx +++ b/apps/desktop/src/ui/primitives.tsx @@ -556,6 +556,14 @@ export function Kbd({ children }: { children: ReactNode }) { * A switch: a pill knob as tall as its track (docs/design.md › Active controls), so the * button's own box is the track's 20 px and the row it sits in does not grow. */ +/** How far the switch's knob travels, in px: the track's width less the knob's and both insets. */ +const SWITCH_TRAVEL = 16; + +/** + * A switch. A press toggles it; the knob can also be dragged across and let go on either side. + * Held down, the knob stretches toward the side it would move to, so the press reads before the + * release. Keyboard Space and Enter toggle it as a button does. + */ export function Switch({ checked, onChange, @@ -567,6 +575,20 @@ export function Switch({ label: string; disabled?: boolean; }) { + const [pressed, setPressed] = useState(false); + // The knob's offset while it is dragged (0 off, SWITCH_TRAVEL on); null when it rests. + const [drag, setDrag] = useState(null); + const gesture = useRef<{ x: number; moved: boolean } | null>(null); + const end = (commit: boolean, x?: number) => { + const g = gesture.current; + gesture.current = null; + setPressed(false); + setDrag(null); + if (!commit || !g) return; + const next = g.moved && x !== undefined ? knobAt(x, g.x, checked) > SWITCH_TRAVEL / 2 : !checked; + if (next !== checked) onChange(next); + }; + const offset = drag ?? (checked ? SWITCH_TRAVEL : 0); return ( ); } +/** The knob's offset for a pointer at `x` that went down at `start`, clamped to the track. */ +function knobAt(x: number, start: number, checked: boolean): number { + return Math.min(SWITCH_TRAVEL, Math.max(0, (checked ? SWITCH_TRAVEL : 0) + x - start)); +} + /** * Segmented control: a track with a sliding thumb. The track fits its segments (`w-fit`), so a flex * column that stretches its children never leaves the buttons at one end of a full-width track; @@ -605,6 +655,7 @@ export function Segments({ onIntent, fill, tabs, + size = "sm", }: { value: T; options: { value: T; label: string; disabled?: boolean }[]; @@ -616,16 +667,41 @@ export function Segments({ fill?: boolean; /** A tab strip: the id of the panel the tabs control. */ tabs?: { controls: string }; + /** `md` is a settings row's control (24px segments), `sm` a toolbar's (20px). */ + size?: "sm" | "md"; }) { + const height = size === "md" ? "h-6" : "h-5"; // The selected segment's pill slides to the new one instead of jumping. const group = useRef(null); const [thumb, setThumb] = useState<{ left: number; width: number } | null>(null); const intent = useIntentRest((next: T) => onIntent?.(next)); + // A press on the track (not a tab strip): the thumb swells while held and follows the pointer + // across the segments; the release picks the one it is over. `shown` is that segment mid-gesture. + const [held, setHeld] = useState(null); + const pressing = useRef(false); + const shown = held ?? value; // biome-ignore lint/correctness/useExhaustiveDependencies: re-measures when the choice or labels change useLayoutEffect(() => { const el = group.current?.querySelector("[data-on]"); setThumb(el ? { left: el.offsetLeft, width: el.offsetWidth } : null); - }, [value, options.map((o) => o.label).join()]); + }, [shown, options.map((o) => o.label).join()]); + const optionAt = (x: number): T | undefined => { + const buttons = group.current?.querySelectorAll("button[data-value]") ?? []; + let best: { value: T; distance: number } | undefined; + for (const button of buttons) { + if (button.disabled) continue; + const r = button.getBoundingClientRect(); + const distance = x < r.left ? r.left - x : x > r.right ? x - r.right : 0; + if (!best || distance < best.distance) best = { value: button.dataset.value as T, distance }; + } + return best?.value; + }; + const release = (commit: boolean) => { + if (!pressing.current) return; + pressing.current = false; + if (commit && held !== null && held !== value) onChange(held); + setHeld(null); + }; // The pick's label sits on the white pill, so it takes the pill's dark fg. Before the first // measure the button draws the pill itself; a measured pill with no width (a track measured while // hidden) draws none, so its label keeps the track's own fg instead of dark on dark. @@ -640,41 +716,64 @@ export function Segments({
) => { + const at = e.button === 0 ? optionAt(e.clientX) : undefined; + if (at === undefined) return; + e.currentTarget.setPointerCapture(e.pointerId); + pressing.current = true; + setHeld(at); + }, + onPointerMove: (e: React.PointerEvent) => { + if (!pressing.current) return; + const at = optionAt(e.clientX); + if (at !== undefined && at !== held) setHeld(at); + }, + onPointerUp: () => release(true), + onPointerCancel: () => release(false), + onLostPointerCapture: () => release(false), + })} className={cx( "relative", - tabs ? "gap-1" : "rounded-full bg-fill p-[2px]", - fill ? "flex w-full" : "inline-flex w-fit", + tabs ? "gap-1" : "touch-none rounded-full bg-fill p-[3px]", + fill ? "flex w-full" : "inline-flex w-fit shrink-0", )} > {thumb && ( )} {options.map((o) => ( - ))} -
- ); + return ; } /** A row's state at a glance: a short tinted chip (signed in, signed out, active). */ diff --git a/docs/design.md b/docs/design.md index 353ac712e..70a80d5ac 100644 --- a/docs/design.md +++ b/docs/design.md @@ -189,6 +189,23 @@ knob and the track's fill answer a toggle over 200 ms. The button's own box is the track's 20 px, so a switch in a Settings row does not make the row taller than its neighbours. +A segmented track is inset 3 px around its pill (`Segments`; `Choice` is its +24 px size), so the pill reads as sitting inside the track rather than filling +it. + +Knobs answer the press, not just the release: + +- Held, a knob swells: a switch's grows to 28 px toward the side it would move + to (staying inside the track), a segmented pill scales to 104%, a slider's + thumb to 115%, each over 200 ms `--ease-snappy`. +- A switch and a segmented track can be dragged as well as pressed. A + segmented pill follows the pointer to the segment under it and picks it on + release. A switch's knob follows the pointer and lands on the side it is + let go nearer; a press without a drag toggles. A cancelled gesture changes + nothing. +- The keyboard still picks with a click (Space, Enter, arrows), so a pointer + gesture commits once, on release, and never twice. + ## Focus - Controls normally use `:focus-visible` for a ring: 2px `focus` at 40%, offset 2px. It is @@ -457,7 +474,7 @@ that change use `tabular`. - A new transcript row rises in with `rc-row-in` (260ms, fade + 6px), once: rows there when the thread opened, or remounted by the virtualizer, do not. A status dot that appears pops in (`rc-dot-in`); a segmented control's - selection slides (`transform`) to the new segment. A count that changes rolls + selection slides (`translate`) to the new segment. A count that changes rolls its digits vertically in 220ms `--ease-snappy` (`ui/RollingNumber.tsx`), keeping each column's place from the right, so 9 → 10 rolls the units and grows a tens. From b9328f902ebf2f37397645aa043c999e0fbb3f2d Mon Sep 17 00:00:00 2001 From: LHaghfoss Date: Sun, 22 Nov 2026 20:49:50 +0100 Subject: [PATCH 6/7] docs(desktop): drop arrow keys from the segmented control's keyboard note --- docs/design.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/design.md b/docs/design.md index 70a80d5ac..64234a198 100644 --- a/docs/design.md +++ b/docs/design.md @@ -203,7 +203,7 @@ Knobs answer the press, not just the release: release. A switch's knob follows the pointer and lands on the side it is let go nearer; a press without a drag toggles. A cancelled gesture changes nothing. -- The keyboard still picks with a click (Space, Enter, arrows), so a pointer +- The keyboard still picks with a click (Space, Enter), so a pointer gesture commits once, on release, and never twice. ## Focus From 4ee4c2d2b7785d229507ee0ff550ef2fc5c5fdda Mon Sep 17 00:00:00 2001 From: LHaghfoss Date: Sun, 22 Nov 2026 20:53:29 +0100 Subject: [PATCH 7/7] refactor(desktop): move the header and control notes into doc comments The comment check bans new line comments; the notes move into the components' doc comments and the ratchet tightens for the lines removed. --- apps/desktop/src/ui/ChatView.tsx | 8 ++++---- apps/desktop/src/ui/ThreadTitle.tsx | 10 +++++----- apps/desktop/src/ui/primitives.tsx | 24 ++++++++++-------------- scripts/comment-baseline.txt | 4 ++-- 4 files changed, 21 insertions(+), 25 deletions(-) diff --git a/apps/desktop/src/ui/ChatView.tsx b/apps/desktop/src/ui/ChatView.tsx index 2680cb438..fc3411876 100644 --- a/apps/desktop/src/ui/ChatView.tsx +++ b/apps/desktop/src/ui/ChatView.tsx @@ -154,10 +154,10 @@ function PlanHeaderButton({ thread }: { thread?: ThreadState }) { return thread ? : null; } -// The side panel's toggle: it opens the panel on this thread's last tab (Details, Changes, Pull -// requests) and closes whichever is showing. A quiet button that names that tab, so the header says -// where it goes. It carries `data-panel-toggle`: a panel that closes with nothing else focused hands -// the keyboard back to it (ui/RightPanel.tsx). +/** + * The side panel's toggle names the tab it opens (this thread's last: Details, Changes, Pull + * requests). Its `data-panel-toggle` takes the keyboard back when a panel closes (ui/RightPanel.tsx). + */ const PANEL_LABELS: Record = { details: "Details", changes: "Changes", diff --git a/apps/desktop/src/ui/ThreadTitle.tsx b/apps/desktop/src/ui/ThreadTitle.tsx index be7144b6f..7a9499fa7 100644 --- a/apps/desktop/src/ui/ThreadTitle.tsx +++ b/apps/desktop/src/ui/ThreadTitle.tsx @@ -1,7 +1,3 @@ -// The chat header's thread title: the last crumb after the project. It opens the thread's menu -// (the sidebar row's own, ui/SidebarThreadRow.tsx), with a chevron that shows on hover, and its -// Rename edits the title in place. - import { DropdownMenu } from "radix-ui"; import { useState } from "react"; import { useApp } from "../state/store"; @@ -11,6 +7,11 @@ import { ChevronDown } from "./icons"; import { MenuContent } from "./primitives"; import { ThreadMenuItems } from "./SidebarThreadRow"; +/** + * The chat header's thread title, the last crumb after the project. It opens the thread's menu + * (the sidebar row's own, ui/SidebarThreadRow.tsx) with a chevron that shows on hover, and its + * Rename edits the title in place, once the menu has closed and given focus back. + */ export function ThreadTitle({ thread, title }: { thread?: ThreadState; title: string }) { const session = useApp((s) => (thread ? s.sessions.find((x) => x.id === thread.id) : undefined)); const [renaming, setRenaming] = useState(false); @@ -18,7 +19,6 @@ export function ThreadTitle({ thread, title }: { thread?: ThreadState; title: st if (!session) return

{title}

; const startRename = () => { setDraft(session.title ?? title); - // After the menu closes and gives focus back. setTimeout(() => setRenaming(true), 0); }; const commit = () => { diff --git a/apps/desktop/src/ui/primitives.tsx b/apps/desktop/src/ui/primitives.tsx index b4fe98123..ffc58d929 100644 --- a/apps/desktop/src/ui/primitives.tsx +++ b/apps/desktop/src/ui/primitives.tsx @@ -576,19 +576,18 @@ export function Switch({ disabled?: boolean; }) { const [pressed, setPressed] = useState(false); - // The knob's offset while it is dragged (0 off, SWITCH_TRAVEL on); null when it rests. - const [drag, setDrag] = useState(null); + const [dragOffset, setDragOffset] = useState(null); const gesture = useRef<{ x: number; moved: boolean } | null>(null); const end = (commit: boolean, x?: number) => { const g = gesture.current; gesture.current = null; setPressed(false); - setDrag(null); + setDragOffset(null); if (!commit || !g) return; const next = g.moved && x !== undefined ? knobAt(x, g.x, checked) > SWITCH_TRAVEL / 2 : !checked; if (next !== checked) onChange(next); }; - const offset = drag ?? (checked ? SWITCH_TRAVEL : 0); + const offset = dragOffset ?? (checked ? SWITCH_TRAVEL : 0); return (