feat(phase3): import/export, sparklines, user theme overrides
- JSON import/export with conflict resolution (skip/overwrite) + admin UI - Ping history sparklines on AppWidget and AppCard (24h, 288 points) - Hourly cleanup job for old AppStatus records - User theme preferences (hue, saturation, mode, background, locale) - Settings page with ThemeCustomizer (sliders, toggles, live preview) - Prisma migration for user preference fields - i18n translations for all new strings (EN/RU)
This commit is contained in:
@@ -118,6 +118,30 @@ class ThemeStore {
|
||||
this.primaryHue = Math.max(0, Math.min(360, hue));
|
||||
this.primarySaturation = Math.max(0, Math.min(100, saturation));
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply non-null server-stored user preferences over localStorage defaults.
|
||||
* Call from +layout.svelte when user data is available.
|
||||
*/
|
||||
loadFromServer(prefs: {
|
||||
themeMode?: string | null;
|
||||
primaryHue?: number | null;
|
||||
primarySaturation?: number | null;
|
||||
backgroundType?: string | null;
|
||||
}) {
|
||||
if (prefs.themeMode != null) {
|
||||
this.mode = prefs.themeMode as ThemeMode;
|
||||
}
|
||||
if (prefs.primaryHue != null) {
|
||||
this.primaryHue = prefs.primaryHue;
|
||||
}
|
||||
if (prefs.primarySaturation != null) {
|
||||
this.primarySaturation = prefs.primarySaturation;
|
||||
}
|
||||
if (prefs.backgroundType != null) {
|
||||
this.backgroundType = prefs.backgroundType as BackgroundType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const theme = new ThemeStore();
|
||||
|
||||
Reference in New Issue
Block a user