Update SettingsPage to replace notifications with language preference

Replaced the deprecated notifications option with a language selector in `SettingsPage`. Updated localStorage parsing to strip deprecated fields and added UI support for the new language preference.
This commit is contained in:
2025-11-22 22:16:24 -04:00
parent 86d5ffea86
commit 48505fe3b5

View File

@@ -5,7 +5,7 @@ import '../../styles/components.css';
const DEFAULT_SETTINGS = {
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC',
theme: 'light',
notifications: true,
language: 'es',
apiBaseUrl: ''
};
@@ -14,7 +14,9 @@ const loadSettings = () => {
const raw = localStorage.getItem('app_settings');
if (!raw) return DEFAULT_SETTINGS;
const parsed = JSON.parse(raw);
return { ...DEFAULT_SETTINGS, ...parsed };
// Strip deprecated fields like 'notifications' if present in older storage
const { notifications, ...rest } = parsed || {};
return { ...DEFAULT_SETTINGS, ...rest };
} catch {
return DEFAULT_SETTINGS;
}
@@ -99,15 +101,11 @@ const SettingsPage = () => {
</div>
<div className="form-group">
<label className="checkbox">
<input
type="checkbox"
name="notifications"
checked={settings.notifications}
onChange={handleChange}
/>
Habilitar notificaciones
</label>
<label htmlFor="language">Idioma</label>
<select id="language" name="language" value={settings.language} onChange={handleChange}>
<option value="es">Español</option>
<option value="en">English</option>
</select>
</div>
<div className="form-group" style={{ gridColumn: '1 / -1' }}>