diff --git a/src/client/app/boot.js b/src/client/app/boot.js index da1b64823f..7b884c8a54 100644 --- a/src/client/app/boot.js +++ b/src/client/app/boot.js @@ -18,6 +18,14 @@ return; } + //#region Load settings + let settings = null; + const vuex = localStorage.getItem('vuex'); + if (vuex) { + settings = JSON.parse(vuex); + } + //#endregion + // Get the current url information const url = new URL(location.href); @@ -35,10 +43,8 @@ // The default language is English if (!LANGS.includes(lang)) lang = 'en'; - const vuex = localStorage.getItem('vuex'); - if (vuex) { - const data = JSON.parse(vuex); - if (data.device.lang) lang = data.device.lang; + if (settings) { + if (settings.device.lang) lang = settings.device.lang; } //#endregion @@ -68,8 +74,10 @@ } // Dark/Light - if (localStorage.getItem('darkmode') == 'true') { - document.documentElement.setAttribute('data-darkmode', 'true'); + if (settings) { + if (settings.device.darkmode) { + document.documentElement.setAttribute('data-darkmode', 'true'); + } } // Script version diff --git a/src/client/app/desktop/views/components/settings.vue b/src/client/app/desktop/views/components/settings.vue index 3fe09b9acc..dac5fe67cb 100644 --- a/src/client/app/desktop/views/components/settings.vue +++ b/src/client/app/desktop/views/components/settings.vue @@ -227,8 +227,7 @@ export default Vue.extend({ version, langs, latestVersion: undefined, - checkingForUpdate: false, - darkmode: localStorage.getItem('darkmode') == 'true' + checkingForUpdate: false }; }, computed: { @@ -246,6 +245,11 @@ export default Vue.extend({ set(value) { this.$store.commit('device/set', { key: 'autoPopout', value }); } }, + darkmode: { + get() { return this.$store.state.device.darkmode; }, + set(value) { this.$store.commit('device/set', { key: 'darkmode', value }); } + }, + enableSounds: { get() { return this.$store.state.device.enableSounds; }, set(value) { this.$store.commit('device/set', { key: 'enableSounds', value }); } @@ -276,11 +280,6 @@ export default Vue.extend({ set(value) { this.$store.commit('device/set', { key: 'enableExperimentalFeatures', value }); } } }, - watch: { - darkmode() { - (this as any)._updateDarkmode_(this.darkmode); - } - }, created() { (this as any).os.getMeta().then(meta => { this.meta = meta; diff --git a/src/client/app/desktop/views/components/ui.header.account.vue b/src/client/app/desktop/views/components/ui.header.account.vue index fd15ea6006..f3f6539496 100644 --- a/src/client/app/desktop/views/components/ui.header.account.vue +++ b/src/client/app/desktop/views/components/ui.header.account.vue @@ -35,7 +35,7 @@ @@ -99,7 +99,10 @@ export default Vue.extend({ (this as any).os.signout(); }, dark() { - (this as any)._updateDarkmode_(!(this as any)._darkmode_); + this.$store.commit('device/set', { + key: 'darkmode', + value: !this.$store.state.device.darkmode + }); } } }); diff --git a/src/client/app/desktop/views/components/user-lists-window.vue b/src/client/app/desktop/views/components/user-lists-window.vue index 585c0a864f..454c725d20 100644 --- a/src/client/app/desktop/views/components/user-lists-window.vue +++ b/src/client/app/desktop/views/components/user-lists-window.vue @@ -2,7 +2,7 @@ %fa:list% リスト -
+
{{ list.title }}
diff --git a/src/client/app/desktop/views/pages/welcome.vue b/src/client/app/desktop/views/pages/welcome.vue index afa0a4810b..83c668a9cf 100644 --- a/src/client/app/desktop/views/pages/welcome.vue +++ b/src/client/app/desktop/views/pages/welcome.vue @@ -1,11 +1,11 @@ -
+