fix(portal): remember theme choice and restore light as default
Stop the one-time force-dark migration from overriding users, default first visits to light, and roll forced-dark browsers back to light once. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,18 +3,24 @@
|
||||
|
||||
const THEME_STORAGE_KEY = 'memind-theme';
|
||||
const THEME_MIGRATION_KEY = 'memind-theme-migration';
|
||||
const THEME_MIGRATION_VERSION = 'dark-default-2026-09-11';
|
||||
const THEME_MIGRATION_VERSION = 'light-default-2026-09-12';
|
||||
const FORCE_DARK_MIGRATION_VERSION = 'dark-default-2026-09-11';
|
||||
const DEFAULT_THEME = 'light';
|
||||
|
||||
function migrateThemePreferenceIfNeeded() {
|
||||
if (localStorage.getItem(THEME_MIGRATION_KEY) === THEME_MIGRATION_VERSION) return;
|
||||
localStorage.setItem(THEME_STORAGE_KEY, 'dark');
|
||||
const previousMigration = localStorage.getItem(THEME_MIGRATION_KEY);
|
||||
const stored = localStorage.getItem(THEME_STORAGE_KEY);
|
||||
if (previousMigration === FORCE_DARK_MIGRATION_VERSION && stored !== 'light') {
|
||||
localStorage.setItem(THEME_STORAGE_KEY, 'light');
|
||||
}
|
||||
localStorage.setItem(THEME_MIGRATION_KEY, THEME_MIGRATION_VERSION);
|
||||
}
|
||||
|
||||
function getStoredTheme() {
|
||||
const stored = localStorage.getItem(THEME_STORAGE_KEY);
|
||||
if (stored === 'dark' || stored === 'light') return stored;
|
||||
return 'dark';
|
||||
return DEFAULT_THEME;
|
||||
}
|
||||
|
||||
function applyTheme(theme) {
|
||||
|
||||
Reference in New Issue
Block a user