Commit Graph

3 Commits

Author SHA1 Message Date
kovakmedya 971d8b0a58 feat: store user theme prefs in DB instead of Appwrite account.getPrefs
db: create user_preferences table (isletmem) — userId unique index,
    theme/colorTheme/tweakcnTheme/radius/sidebar* columns

- user-prefs-actions.ts: getUserPrefs (server-side read, plain object),
  saveUserPrefsAction (upsert by userId, Permission.user for row security)
- schema.ts: TABLES.userPreferences added
- layout.tsx: replace account.getPrefs+JSON.parse hack with getUserPrefs()
- dashboard-shell, prefs-initializer, theme-customizer: import UserPrefs
  type and saveUserPrefsAction instead of old saveThemePrefsAction
- theme-prefs-actions.ts: deleted (no remaining references)

Reason: account.updatePrefs is shared across all apps in the same Appwrite
project (İşletmem + Emlak share project 69f27b51). A dedicated per-app
table gives proper isolation, typed schema, and no prototype-object issues.
2026-05-08 17:48:31 +03:00
kovakmedya c307865a44 feat: persist theme prefs in localStorage for reliable same-device persistence
- Add src/lib/local-theme-prefs.ts: read/write color theme, radius, sidebar
  config to localStorage key 'isletmem-theme-prefs'
- ThemeCustomizer: init state from localStorage (falls back to Appwrite prefs),
  save to localStorage on every color/radius/sidebar change in addition to Appwrite
- PrefsInitializer: merge localStorage (wins) with server Appwrite prefs on mount

Appwrite updatePrefs had a silent try/catch so failures were invisible;
dark/light was already in localStorage via ThemeProvider but color theme was not.
2026-05-08 14:55:29 +03:00
kovakmedya 997cc393af feat: tema ayarları Appwrite user prefs ile kalıcı hale getirildi
- saveThemePrefsAction: account.updatePrefs ile mevcut prefs merge edilir
- Dashboard layout'ta account.getPrefs ile prefs server-side yüklenir
- PrefsInitializer: mount'ta dark/light, renk teması, radius, sidebar config Appwrite'dan uygulanır
- ThemeCustomizer: renk/tweakcn/radius değişikliği anında Appwrite'a kaydedilir; dark/light toggle useEffect ile izlenir
- Sayfa yenileme ve farklı cihazda giriş sonrasında ayarlar korunur
2026-05-07 22:26:40 +03:00