From 75c0fa8702245cf59948075abe80c2b217085300 Mon Sep 17 00:00:00 2001 From: Nam Rodriguez Date: Sat, 5 Dec 2026 22:12:51 -0500 Subject: [PATCH 01/10] Dashboard design tokens: one type ramp, a 4px spacing scale, radii and semantic colors The root font size was 18px, so every Tailwind size rendered on a fraction (13.5, 15.75, 20.25, 27px) and spacing on a 4.5px grid; pages added their own arbitrary sizes and raw palette colors on top. The root is back to the browser's 16px and src/app/tokens.css defines the system: - a seven-step ramp (13, 15, 16, 18, 20, 24, 32px), each with a fixed line height on the 4px grid, three weights, and semantic text styles (text-page-title, text-section-title, text-body, text-caption, text-data, text-numeric, text-display); - radii (4, 6, 8, 12px), two elevations for floating surfaces; - semantic colors for surfaces, lines, text and status (good, warn, bad, info, severe, done, accent) as --ch-* variables named in @theme, ready for a light theme; src/lib/tokens.ts mirrors them for charts and QR codes. The UI lint fails an arbitrary font size, an off-ramp weight, an arbitrary or off-scale padding, margin or gap, a raw hex color outside the token files, and a tokens.ts value that drifts from tokens.css; palette classes are counted against a baseline that only goes down. A rare real case is allowed with a ui-lint-allow comment that says why. The shell and every shared component move onto the tokens; buttons and fields share one height and radius; PageHeader draws the one title style and the first block under it sits 24px below on every page. Pages under src/app move in their own change (TOKENS_LATER in the lint). DESIGN.md is the guide, and e2e/design-tokens.spec.ts checks what renders on the shell and three pages at 1440 and 375 wide. --- dashboard/DESIGN.md | 130 ++++++++ dashboard/e2e/design-tokens.spec.ts | 106 +++++++ dashboard/scripts/ui-lint-allow.json | 2 +- dashboard/scripts/ui-lint.mjs | 148 ++++++++- dashboard/src/app/globals.css | 58 ++-- dashboard/src/app/layout.tsx | 2 +- dashboard/src/app/not-found.tsx | 6 +- dashboard/src/app/tokens.css | 259 ++++++++++++++++ dashboard/src/components/activity-summary.tsx | 16 +- dashboard/src/components/agent-approval.tsx | 26 +- dashboard/src/components/autofix-words.tsx | 8 +- .../src/components/aws-install-options.tsx | 64 ++-- dashboard/src/components/aws-permissions.tsx | 70 ++--- dashboard/src/components/brand-icons.tsx | 3 +- dashboard/src/components/callout.tsx | 14 +- dashboard/src/components/charts.tsx | 25 +- dashboard/src/components/chat-channels.tsx | 20 +- dashboard/src/components/chat-markdown.tsx | 36 +-- dashboard/src/components/chat-nav.tsx | 6 +- dashboard/src/components/check-list.tsx | 18 +- dashboard/src/components/client-shell.tsx | 289 +++++++++--------- dashboard/src/components/close-run-dialog.tsx | 22 +- dashboard/src/components/code-block.tsx | 32 +- dashboard/src/components/combobox.tsx | 32 +- dashboard/src/components/command-palette.tsx | 42 +-- dashboard/src/components/connections.tsx | 52 ++-- dashboard/src/components/custom-roles.tsx | 14 +- .../src/components/data-source-activity.tsx | 22 +- .../src/components/data-source-flow-shell.tsx | 4 +- .../src/components/data-source-kinds.tsx | 10 +- dashboard/src/components/data-table.tsx | 16 +- dashboard/src/components/deliveries.tsx | 108 +++---- .../src/components/delivery-overview.tsx | 73 ++--- dashboard/src/components/diff.tsx | 34 +-- dashboard/src/components/disclosure.tsx | 4 +- dashboard/src/components/domain-section.tsx | 52 ++-- dashboard/src/components/drawer.tsx | 14 +- dashboard/src/components/empty-state.tsx | 8 +- dashboard/src/components/field.tsx | 2 +- dashboard/src/components/file-path.tsx | 4 +- dashboard/src/components/findings-notify.tsx | 6 +- dashboard/src/components/follow-scroll.tsx | 2 +- .../src/components/hidden-fields-editor.tsx | 12 +- .../src/components/hidden-suggestions.tsx | 14 +- .../src/components/hybrid-app-choice.tsx | 8 +- dashboard/src/components/hybrid-jira-link.tsx | 42 +-- dashboard/src/components/hybrid-section.tsx | 128 ++++---- dashboard/src/components/infra-reads.tsx | 2 +- dashboard/src/components/install-checks.tsx | 18 +- .../src/components/integration-panel.tsx | 40 +-- .../src/components/knowledge/add-flow.tsx | 192 ++++++------ .../components/knowledge/app-map-source.tsx | 30 +- dashboard/src/components/knowledge/ask.tsx | 60 ++-- .../src/components/knowledge/base-parts.tsx | 50 +-- .../src/components/knowledge/builtin.tsx | 130 ++++---- .../src/components/knowledge/connections.tsx | 46 +-- .../src/components/knowledge/content.tsx | 72 ++--- .../src/components/knowledge/history.tsx | 60 ++-- .../src/components/knowledge/import-steps.tsx | 100 +++--- dashboard/src/components/knowledge/logos.tsx | 21 +- dashboard/src/components/knowledge/picker.tsx | 118 +++---- .../src/components/knowledge/readers.tsx | 12 +- .../src/components/knowledge/source-card.tsx | 20 +- .../src/components/knowledge/sync-limits.tsx | 18 +- .../components/knowledge/token-connect.tsx | 34 +-- dashboard/src/components/knowledge/usage.tsx | 42 +-- dashboard/src/components/list/list.tsx | 60 ++-- dashboard/src/components/list/status.tsx | 20 +- dashboard/src/components/list/toolbar.tsx | 24 +- dashboard/src/components/load-more.tsx | 2 +- dashboard/src/components/log-group-picker.tsx | 18 +- dashboard/src/components/markdown-editor.tsx | 49 +-- dashboard/src/components/markdown.tsx | 38 +-- dashboard/src/components/mcp-server-panel.tsx | 28 +- dashboard/src/components/mcp-servers.tsx | 62 ++-- dashboard/src/components/menu-search.tsx | 10 +- dashboard/src/components/menu.tsx | 6 +- dashboard/src/components/mermaid-diagram.tsx | 21 +- dashboard/src/components/modal.tsx | 18 +- dashboard/src/components/models-section.tsx | 32 +- dashboard/src/components/native-access.tsx | 12 +- dashboard/src/components/native-update.tsx | 18 +- dashboard/src/components/page.tsx | 18 +- .../src/components/permission-check-note.tsx | 4 +- dashboard/src/components/phone-bar.tsx | 16 +- dashboard/src/components/popover.tsx | 2 +- .../src/components/preview-access-dialog.tsx | 22 +- .../src/components/private-network-panel.tsx | 28 +- dashboard/src/components/problem.tsx | 10 +- dashboard/src/components/recovered.tsx | 2 +- dashboard/src/components/redirect.tsx | 2 +- .../src/components/replace-authenticator.tsx | 25 +- dashboard/src/components/repo-combobox.tsx | 2 +- dashboard/src/components/reset-data.tsx | 8 +- dashboard/src/components/resolved-repo.tsx | 24 +- dashboard/src/components/role-editor.tsx | 78 ++--- dashboard/src/components/roles-matrix.tsx | 62 ++-- dashboard/src/components/run-trigger.tsx | 6 +- dashboard/src/components/section-nav.tsx | 8 +- dashboard/src/components/segmented.tsx | 6 +- dashboard/src/components/select.tsx | 24 +- dashboard/src/components/settings-nav.tsx | 14 +- dashboard/src/components/settings-scope.tsx | 6 +- dashboard/src/components/settings/code.tsx | 2 +- dashboard/src/components/settings/field.tsx | 6 +- dashboard/src/components/settings/row.tsx | 14 +- .../src/components/settings/save-bar.tsx | 4 +- dashboard/src/components/settings/section.tsx | 8 +- dashboard/src/components/settings/switch.tsx | 4 +- dashboard/src/components/setup-banner.tsx | 4 +- dashboard/src/components/setup-checklist.tsx | 14 +- dashboard/src/components/setup-marks.tsx | 2 +- dashboard/src/components/sign-in-apps.tsx | 18 +- dashboard/src/components/sign-in-card.tsx | 12 +- dashboard/src/components/skeleton.tsx | 12 +- .../src/components/staging-cms-dialog.tsx | 18 +- dashboard/src/components/stat-tile.tsx | 14 +- dashboard/src/components/stepper.tsx | 16 +- dashboard/src/components/streaming-cursor.tsx | 2 +- dashboard/src/components/suggest-input.tsx | 2 +- dashboard/src/components/support-access.tsx | 38 +-- dashboard/src/components/support.tsx | 168 +++++----- dashboard/src/components/tabs.tsx | 6 +- dashboard/src/components/teams-webhook.tsx | 4 +- dashboard/src/components/tests/common.tsx | 24 +- dashboard/src/components/tests/coverage.tsx | 60 ++-- dashboard/src/components/tests/quarantine.tsx | 44 +-- dashboard/src/components/tests/settings.tsx | 50 +-- dashboard/src/components/tests/setup.tsx | 70 ++--- dashboard/src/components/tests/test-list.tsx | 6 +- dashboard/src/components/tests/trends.tsx | 29 +- dashboard/src/components/tests/views.tsx | 14 +- dashboard/src/components/thinking-block.tsx | 10 +- dashboard/src/components/toast.tsx | 6 +- dashboard/src/components/token-meters.tsx | 6 +- dashboard/src/components/tool-call-card.tsx | 28 +- dashboard/src/components/tools.tsx | 16 +- dashboard/src/components/top-bar.tsx | 18 +- dashboard/src/components/two-factor-setup.tsx | 15 +- dashboard/src/components/ui.ts | 18 +- .../src/components/uninstall-section.tsx | 14 +- dashboard/src/components/update-ready.tsx | 4 +- dashboard/src/components/work-used.tsx | 32 +- dashboard/src/lib/boot-recovery.ts | 1 + dashboard/src/lib/highlight.ts | 1 + dashboard/src/lib/link-preview.ts | 3 +- dashboard/src/lib/setup.ts | 6 +- dashboard/src/lib/support.ts | 14 +- dashboard/src/lib/tokens.ts | 43 +++ dashboard/src/lib/usage.ts | 2 +- 150 files changed, 2756 insertions(+), 2059 deletions(-) create mode 100644 dashboard/DESIGN.md create mode 100644 dashboard/e2e/design-tokens.spec.ts create mode 100644 dashboard/src/app/tokens.css create mode 100644 dashboard/src/lib/tokens.ts diff --git a/dashboard/DESIGN.md b/dashboard/DESIGN.md new file mode 100644 index 00000000..6f2c6e81 --- /dev/null +++ b/dashboard/DESIGN.md @@ -0,0 +1,130 @@ +# Dashboard design system + +One type ramp, one spacing scale, a handful of radii and semantic colors, so +every page reads as the same product. The values live in +[`src/app/tokens.css`](src/app/tokens.css) (CSS variables plus Tailwind's +`@theme`); code that cannot take a class (charts, QR codes, Mermaid, the +highlighter) reads the same values from [`src/lib/tokens.ts`](src/lib/tokens.ts). +`npm run lint` holds the rest of the code to them. + +## Type + +The root is the browser's 16px, so `1rem` is 16px. Seven sizes, each with a +fixed line height on the 4px grid: + +| Class | Size / line height | Use | +|---|---|---| +| `text-xs` | 13 / 18 | captions, metadata, badges, table headers, timestamps | +| `text-sm` | 15 / 22 | body, controls, list rows, section titles (16 / 24 on a phone) | +| `text-base` | 16 / 24 | lead text; fields on a phone | +| `text-lg` | 18 / 26 | the title of a card that is the page's subject | +| `text-xl` | 20 / 28 | a dialog's or an empty state's title | +| `text-2xl` | 24 / 32 | the page title (`` draws it) | +| `text-3xl` | 32 / 40 | a headline number on a stat tile | + +Three weights: `font-normal` (400) for reading, `font-medium` (500) for +labels, buttons and names, `font-semibold` (600) for titles. Nothing bolder. + +Semantic styles, size and weight only (add the color separately): + +| Class | What it is | +|---|---| +| `text-page-title` | 24 / 32 semibold, tracking tight | +| `text-section-title` | 15 / 22 semibold (``) | +| `text-body` | 15 / 22 normal | +| `text-caption` | 13 / 18 normal; pair with `text-fg-muted` | +| `text-data` | 13 / 18 mono, tabular numbers: ids, shas, durations in tables | +| `text-numeric` | tabular, lining figures for counts that line up | +| `text-display` | 32 / 40 semibold, tabular: a headline number | +| `text-code-inline` | 0.9em: inline code inside running text | + +"Secondary" text is body size in `text-fg-muted`. + +## Spacing + +Tailwind's steps on a 4px grid. Padding, margin and gap use only: +`0, px, 0.5, 1, 1.5, 2, 2.5, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24` +(0 to 96px). A value built from a token or the safe area +(`pb-[calc(var(--bottom-bar)+1rem)]`) is fine; `mt-[7px]` and `p-3.5` are not. + +The page rhythm, the same on every page: + +- the shell's gutter: 16px on a phone, 32px from `md:` (`
`); +- ``, then **24px**, then the content (globals.css holds the + first block under the header to it, whatever margin it asks for); +- **40px** between titled sections (`
`, `mt-10`); +- **12px** from a section's heading to its body; +- cards pad **16px** (`cardClass`, `p-4`); a list row pads `px-4 py-3`; +- **8px** between related controls (`gap-2`), **12px** between groups (`gap-3`). + +## Radii + +| Class | Size | Use | +|---|---|---| +| `rounded-sm` | 4px | badges, chips, keys, inline code | +| `rounded-md` | 6px | buttons, fields, menu items | +| `rounded-lg` | 8px | cards, panels, list boxes, menus, popovers, toasts | +| `rounded-xl` | 12px | dialogs and sheets | +| `rounded-full` | | pills, dots, avatars | + +## Colors + +Semantic names only; the palette (`zinc-400`, `amber-300`) is counted by the +lint and may only go down. Values are in `:root` so a light theme later +redefines `--ch-*` and nothing else changes. + +| Role | Classes | +|---|---| +| Surfaces | `bg-canvas` (page), `bg-surface` (card), `bg-raised` (menu, dialog, sheet), `bg-inset` (a well inside a card), `bg-control` / `bg-control-hover` (secondary button, chip), `bg-hover` (row and ghost hover), `bg-inverse` / `bg-inverse-hover` (primary button), `bg-scrim` (behind a dialog) | +| Lines | `border-line` (cards, dividers), `border-line-strong` (fields), `border-line-emphasis` (hover, selected) | +| Text | `text-fg-strong` (titles), `text-fg` (body), `text-fg-secondary`, `text-fg-muted` (secondary, captions), `text-fg-subtle` (15px and up only), `text-fg-disabled` (disabled only), `text-fg-inverse` (on `bg-inverse`) | +| Status | `good`, `warn`, `bad`, `info`, plus `severe` (high severity) and `done` (merged, pull requests): `text-warn`, `text-warn-strong`, `bg-warn-solid` (dots, bars), `bg-warn-soft`, `border-warn-line` | +| Accent | CoderHelm blue: `text-accent`, `bg-accent-solid`, `bg-accent-soft`, `border-accent-line` | +| Charts | `SERIES` / `CHART` from `src/lib/tokens.ts`; `bg-chart-1`, `bg-chart-2` for legends | + +A badge is `rounded-sm border border--line bg--soft px-1.5 text-xs text-`. + +## Elevation + +Only what floats casts a shadow: `shadow-popover` (menus, popovers, +toasts) and `shadow-dialog` (dialogs, sheets). Cards on the page have a +border and no shadow. + +## Components + +Use the shared pieces before writing classes: ``, ``, +`
`, ``, `cardClass` (components/page.tsx); +`buttonClass(variant, size)` and `inputClass` (components/ui.ts); +``, ``, `