Skip to content

Commit c22c54e

Browse files
tellahonpub1223z34hd7vtwc6qj4s7flsxkj644nlre2nthu7lrrmkumhu3xddsrx9r6wnpub14vtk7pvazqrq9639qu7e560wnqtl0d53ca4gjuvq6jzf3k2el23qqlwa7f
authored
fix(desktop): restore timeline zoom via rem tokens + chat-as-base type scale (#1052)
Signed-off-by: Taylor Ho <[email protected]> Co-authored-by: npub1223z34hd7vtwc6qj4s7flsxkj644nlre2nthu7lrrmkumhu3xddsrx9r6w <52a228d6edf316ec6812ac3c9fc0d696ab59fc7954d77e7be31eedcddf91335b@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub14vtk7pvazqrq9639qu7e560wnqtl0d53ca4gjuvq6jzf3k2el23qqlwa7f <ab176f059d100602ea25073d9a69ee9817f7b691c76a897180d48498d959faa2@sprout-oss.stage.blox.sqprod.co>
1 parent d879fac commit c22c54e

84 files changed

Lines changed: 708 additions & 323 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎AGENTS.md‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,40 @@ just desktop-dev # web-only dev server (faster iteration)
412412
just dev # full Tauri app with native shell
413413
```
414414

415+
### Text sizing & zoom (use rem, never px)
416+
417+
The desktop app implements Cmd +/- zoom by scaling the root `<html>`
418+
font-size (`desktop/src/app/useWebviewZoomShortcuts.ts`) and pinning the native
419+
webview zoom. **Only rem-based text scales with zoom — hardcoded px text sizes
420+
are frozen.**
421+
422+
So for any readable text, reach for rem-based Tailwind tokens, never arbitrary
423+
px:
424+
425+
- ✅ Stock rem tokens (`text-base`, `text-sm`, `text-xs`, …). **Chat body/author
426+
text === `text-base` (16px) — chat is the app's base type size**, and the
427+
surrounding timeline elements (timestamps, system rows, code, reactions) are
428+
deliberate steps on that same stock ramp.
429+
- ✅ The `text-2xs` (0.6875rem / 11px) and `text-3xs` (0.5rem / 8px) meta-text
430+
tokens (in `desktop/tailwind.config.js` under `theme.extend.fontSize`) for the
431+
sub-`text-xs` ramp — timestamps, count badges, tracking labels, tiny glyphs.
432+
These replaced the dozens of arbitrary `text-[…rem]` literals that had drifted
433+
apart pixel-by-pixel; keep meta text on these two tokens, not new arbitrary
434+
values.
435+
- ❌ `text-[15px]`, `text-[13px]`, CSS `font-size: 15px` — px froze against zoom
436+
and caused the message-timeline regression (PR #891).
437+
- ❌ Arbitrary rem literals too: `text-[0.6875rem]`, `text-[0.9rem]`, etc. They
438+
zoom fine but re-fragment the scale we consolidated. Use a named token.
439+
440+
Prefer stock tokens — they're rem and zoom-safe. Only if a design genuinely
441+
needs a size the stock/`2xs`/`3xs` scale can't express should you **add a
442+
rem-based token** (in `desktop/tailwind.config.js` under `theme.extend.fontSize`)
443+
rather than an arbitrary literal. A CI guard (`pnpm check:px-text`, in
444+
`desktop/scripts/check-px-text.mjs`) scans all of `desktop/src` and fails on any
445+
new arbitrary text-size literal — px **or** rem/em. Genuinely decorative glyphs
446+
(e.g. the `text-[6rem]` avatar emoji) are allowlisted by `path:line` in that
447+
script.
448+
415449
### Workspace Switching
416450

417451
The desktop app supports multiple workspaces (each backed by a different relay).

‎RESEARCH/CHAT_BASE_TYPE_SCALE.md‎

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
title: "Chat-as-base type scale: re-anchoring the timeline type ramp"
3+
tags: [desktop, typography, design-tokens, tailwind, zoom]
4+
status: active
5+
created: 2026-06-15
6+
---
7+
8+
# Chat-as-base type scale
9+
10+
## Why this exists
11+
tho's reframe (2026-06-15): **chat text *is* the base size** — the fundamental
12+
building block of the app. It should not be a special between-the-cracks token
13+
(`text-chat` = 15px, wedged between Tailwind's `text-sm` 14px and `text-base`
14+
16px). Direction: **bump chat to 16px and make it the base**, then re-anchor the
15+
*other* timeline/thread elements that currently sit relative to the old ~15px
16+
chat assumption. This is a **deliberate, wider pass** — a design decision, not a
17+
surgical bugfix.
18+
19+
Builds on the zoom-regression work (PR #1051, branch `tho/rem-font-zoom-fix`)
20+
which introduced the `text-chat`/`text-code` rem tokens. That fix preserved
21+
Kenny's 15px intent; this pass *changes* that intent to 16px-as-base.
22+
23+
## Non-negotiables (carry forward from the zoom fix)
24+
- **Everything stays rem.** Cmd +/- zoom scales the root `<html>` font-size
25+
(rem-only by design, from #573). px would freeze against zoom — that was the
26+
original bug. The `check:px-text` guard already enforces this; keep it happy.
27+
- No `html { font-size }` override exists, so root is browser-default 16px and
28+
rem math is standard (1rem = 16px). The `--font-size: 14px` var in globals.css
29+
is scoped to the emoji-picker component, NOT the app root.
30+
31+
## Current type landscape (timeline/thread render path)
32+
`text-chat` (15px) is used in:
33+
- `MessageRow.tsx` — markdown body wrapper, author name (`<span>` and `<h3>`)
34+
- `markdown.tsx` — chat body wrapper
35+
- `mentionChip.ts` — mention chip text
36+
- (`text-code` 13px — inline/block code in `markdown.tsx`)
37+
- `globals.css` `.mention-highlight` — 0.9375rem
38+
39+
Satellite elements currently on the **stock** scale (these are the "other
40+
elements that sit relative to chat" tho means — review each for whether it still
41+
reads right once chat = 16px base):
42+
- `MessageTimestamp.tsx` — text-xs
43+
- `SystemMessageRow.tsx` — text-xs / text-sm
44+
- `MessageThreadSummaryRow.tsx` — text-xs
45+
- `MessageThreadPanel.tsx` — text-sm / text-xs
46+
- `MessageReactions.tsx` — text-xs / text-sm
47+
- `MessageActionBar.tsx` — text-xs
48+
- `TypingIndicatorRow.tsx` — text-xs / text-sm
49+
- `MessageTimeline.tsx` — text-base / text-sm / text-xl (empty states / headers)
50+
- `MessageRow.tsx` (secondary bits) — text-sm / text-xs
51+
52+
## The design question for the build
53+
If chat === base (16px), the type ramp around it should be *intentional*, not
54+
incidental. The relationships that matter:
55+
- chat body / author = base (16px)
56+
- timestamps, metadata, system rows, reactions = one or two steps down,
57+
consistently (don't leave them as ad-hoc text-xs/text-sm if the ratio now
58+
looks off against a 16px anchor)
59+
- code = its own deliberate step down from chat
60+
61+
Open for Bart to decide the cleanest expression: lean on stock Tailwind tokens
62+
where they land right now that base is the anchor, retire/rename `text-chat` if
63+
it's redundant with `text-base`, and only define custom rem tokens where the
64+
stock scale genuinely can't express the intended step.
65+
66+
## Out of scope
67+
- App-wide px sweep (the ~130 px classes elsewhere). Stay in the
68+
timeline/thread render path + the type tokens that serve it.
69+
- Don't widen the `check:px-text` guard roots in this pass (Marge's noted
70+
follow-up) unless a new render-path file demands it.
71+
72+
## Decision (built)
73+
Chat === `text-base` (16px, stock). Both custom tokens **retired** — `text-chat`
74+
and `text-code` were artifacts of the 15px-wedge era; with chat at the stock
75+
base they're redundant. Code (inline + block) re-anchored to stock `text-sm`
76+
(14px) — a deliberate, documented one-notch step down from the 16px base.
77+
78+
Satellites left on their stock tokens **deliberately**: against a 16px base the
79+
ratios actually tighten into the standard ramp (e.g. timestamps `text-xs` 12px =
80+
clean base→sm→xs drop, was the awkward 12/15 before). Bumping them would inflate
81+
the UI for no design gain — the right call is to keep them and document why.
82+
83+
Net: zero custom font tokens. `.mention-highlight` (composer) follows chat to
84+
`1rem` (16px). Everything rem, guard stays green.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Timeline Zoom Regression — Findings (for Bart)
2+
3+
## The bug
4+
Cmd +/- zoom no longer scales message-timeline & thread text.
5+
6+
## Why (mechanism)
7+
`desktop/src/app/useWebviewZoomShortcuts.ts` scales the ROOT `<html>` font-size
8+
(rem-based scaling) and pins native `webview.setZoom(DEFAULT)`. So only **rem**
9+
sizes scale; hardcoded **px** sizes are frozen. This is the intended approach
10+
("only text should scale" — keeps webview coordinate system stable). Do NOT
11+
revert to native webview zoom.
12+
13+
## Two-layer history
14+
1. **#573** (9e76a08a, May 14) — switched zoom native→root-font-size/rem-only.
15+
2. **#891** (45f3dfe5, Jun 8, "Tune chat text sizing", klopez4212) — the recent
16+
timeline regression. Converted timeline rem→px.
17+
18+
## Kenny's intent in #891 (PRESERVE THIS)
19+
He bumped chat text up from `text-sm` (0.875rem=14px) to **15px** because sm felt
20+
too small. Conversions made:
21+
- MessageRow author name `<span>` & `<h3>`: `text-sm` → `text-[15px]`
22+
- markdown body / mentionChip: `text-sm` → `text-[15px]`
23+
- `globals.css` `.mention-highlight`: added `font-size: 15px`, radius 0.375rem→4px
24+
- also touched MessageTimeline, SystemMessageRow, MessageThreadSummaryRow
25+
26+
## The crux
27+
Tailwind v4 here uses STOCK text tokens (no `@theme` override). Stock scale:
28+
text-sm=14px, text-base=16px. **15px sits between them — no stock token exists.**
29+
That's WHY Kenny reached for arbitrary px.
30+
31+
## tho's directive
32+
- Use rem + Tailwind tokens wherever possible.
33+
- Preserve Kenny's visual intent (the 15px chat sizing).
34+
- Outcome MAY be to define/update a text-size token to yield 15px in rem — but
35+
only if stock tokens genuinely can't deliver the look. Take a critical pass:
36+
prefer a stock token if it looks right; introduce a custom token only if needed.
37+
38+
## Scope: timeline + thread render path only
39+
MessageRow, markdown.tsx, mentionChip.ts, SystemMessageRow,
40+
MessageThreadSummaryRow, MessageTimeline, and the relevant globals.css rules
41+
(incl. `.mention-highlight` px font-size). Verify zoom works after.
42+
43+
## Codify (fix #2)
44+
No custom lint exists. Add a guard (Biome rule or CI grep) flagging new
45+
`text-[NNpx]` / px `fontSize` in the desktop app + a note in AGENTS.md/CLAUDE.md.

‎desktop/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
"build": "tsc && vite build",
99
"typecheck": "tsc --noEmit",
1010
"check:file-sizes": "node ./scripts/check-file-sizes.mjs",
11+
"check:px-text": "node ./scripts/check-px-text.mjs",
1112
"lint": "biome lint .",
12-
"check": "biome check . && pnpm check:file-sizes",
13+
"check": "biome check . && pnpm check:file-sizes && pnpm check:px-text",
1314
"format": "biome format --write .",
1415
"test": "node --import ./test-loader.mjs --experimental-strip-types --test 'src/**/*.test.mjs'",
1516
"preview": "vite preview",

‎desktop/scripts/check-px-text.mjs‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import path from "node:path";
2+
import { fileURLToPath } from "node:url";
3+
import { runPxTextCheck } from "../../scripts/check-px-text-core.mjs";
4+
5+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
6+
const projectRoot = path.resolve(__dirname, "..");
7+
8+
// Enforces the rem-token text scale app-wide. The rem→px zoom regression
9+
// (PR #891) landed in the message-timeline render path, but arbitrary text
10+
// literals (`text-[…px]`, `text-[…rem]`) had drifted across the whole desktop
11+
// app — so the guard now scans all of `src`. Readable text MUST use a rem-based
12+
// token (the stock `text-base`/`text-sm`/`text-xs` scale, or the `text-2xs` /
13+
// `text-3xs` meta-text tokens) so Cmd +/- zoom scales it and the size stays on
14+
// one consolidated scale. Genuine decorative glyphs are allowlisted below.
15+
const rules = [
16+
{
17+
root: "src",
18+
extensions: new Set([".ts", ".tsx", ".css"]),
19+
},
20+
];
21+
22+
// Decorative / chrome exceptions: `relativePath:lineNumber`. The avatar emoji
23+
// glyph is a fixed display size sized to its avatar box (not readable message
24+
// text), so it stays as the lone documented `text-[6rem]` literal.
25+
const overrides = new Set([
26+
"src/features/settings/ui/ProfileSettingsCard.tsx:573",
27+
"src/features/onboarding/ui/AvatarStep.tsx:89",
28+
]);
29+
30+
await runPxTextCheck({
31+
projectRoot,
32+
rules,
33+
overrides,
34+
label: "Desktop",
35+
scriptPath: "desktop/scripts/check-px-text.mjs",
36+
});

‎desktop/src/features/agent-memory/ui/MemorySection.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ function MemoryGraphView({
253253
className="text-xs italic text-muted-foreground"
254254
data-testid="agent-memory-no-core"
255255
>
256-
No <code className="font-mono text-[10px]">core</code> memory yet —
257-
agent identity is unrooted.
256+
No <code className="font-mono text-2xs">core</code> memory yet — agent
257+
identity is unrooted.
258258
</p>
259259
) : null}
260260

‎desktop/src/features/agents/ui/AddTeamToChannelDialog.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export function AddTeamToChannelDialog({
178178
>
179179
<ProfileAvatar
180180
avatarUrl={persona.avatarUrl}
181-
className="h-5 w-5 text-[9px]"
181+
className="h-5 w-5 text-2xs"
182182
label={persona.displayName}
183183
/>
184184
<span className="text-xs font-medium">

‎desktop/src/features/agents/ui/AgentSessionToolItem.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ function ToolTimestamp({
198198
return (
199199
<Tooltip>
200200
<TooltipTrigger asChild>
201-
<span className="shrink-0 cursor-default text-[11px] text-muted-foreground/60">
201+
<span className="shrink-0 cursor-default text-2xs text-muted-foreground/60">
202202
{time}
203203
{duration ? ` · ${duration}` : null}
204204
</span>
@@ -260,7 +260,7 @@ function BuzzToolInlineAction({
260260
if (action.onClick) {
261261
return (
262262
<button
263-
className="inline-flex max-w-[14rem] shrink min-w-0 items-center gap-1 rounded-full border border-primary/20 bg-primary/[0.05] px-1.5 py-0.5 text-[11px] font-normal leading-none text-primary/90 transition-colors hover:border-primary/35 hover:bg-primary/10 hover:text-primary"
263+
className="inline-flex max-w-[14rem] shrink min-w-0 items-center gap-1 rounded-full border border-primary/20 bg-primary/[0.05] px-1.5 py-0.5 text-2xs font-normal leading-none text-primary/90 transition-colors hover:border-primary/35 hover:bg-primary/10 hover:text-primary"
264264
onClick={(event) => {
265265
event.preventDefault();
266266
event.stopPropagation();
@@ -279,7 +279,7 @@ function BuzzToolInlineAction({
279279

280280
return (
281281
<span
282-
className="inline-flex max-w-[14rem] shrink min-w-0 items-center gap-1 rounded-full border border-border/60 bg-muted/40 px-1.5 py-0.5 text-[11px] font-normal leading-none text-muted-foreground"
282+
className="inline-flex max-w-[14rem] shrink min-w-0 items-center gap-1 rounded-full border border-border/60 bg-muted/40 px-1.5 py-0.5 text-2xs font-normal leading-none text-muted-foreground"
283283
title={action.title}
284284
>
285285
{action.avatar}

‎desktop/src/features/agents/ui/AgentSessionTranscriptList.tsx‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ function MessageItem({
112112
{!isAssistant ? (
113113
<UserAvatar
114114
avatarUrl={authorProfile?.avatarUrl ?? null}
115-
className="mr-2 mt-1 h-5 w-5 shrink-0 text-[8px]"
115+
className="mr-2 mt-1 h-5 w-5 shrink-0 text-3xs"
116116
displayName={authorLabel}
117117
size="xs"
118118
/>
@@ -139,7 +139,7 @@ function MessageItem({
139139
)}
140140
>
141141
{isAssistant ? (
142-
<Markdown compact content={text || " "} />
142+
<Markdown content={text || " "} />
143143
) : (
144144
<>
145145
<p className="whitespace-pre-wrap break-words">{text}</p>
@@ -166,7 +166,7 @@ function ThoughtItem({
166166
<ChevronDown className="h-4 w-4 shrink-0 transition-transform group-open:rotate-180" />
167167
</summary>
168168
<div className="py-2 pl-5 text-sm leading-6 text-muted-foreground">
169-
<Markdown compact content={item.text.trim() || " "} />
169+
<Markdown content={item.text.trim() || " "} />
170170
</div>
171171
</details>
172172
);
@@ -198,7 +198,7 @@ function MetadataItem({
198198
<span className="truncate">{section.title}</span>
199199
<ChevronDown className="h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open/section:rotate-180" />
200200
</summary>
201-
<pre className="mt-2 max-h-56 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted/50 px-3 py-2 font-mono text-[11px] leading-5 text-muted-foreground">
201+
<pre className="mt-2 max-h-56 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted/50 px-3 py-2 font-mono text-2xs leading-5 text-muted-foreground">
202202
{section.body.trim() || "No metadata."}
203203
</pre>
204204
</details>
@@ -248,7 +248,7 @@ function TranscriptTimestamp({ timestamp }: { timestamp: string }) {
248248
return (
249249
<Tooltip>
250250
<TooltipTrigger asChild>
251-
<span className="shrink-0 cursor-default text-[11px] text-muted-foreground/60">
251+
<span className="shrink-0 cursor-default text-2xs text-muted-foreground/60">
252252
{formatted}
253253
</span>
254254
</TooltipTrigger>

‎desktop/src/features/agents/ui/ManagedAgentLogPanel.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ export function ManagedAgentLogPanel({
6464
<Skeleton className="mt-2 h-4 w-3/4" />
6565
</div>
6666
) : (
67-
<div className="mt-4 overflow-hidden rounded-xl border border-border/70 bg-[#17171d] text-[12px] text-zinc-100">
68-
<div className="flex items-center justify-between border-b border-white/10 px-4 py-2 text-[11px] uppercase tracking-[0.18em] text-zinc-400">
67+
<div className="mt-4 overflow-hidden rounded-xl border border-border/70 bg-[#17171d] text-xs text-zinc-100">
68+
<div className="flex items-center justify-between border-b border-white/10 px-4 py-2 text-2xs uppercase tracking-[0.18em] text-zinc-400">
6969
<span>{selectedAgent.name}</span>
7070
<span>{selectedAgent.status}</span>
7171
</div>

0 commit comments

Comments
 (0)