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:
2026-03-25 00:51:01 +03:00
parent d155b3ce4a
commit c6a7de895d
30 changed files with 1633 additions and 44 deletions
+24
View File
@@ -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();