Feature: App-Einstellungen in DB (preferred_theme neu, notes_ki+gassi_stunde schon drin) — geräteübergreifend sync (SW by-v785)
This commit is contained in:
parent
2ff6d4dfe4
commit
e8cf742911
8 changed files with 41 additions and 20 deletions
|
|
@ -315,9 +315,9 @@ window.Page_settings = (() => {
|
|||
font-size:var(--text-sm);
|
||||
font-family:inherit;
|
||||
cursor:pointer">
|
||||
<option value="system" ${(localStorage.getItem('by_theme')||'system') === 'system' ? 'selected' : ''}>System</option>
|
||||
<option value="light" ${localStorage.getItem('by_theme') === 'light' ? 'selected' : ''}>Hell</option>
|
||||
<option value="dark" ${localStorage.getItem('by_theme') === 'dark' ? 'selected' : ''}>Dunkel</option>
|
||||
<option value="system" ${(u.preferred_theme||localStorage.getItem('by_theme')||'system') === 'system' ? 'selected' : ''}>System</option>
|
||||
<option value="light" ${(u.preferred_theme||localStorage.getItem('by_theme')) === 'light' ? 'selected' : ''}>Hell</option>
|
||||
<option value="dark" ${(u.preferred_theme||localStorage.getItem('by_theme')) === 'dark' ? 'selected' : ''}>Dunkel</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
|
@ -849,22 +849,22 @@ window.Page_settings = (() => {
|
|||
}
|
||||
});
|
||||
|
||||
document.getElementById('select-theme')?.addEventListener('change', e => {
|
||||
document.getElementById('select-theme')?.addEventListener('change', async e => {
|
||||
const val = e.target.value;
|
||||
localStorage.setItem('by_theme', val);
|
||||
localStorage.setItem('by_theme', val); // lokaler Cache für schnellen Start
|
||||
const html = document.documentElement;
|
||||
if (val === 'dark') {
|
||||
html.setAttribute('data-theme', 'dark');
|
||||
} else if (val === 'light') {
|
||||
html.setAttribute('data-theme', 'light');
|
||||
} else {
|
||||
html.removeAttribute('data-theme');
|
||||
}
|
||||
if (val === 'dark') html.setAttribute('data-theme', 'dark');
|
||||
else if (val === 'light') html.setAttribute('data-theme', 'light');
|
||||
else html.removeAttribute('data-theme');
|
||||
UI.toast.info(
|
||||
val === 'dark' ? 'Dark Mode aktiviert.' :
|
||||
val === 'light' ? 'Hell-Modus aktiviert.' :
|
||||
'Theme folgt der Systemeinstellung.'
|
||||
);
|
||||
try {
|
||||
await API.patch('/profile', { preferred_theme: val });
|
||||
if (_appState?.user) _appState.user.preferred_theme = val;
|
||||
} catch { /* ignorieren — localStorage-Fallback greift */ }
|
||||
});
|
||||
|
||||
document.getElementById('toggle-pocket-mode')?.addEventListener('change', e => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue