Skip to content

feat(settings): per-user font size setting with server persistence#65

Open
arawal wants to merge 1 commit into
mainfrom
feat/per-user-font-scale
Open

feat(settings): per-user font size setting with server persistence#65
arawal wants to merge 1 commit into
mainfrom
feat/per-user-font-scale

Conversation

@arawal

@arawal arawal commented Jun 27, 2026

Copy link
Copy Markdown

What

Add a font size slider (80%-150%, 10% steps, default 100%) to the Appearance section of user settings. Moving the slider scales the entire site instantly by setting document.documentElement.style.fontSize - since the app has no explicit root font-size and Tailwind sizes are all rem-based, this scales virtually everything.

Why

Users have different comfort levels and display densities. A global font scale is the lowest-friction way to accommodate this without touching individual components.

How

Server persistence (source of truth across devices)

  • Migration 0020: ALTER TABLE users ADD COLUMN font_scale REAL DEFAULT 1.0
  • PATCH /auth/me now accepts fontScale (validated z.number().min(0.8).max(1.5))
  • GET /auth/me returns it as part of the existing user object (no change needed)

Local cache (instant apply on load, no flash)

  • Zustand ui store gets fontScale + setFontScale, included in the valet-ui localStorage key
  • FontScaleProvider (mounted in app.tsx alongside ThemeProvider) applies the scale to the DOM and reconciles the server value into the store after auth hydration - server wins, ensuring cross-device consistency

Settings UI

  • Range slider in the Appearance section, below Theme
  • Live percentage label (80%-150%, step 10%)
  • Reset button appears when not at default
  • Slider change updates the store immediately (instant DOM update) and debounces the PATCH /auth/me call by 600ms

@arawal arawal requested a review from a team June 27, 2026 01:16
@arawal arawal requested a review from yourbuddyconner as a code owner June 27, 2026 01:16
@github-actions

Copy link
Copy Markdown

Preview deployment: https://pr-65.dev-valet-turnkey-client.pages.dev

Add a font size slider (80%-150%, 10% steps) to the Appearance section
of user settings. The setting is persisted server-side (users.font_scale
DB column) and cached locally in localStorage (Zustand ui store) for
instant apply on page load without a flash.

- Migration 0020: ALTER TABLE users ADD COLUMN font_scale REAL DEFAULT 1.0
- Drizzle schema, rowToUser, and updateUserProfile updated
- PATCH /auth/me validates fontScale (min 0.8, max 1.5)
- Shared User type gets fontScale field
- Zustand ui store gets fontScale + setFontScale (persisted)
- FontScaleProvider hook applies document.documentElement.style.fontSize
  and reconciles server value into the store after auth hydration
- Settings UI: range slider with live % label, Reset button, and a
  600ms debounce before the PATCH /auth/me call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant