feat: default to the new mobile layout

Make the new mobile layout the default when no preference is stored, and
relabel the legacy 'default' option as Old (localized as Previous/older where
it reads better) while keeping its stored value for backwards compatibility.
This commit is contained in:
Bohdan Triapitsyn
2026-06-02 21:01:43 +03:00
parent 2cf87510da
commit 24e0c8d0c8
9 changed files with 13 additions and 11 deletions
@@ -3,18 +3,20 @@ export type MobileLayoutPreference = 'default' | 'new';
const MOBILE_LAYOUT_PREFERENCE_KEY = 'openchamber-mobile-layout';
export const normalizeMobileLayoutPreference = (value: unknown): MobileLayoutPreference => {
return value === 'new' ? 'new' : 'default';
// 'new' is the default; only an explicit 'default' (the legacy/"Old" layout)
// opts out of it.
return value === 'default' ? 'default' : 'new';
};
export const getStoredMobileLayoutPreference = (): MobileLayoutPreference => {
if (typeof window === 'undefined') {
return 'default';
return 'new';
}
try {
return normalizeMobileLayoutPreference(window.localStorage.getItem(MOBILE_LAYOUT_PREFERENCE_KEY));
} catch {
return 'default';
return 'new';
}
};