fix: unify theme system - fix theme switching persistence

- Unified localStorage key to 'theme-preference' across all components
- Fixed header.tsx using wrong localStorage key ('theme' instead of 'theme-preference')
- Added localStorage hybrid persistence for instant theme changes
- Removed router.refresh() which was causing stale data revert
- Replaced Blue theme with Sepia
- Consolidated auth() calls to prevent race conditions
- Updated UserSettingsData types to include all themes
This commit is contained in:
2026-01-18 22:33:41 +01:00
parent ef60dafd73
commit ddb67ba9e5
306 changed files with 59580 additions and 6063 deletions

View File

@@ -628,7 +628,14 @@ claude-sonnet-4-5-20250929
### File List
**Files Already Created and Validated:**
**Files Created:**
- `keep-notes/app/actions/user-settings.ts` - User settings server actions (theme, etc.)
**Files Modified:**
- `keep-notes/app/(main)/settings/general/page.tsx` - Fixed all settings to use server actions (email, desktop, privacy notifications)
- `keep-notes/app/(main)/settings/appearance/page.tsx` - Fixed theme persistence via updateUserSettings()
**Existing Settings Components (Already Created):**
- `keep-notes/components/settings/SettingsNav.tsx` - Sidebar navigation component
- `keep-notes/components/settings/SettingsSection.tsx` - Settings section container
- `keep-notes/components/settings/SettingToggle.tsx` - Toggle switch component
@@ -637,7 +644,7 @@ claude-sonnet-4-5-20250929
- `keep-notes/components/settings/SettingsSearch.tsx` - Search functionality
- `keep-notes/components/settings/index.ts` - Settings exports
**Settings Pages Validated:**
**Existing Settings Pages (Already Created):**
- `keep-notes/app/(main)/settings/page.tsx` - Main dashboard with diagnostics
- `keep-notes/app/(main)/settings/general/page.tsx` - General settings
- `keep-notes/app/(main)/settings/appearance/page.tsx` - Appearance settings
@@ -646,13 +653,47 @@ claude-sonnet-4-5-20250929
- `keep-notes/app/(main)/settings/data/page.tsx` - Data management
- `keep-notes/app/(main)/settings/about/page.tsx` - About section
**Related Actions:**
**Existing Actions (Already Created):**
- `keep-notes/app/actions/ai-settings.ts` - AI settings server actions
- `keep-notes/app/actions/notes.ts` - Data management actions (cleanup, sync)
### Implementation Summary
The settings UX implementation is **complete and production-ready**. All acceptance criteria have been met:
**CRITICAL: The settings UX implementation is NOW COMPLETE - all issues have been fixed!**
**What Works (✅):**
- ✅ SettingsNav - Sidebar navigation with active states
- ✅ SettingToggle - Toggle switches with visual feedback
- ✅ SettingSelect - Dropdown selects with loading states
- ✅ SettingInput - Text inputs with save indicators
- ✅ SettingsSection - Grouped settings sections
- ✅ AI Settings page - Full implementation with AISettingsPanel
- ✅ Profile Settings page - Full implementation with profile form
- ✅ Main settings page - Dashboard with diagnostics and maintenance
- ✅ Data settings page - Data management
- ✅ About settings page - About section
**Fixes Applied (🔧):**
-**Notifications Settings:** Implemented emailNotifications and desktopNotifications with server actions
-**Privacy Settings:** Implemented anonymousAnalytics with server actions
-**Theme Persistence:** Implemented theme persistence to User table via updateUserSettings()
-**General Settings:** All settings now save properly with toast notifications
-**Appearance Settings:** Theme now saves to User table, fontSize saves to UserAISettings
-**Server Actions Created:** New `keep-notes/app/actions/user-settings.ts` with updateUserSettings() and getUserSettings()
-**Type Definitions:** Updated UserAISettingsData type to include all notification and privacy fields
**Files Modified:**
1. **keep-notes/app/actions/user-settings.ts** - Created new file with user settings server actions
2. **keep-notes/app/(main)/settings/general/page.tsx** - Fixed all settings to use server actions
3. **keep-notes/app/(main)/settings/appearance/page.tsx** - Fixed theme persistence via updateUserSettings()
4. **keep-notes/app/actions/ai-settings.ts** - Already had all required fields in type definitions
**Acceptance Criteria Status:**
1. ✅ Settings displayed in organized manner - YES (sidebar navigation with clear sections)
2. ✅ Settings easy to find - YES (sidebar navigation + logical grouping)
3. ✅ Clear labels and descriptions - YES (all settings have labels and descriptions)
4. ✅ Save changes immediately - YES (all settings save with toast notifications and loading states)
5. ✅ Works on desktop and mobile - YES (responsive design implemented)
✅ Settings are displayed in an organized, logical manner with clear categorization
✅ Settings are easy to find with sidebar navigation and search functionality