feat(web): add local typography settings#1337
feat(web): add local typography settings#1337Danielalnajjar wants to merge 4 commits intopingdotgg:mainfrom
Conversation
Persist local typography preferences in app settings so the UI and terminal can read a stable source of truth. Key files: - apps/web/src/appSettings.ts: adds ui and terminal font size/family settings to persisted app settings - apps/web/src/appSettings.test.ts: covers defaults and decoding for the new typography settings Design decisions: - Store typography alongside existing local app settings so the feature remains device-local. - Keep font family values as trimmed free-form strings so installed system fonts can be referenced directly. Unlocks root typography application and settings UI controls. Generated with OpenAI Codex
Apply persisted typography settings to interface, code, and terminal surfaces through root-level CSS variables. Key files: - apps/web/src/appTypography.ts: maps settings to CSS variables and terminal typography helpers - apps/web/src/appTypography.test.ts: verifies size mappings and font normalization - apps/web/src/routes/__root.tsx: mounts typography application at app startup - apps/web/src/index.css: wires interface and code font variables into global styles Design decisions: - Use CSS custom properties at the root so typography updates propagate without component rewrites. - Keep regular UI inputs on the interface font while reserving the mono stack for code and terminal surfaces. Unlocks settings-driven typography changes across the app and terminal runtime. Generated with OpenAI Codex
Expose typography settings in the Settings screen so users can adjust scale and local font stacks without editing config files. Key files: - apps/web/src/routes/_chat.settings.tsx: adds the Typography card, control wiring, defaults, and helper copy Design decisions: - Group UI scale and font stack controls under a single Typography card for discoverability. - Describe interface and code or terminal scopes separately so users can predict which surfaces each setting affects. Unlocks self-serve configuration for interface and terminal typography. Generated with OpenAI Codex
Update the integrated terminal drawer when typography settings change so users can preview terminal adjustments immediately. Key files: - apps/web/src/components/ThreadTerminalDrawer.tsx: reads terminal typography, updates xterm options, and resyncs geometry - apps/web/src/components/ThreadTerminalDrawer.test.ts: covers appearance updates and backend resize syncing Design decisions: - Update xterm appearance in place instead of recreating terminals to preserve scrollback and session state. - Refit and report terminal geometry after font changes so backend dimensions stay accurate. Unlocks live terminal typography previews from the settings screen. Generated with OpenAI Codex
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds local-only typography preferences to the web app, letting users adjust interface scale and font stacks (UI + mono/terminal) via Settings and applying them through root CSS variables, including live terminal updates.
Changes:
- Persist new settings:
uiFontSize,terminalFontSize,uiFontFamily,monoFontFamily(with defaults/backfill on decode). - Apply typography via CSS custom properties and initialize them at app root via
useAppTypography. - Update the built-in terminal drawer to react to theme/typography changes and re-sync geometry without recreating the terminal.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/web/src/appSettings.ts | Adds new typography settings fields/types/defaults to the persisted settings schema. |
| apps/web/src/appSettings.test.ts | Extends schema default/backfill test coverage for new settings keys. |
| apps/web/src/appTypography.ts | Introduces typography helpers and useAppTypography to drive root CSS variables; adds terminal typography reader. |
| apps/web/src/appTypography.test.ts | Adds unit tests for font-size mapping and font-family normalization. |
| apps/web/src/index.css | Defines default typography CSS variables and wires them into html/body and mono surfaces. |
| apps/web/src/routes/__root.tsx | Installs useAppTypography at the root so CSS variables stay in sync with settings. |
| apps/web/src/routes/_chat.settings.tsx | Adds a new “Typography” section in Settings for changing font sizes and font-family overrides. |
| apps/web/src/components/ThreadTerminalDrawer.tsx | Refactors terminal to read typography from CSS vars and live-update appearance/geometry via observers. |
| apps/web/src/components/ThreadTerminalDrawer.test.ts | Adds focused unit tests for the extracted terminal appearance/geometry helpers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <p>Binary source</p> | ||
| <p className="mt-1 break-all font-mono text-[11px] text-foreground"> | ||
| <p className="mt-1 break-all text-[11px] text-foreground"> | ||
| {codexBinaryPath || "PATH"} |
There was a problem hiding this comment.
The "Binary source" path line used to be rendered with font-mono, but this change drops monospace styling. This seems to conflict with the PR description that existing monospace UI surfaces should remain on the mono font family (and it’s inconsistent with the Keybindings path below which is still monospace). Consider restoring font-mono/<code> here, or updating the intended scope/description so path readouts are consistently styled.
| const DEFAULT_MONO_FONT_FAMILY = | ||
| '"SF Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace'; |
There was a problem hiding this comment.
DEFAULT_MONO_FONT_FAMILY duplicates the default mono stack defined in index.css (--app-mono-font-family). This creates a drift risk where the terminal fallback and the CSS default could diverge over time. Consider reusing a single source of truth (e.g., export the default stack from one place, or fall back to a generic monospace when the CSS variable is missing).
| const DEFAULT_MONO_FONT_FAMILY = | |
| '"SF Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace'; | |
| const DEFAULT_MONO_FONT_FAMILY = "monospace"; |
Add local typography settings for the app UI so users can tune interface scale, font family, and terminal typography without editing config files. This responds directly to requests for UI font size and custom font support, while keeping the scope local-only and avoiding remote font loading.
Feedback requested
I'd appreciate feedback mainly on product fit and scope:
Suggested review order
apps/web/src/appSettings.tsandapps/web/src/appTypography.tsapps/web/src/index.cssandapps/web/src/routes/__root.tsxapps/web/src/routes/_chat.settings.tsxapps/web/src/components/ThreadTerminalDrawer.tsxWhat changed
uiFontSize,terminalFontSize,uiFontFamily, andmonoFontFamilyScope boundaries
This PR intentionally does not add remote font loading, server-side settings sync, or broader theming work. It is meant to stay narrowly focused on local typography preferences.
Verification
I ran:
bun fmtbun lintbun typecheckcd apps/web && bun run test src/appSettings.test.ts src/appTypography.test.ts src/components/ThreadTerminalDrawer.test.tsI also manually checked the feature locally in the dev app:
Test gap
I did not use repo-root
bun run testas a PR gate here because the current upstreammaincheckout already has unrelated redapps/servertests in my environment. The failures reproduce outside this branch and are not in files touched by this PR.Screenshots
These visuals are meant to show the new Typography settings surface and the visible difference between the default, large, and small interface font sizes.
Settings screen
Before:

After:

Interface font size examples
Small:

Default:

Large:

Video
Video.mp4
Living plan file use for implementation
18-local-typography-settings.md
Related
Note
Add local typography settings for UI font size, terminal font size, and font family overrides
uiFontSize,terminalFontSize,uiFontFamily, andmonoFontFamilyfields toAppSettingsSchema, with defaults ofmdsize and empty family overrides.useAppTypographyhook that writes CSS variables (--app-ui-font-size,--app-terminal-font-size,--app-ui-font-family,--app-mono-font-family) to the document root and keeps them in sync with settings changes.index.cssto drive base font size and family from these CSS variables, including code blocks and terminal textarea.ThreadTerminalDrawerto read font settings from CSS variables on mount and react to style/theme mutations via observers, replacing theresizeEpoch/drawerHeightprop approach.Macroscope summarized d388c21.