feat(prefs): per-user UI font scale (A−/A+), saved to the profile
A header A−/value/A+ control scales the whole UI, persisted per user and restored on login from any booth — cloning the theme-pref pattern end to end. - DB: users.font_scale (migration 0014; percent, 100 = base, NOT NULL default). - Server: PUT /api/auth/font-scale (auth-guarded; clamps to 80–160, snaps to a 10-step); fontScale flows through sessionView → login + /me. - Client: setFontScalePref + applyFontScale; applied in App alongside theme; FontScaleToggle in the header; i18n sq+en. Scaling uses CSS `zoom` on the root, NOT root font-size: the app's type is pinned in px (text-[12px] etc., ~230 spots), which a font-size change would not scale — so the dense Active-sessions / Live-feed logs stayed tiny. `zoom` scales everything uniformly (text, spacing, icons) like the browser's Ctrl+/−, which is the readability win for operators who need larger text. Tests: 4 font-scale auth-route cases (persist + /me, clamp/snap, 400, default-100). Full workspace build/lint/test green. Claude-Session: https://claude.ai/code/session_01Xcm6ikLgGoCxxHrxtjkk5V
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
-- Per-user UI font scale (PERCENT of base; 100 = base). Persisted like `theme`/`language`
|
||||
-- so an operator's chosen text size is restored on the next login from any booth. Additive
|
||||
-- ALTER ADD COLUMN — backward-compatible; existing users default to 100 (base). The client
|
||||
-- clamps to 80–160 in steps of 10. Printed tickets are unaffected (server-rendered).
|
||||
ALTER TABLE `users` ADD `font_scale` integer DEFAULT 100 NOT NULL;
|
||||
@@ -99,6 +99,13 @@
|
||||
"when": 1781885600000,
|
||||
"tag": "0013_anpr_entry_toggle",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 14,
|
||||
"version": "6",
|
||||
"when": 1781885700000,
|
||||
"tag": "0014_user_font_scale",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -73,6 +73,11 @@ export const users = sqliteTable("users", {
|
||||
theme: text("theme", { enum: ["dark", "light"] })
|
||||
.notNull()
|
||||
.default("dark"),
|
||||
// Preferred UI font scale (PERCENT of base, e.g. 100 = base, 120 = 20% larger).
|
||||
// Persisted like `theme` (read on login, restored from any booth). Integer percent
|
||||
// avoids float drift; the client clamps to 80–160 in steps of 10. Printed tickets are
|
||||
// unaffected (server-rendered).
|
||||
fontScale: integer("font_scale").notNull().default(100),
|
||||
// Optional operator profile metadata — display name + contact details. All
|
||||
// nullable; only username/password/role are required to create a user. fullName
|
||||
// (when set) is the human label for audit/Z-report display.
|
||||
|
||||
Reference in New Issue
Block a user