fix(theme): white icon glyphs on solid tiles + single theme storage key

Two issues:

1. Icon badges read as a coloured glyph on a same-hue LIGHT tile
   (bgcolor X.light + color X.main) — low contrast, "badly visible".
   The AttendanceHistory month tile and the Dashboard 2FA-banner icon now
   use a SOLID tile (X.main) + white glyph, matching the StatCard badge
   convention. Readable in both schemes (verified: info.main #1d4ed8 light
   / #3b82f6 dark, error.main, white glyph).

2. Theme reverted to light on F5 while the toggle still showed dark.
   Cause: two independent stores — our ThemeContext key (boha-theme) and
   MUI's own cssVariables mode key (mui-mode). The toggle only wrote
   boha-theme, so on mount MUI restored its stale mui-mode and overrode
   data-theme. Collapsed to a SINGLE source of truth: ThemeContext now
   reads/writes MUI's `mui-mode` key directly (with a one-time migration
   from the legacy boha-theme, which is then removed). Verified: toggle
   dark -> F5 -> stays dark; only `mui-mode` remains in localStorage.

tsc -b --noEmit, npm run build, vitest 152/152 clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-06-07 18:12:20 +02:00
parent 8e7ab9158c
commit 27c690285a
3 changed files with 14 additions and 9 deletions

View File

@@ -540,8 +540,8 @@ export default function AttendanceHistory() {
width: 44,
height: 44,
borderRadius: 2,
bgcolor: "info.light",
color: "info.main",
bgcolor: "info.main",
color: "#fff",
flexShrink: 0,
}}
>

View File

@@ -260,8 +260,8 @@ export default function Dashboard() {
display: "flex",
alignItems: "center",
justifyContent: "center",
bgcolor: "error.light",
color: "error.main",
bgcolor: "error.main",
color: "#fff",
flexShrink: 0,
}}
>