ux update

This commit is contained in:
beo3000 2026-02-20 22:34:53 +01:00
parent 6818c469f6
commit 80c7064666
1 changed files with 0 additions and 42 deletions

View File

@ -1,42 +0,0 @@
import { writable } from 'svelte/store';
export interface AppSettings {
showSnoozedTab: boolean;
}
const STORAGE_KEY = 'ka-note-settings';
const defaults: AppSettings = {
showSnoozedTab: true
};
function load(): AppSettings {
if (typeof localStorage === 'undefined') return defaults;
try {
const raw = localStorage.getItem(STORAGE_KEY);
return raw ? { ...defaults, ...JSON.parse(raw) } : defaults;
} catch {
return defaults;
}
}
function createSettingsStore() {
const { subscribe, set, update } = writable<AppSettings>(load());
subscribe(v => {
if (typeof localStorage !== 'undefined') {
localStorage.setItem(STORAGE_KEY, JSON.stringify(v));
}
});
return {
subscribe,
set,
update,
patch(partial: Partial<AppSettings>) {
update(s => ({ ...s, ...partial }));
}
};
}
export const settings = createSettingsStore();