feat: settings dialog and moved theme settings to dialog from sidebar (#570)

* feat: settings dialog and moved theme settings to dialog from sidebar.

* chore(locale): move some labels to settings from sidebar
This commit is contained in:
Shinji Yamada authored and GitHub committed 2023-04-18 08:23:42 -06:00
1 parent 836c24680b
commit ba1dacb899
42 files changed
+259 -69

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
import { Settings } from '@/types/settings';
const STORAGE_KEY = 'settings';
export const getSettings = (): Settings => {
let settings: Settings = {
theme: 'dark',
};
const settingsJson = localStorage.getItem(STORAGE_KEY);
if (settingsJson) {
try {
let savedSettings = JSON.parse(settingsJson) as Settings;
settings = Object.assign(settings, savedSettings);
} catch (e) {
console.error(e);
}
}
return settings;
};
export const saveSettings = (settings: Settings) => {
localStorage.setItem(STORAGE_KEY, JSON.stringify(settings));
};