mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-21 06:11:45 +00:00
fix(login): address review feedback on language dropdown PR
- Fix import path: use i18n barrel instead of TranslationContext directly - Encapsulate localStorage key behind hasStoredLanguage() helper in settingsStore - Fix pt-BR detection: only map pt-BR to br, pt-PT now returns null correctly - Add comment linking server SUPPORTED_LANG_CODES to canonical client source - Extract /api/config inline handler to routes/publicConfig.ts - Add aria-haspopup, aria-expanded, role=listbox/option, aria-selected to dropdown - Add 8 tests for detectBrowserLanguage (FE-COMP-I18N-016–023) - Add 3 tests for setLanguageTransient (FE-STORE-SETTINGS-015–017)
This commit is contained in:
@@ -15,6 +15,11 @@ interface SettingsState {
|
||||
updateSettings: (settingsObj: Partial<Settings>) => Promise<void>
|
||||
}
|
||||
|
||||
// Returns true when the user has explicitly chosen a language (persisted in localStorage).
|
||||
// Use this instead of reading localStorage directly so the key stays encapsulated here.
|
||||
export const hasStoredLanguage = (): boolean =>
|
||||
typeof localStorage !== 'undefined' && !!localStorage.getItem('app_language')
|
||||
|
||||
export const useSettingsStore = create<SettingsState>((set, get) => ({
|
||||
settings: {
|
||||
map_tile_url: '',
|
||||
|
||||
Reference in New Issue
Block a user