fix: frontend UX improvements (SSE status, responsive tables, dark mode, login toggle, theme)
- Add SSE connection status banner showing when real-time updates are lost (UX-H8, UX-M1) - Add password visibility toggle on login page (UX-H10) - Add dark mode variants to stat card backgrounds (UX-M11) - Add overflow-x-auto to tables for mobile responsiveness (UX-H9) - Add flex-wrap to stage header for mobile overflow (UX-H11) - Fix theme store system preference listener reactivity (UX-M12) - Parallelize registry health checks (UX-L4)
This commit is contained in:
@@ -26,16 +26,30 @@ themeMode.subscribe((value) => {
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Tracks system color-scheme preference changes so that the derived store
|
||||
* re-evaluates when the OS theme changes while mode is 'system'.
|
||||
*/
|
||||
const systemDark = writable(
|
||||
typeof window !== 'undefined'
|
||||
? window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
: false
|
||||
);
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
const mq = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
mq.addEventListener('change', (e) => {
|
||||
systemDark.set(e.matches);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolved theme based on mode and system preference.
|
||||
* Returns 'light' or 'dark'.
|
||||
*/
|
||||
export const resolvedTheme = derived(themeMode, ($mode) => {
|
||||
export const resolvedTheme = derived([themeMode, systemDark], ([$mode, $dark]) => {
|
||||
if ($mode === 'system') {
|
||||
if (typeof window !== 'undefined') {
|
||||
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
||||
}
|
||||
return 'light';
|
||||
return $dark ? 'dark' : 'light';
|
||||
}
|
||||
return $mode;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user