feat(ui): theme quick-toggle in the sidebar footer (LC-292) #324
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/lc-292-theme-quick-toggle"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
One-click theme toggle in the sidebar footer: flip light<->dark without opening Settings, persisted across reloads and devices.
Changes
server/templates/base.html:window.__lcToggleThemein the no-flash bootstrap. Reads the resolveddata-theme, flips dark<->light within the same contrast family (light<->dark,hc-light<->hc-dark), applies instantly via__lcSetTheme, and fire-and-forget POSTs to persist.server/src/routes/settings.rs:POST /settings/theme(post_theme,AuthUser-gated). Saves onlyusers.theme, returns 204, and stampsSet-Cookie: lc-theme=<v>; Max-Age=31536000; SameSite=Laxso the next navigation has no flash-of-old-theme. Invalid value falls back to "system" (no 500).server/src/routes/mod.rs: register the route.server/templates/partials/sidebar.html: footer buttondata-lc-theme-toggle.server/locales/{en,es}/partials.ftl:sidebar-toggle-theme(Toggle theme / Cambiar tema).High-contrast and system remain on the Settings appearance picker (the quick-toggle is the common case, not the full picker).
Testing
just check,just fmt,just test,just test-saasall pass.server/tests/routes_settings_theme.rs: valid theme persists + sets cookie; hc-dark accepted; invalid value falls back to system (no 500); unauthenticated POST 303s to /login.Not operator-visible (no env/config/contract change).