diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 748abe1..dfb3508 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1090,9 +1090,9 @@ } }, "node_modules/immutable": { - "version": "4.3.2", - "resolved": "https://registry.npmmirror.com/immutable/-/immutable-4.3.2.tgz", - "integrity": "sha512-oGXzbEDem9OOpDWZu88jGiYCvIsLHMvGw+8OXlpsvTFvIQplQbjg1B1cvKg8f7Hoch6+NGjpPsH1Fr+Mc2D1aA==" + "version": "4.3.3", + "resolved": "https://registry.npmmirror.com/immutable/-/immutable-4.3.3.tgz", + "integrity": "sha512-808ZFYMsIRAjLAu5xkKo0TsbY9LBy9H5MazTKIEHerNkg0ymgilGfBPMR/3G7d/ihGmuK2Hw8S1izY2d3kd3wA==" }, "node_modules/is-binary-path": { "version": "2.1.0", @@ -2720,9 +2720,9 @@ "dev": true }, "immutable": { - "version": "4.3.2", - "resolved": "https://registry.npmmirror.com/immutable/-/immutable-4.3.2.tgz", - "integrity": "sha512-oGXzbEDem9OOpDWZu88jGiYCvIsLHMvGw+8OXlpsvTFvIQplQbjg1B1cvKg8f7Hoch6+NGjpPsH1Fr+Mc2D1aA==" + "version": "4.3.3", + "resolved": "https://registry.npmmirror.com/immutable/-/immutable-4.3.3.tgz", + "integrity": "sha512-808ZFYMsIRAjLAu5xkKo0TsbY9LBy9H5MazTKIEHerNkg0ymgilGfBPMR/3G7d/ihGmuK2Hw8S1izY2d3kd3wA==" }, "is-binary-path": { "version": "2.1.0", diff --git a/frontend/src/App.vue b/frontend/src/App.vue index ed54e4f..5564445 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -11,11 +11,11 @@ import AddFieldsDialog from './components/dialogs/AddFieldsDialog.vue' import AppContent from './AppContent.vue' import GroupDialog from './components/dialogs/GroupDialog.vue' import DeleteKeyDialog from './components/dialogs/DeleteKeyDialog.vue' -import { computed, onBeforeMount, ref } from 'vue' +import { onMounted, ref, watch } from 'vue' import usePreferencesStore from './stores/preferences.js' import useConnectionStore from './stores/connections.js' import { useI18n } from 'vue-i18n' -import { darkTheme, lightTheme, useOsTheme } from 'naive-ui' +import { darkTheme } from 'naive-ui' import KeyFilterDialog from './components/dialogs/KeyFilterDialog.vue' import { WindowSetDarkTheme, WindowSetLightTheme } from 'wailsjs/runtime/runtime.js' import { themeOverrides } from '@/utils/theme.js' @@ -27,12 +27,10 @@ const prefStore = usePreferencesStore() const connectionStore = useConnectionStore() const i18n = useI18n() const initializing = ref(false) -onBeforeMount(async () => { +onMounted(async () => { try { initializing.value = true - await prefStore.loadPreferences() i18n.locale.value = prefStore.currentLanguage - await prefStore.loadFontList() await connectionStore.initConnections() if (prefStore.autoCheckUpdate) { prefStore.checkForUpdate() @@ -42,27 +40,17 @@ onBeforeMount(async () => { } }) -const osTheme = useOsTheme() -const theme = computed(() => { - if (prefStore.general.theme === 'auto') { - if (osTheme.value === 'dark') { - WindowSetDarkTheme() - return darkTheme - } - } else if (prefStore.general.theme === 'dark') { - WindowSetDarkTheme() - return darkTheme - } - WindowSetLightTheme() - return lightTheme -}) +watch( + () => prefStore.isDark, + (isDark) => (isDark ? WindowSetDarkTheme() : WindowSetLightTheme()), +)