c6a7de895d
- 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)
32 lines
2.1 KiB
Markdown
32 lines
2.1 KiB
Markdown
# Feature Context: Phase 3 — Advanced Features
|
|
|
|
## Current State
|
|
Phase 2 is complete and merged. 176 tests, full build passes. Phase 3 in progress. Phase 1 (Import/Export), Phase 2 (Sparklines), and Phase 3 (User Theme Overrides) are complete.
|
|
|
|
### Phase 1 (Import/Export) Summary
|
|
exportService, importService, admin API endpoints, ImportExportPanel UI, Zod validation schema, i18n EN/RU translations.
|
|
|
|
### Phase 2 (Sparklines) Summary
|
|
- History API at `/api/apps/[id]/history` — returns last 288 status records with uptime percentage
|
|
- `SparklineChart.svelte` — inline SVG bar chart with color-coded status bars (green/red/yellow/gray)
|
|
- `AppWidget.svelte` and `AppCard.svelte` updated to fetch and display sparklines on mount
|
|
- `pruneOldStatuses()` in healthcheck service — deletes records >24h, caps at 288 per app
|
|
- Hourly cleanup cron job in healthcheck scheduler
|
|
- i18n keys: `app.uptime`, `app.history_loading` (EN/RU)
|
|
|
|
### Phase 3 (User Theme Overrides) Summary
|
|
- Prisma migration: added `themeMode`, `primaryHue`, `primarySaturation`, `backgroundType`, `locale` nullable fields to User model
|
|
- Preferences API at `/api/users/me/preferences` — GET returns preferences, PATCH updates subset
|
|
- Settings page at `/settings` with `ThemeCustomizer.svelte` — hue/saturation sliders, mode toggle (dark/light/system), background selector, locale picker, save button
|
|
- Theme store `loadFromServer(prefs)` method applies server preferences over localStorage defaults
|
|
- `+layout.server.ts` passes `userPreferences` in layout data; `+layout.svelte` applies them on mount
|
|
- Header user menu includes "Settings" link
|
|
- i18n keys: `settings.title`, `settings.theme`, `settings.primary_color`, `settings.hue`, `settings.saturation`, `settings.background`, `settings.language`, `settings.save`, `settings.saving`, `settings.saved` (EN/RU)
|
|
|
|
## Cross-Phase Dependencies
|
|
- Phases 1-3 are independent (import/export, sparklines, user themes)
|
|
- Phase 4 (PWA) is independent
|
|
- Phase 5 (auto-discovery) is independent
|
|
- Phase 6 (bookmarklet/sync) depends on existing API
|
|
- Phase 7 (integration) depends on all prior phases
|