diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 12ba3f25..e8033275 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -10,7 +10,7 @@ todo: dark mode would be nice just for me and my eyes Add locale key Add persistence, local setting only Play around confirm colors are ok - - file list in attachment is incorrect + - file list in attachment is incorrect colors in dark todo: Are UTC filters really working properly? Check that a datafilter with dates incoming datetime ranges are either interpreted as UTC on route (from post formdata maybe, already know query params are NOT) diff --git a/ayanova/src/App.vue b/ayanova/src/App.vue index ef4aacc0..e7898100 100644 --- a/ayanova/src/App.vue +++ b/ayanova/src/App.vue @@ -276,14 +276,15 @@ export default { window.$gz.eventBus.$off(); }, mounted() { - // this.$vuetify.theme.dark = true; - this.$root.$gzconfirm = this.$refs.gzconfirm.open; - this.$root.$gznotify = this.$refs.gznotify.addNotification; + let vm = this; + vm.$vuetify.theme.dark = vm.$store.state.darkMode; + vm.$root.$gzconfirm = vm.$refs.gzconfirm.open; + vm.$root.$gznotify = vm.$refs.gznotify.addNotification; //weird bastardization thing //basically I want to access $gz in vue components where I can't access Window //this smells bad but it works - this.$root.$gz = window.$gz; + vm.$root.$gz = window.$gz; //Capture open object type and id if present //localhost:8080/login?type=2&id=22 @@ -304,8 +305,8 @@ export default { } //redirect to login if not authenticated - if (!this.$store.state.authenticated) { - this.$router.push("login"); + if (!vm.$store.state.authenticated) { + vm.$router.push("login"); } else { //this can be safely called any time, it checks if there is an open object in store and //opens it or if not just returns diff --git a/ayanova/src/store.js b/ayanova/src/store.js index 4d8c4e83..91732318 100644 --- a/ayanova/src/store.js +++ b/ayanova/src/store.js @@ -43,7 +43,8 @@ export default new Vuex.Store({ navItems: [], logArray: [], formSettings: {}, //this is the settings on forms that survive a refresh like grid number of items to show etc - formCustomTemplate: {} //this is the custom fields settings for forms + formCustomTemplate: {}, //this is the custom fields settings for forms, + darkMode: false }, mutations: { setLastClientVersion(state, data) { @@ -140,6 +141,9 @@ export default new Vuex.Store({ }, clearOpenObject(state) { state.openObject = null; + }, + setDarkMode(state, data) { + state.darkMode = data; } }, actions: {} diff --git a/ayanova/src/views/home-user-settings.vue b/ayanova/src/views/home-user-settings.vue index a6a8c603..4dbad1b2 100644 --- a/ayanova/src/views/home-user-settings.vue +++ b/ayanova/src/views/home-user-settings.vue @@ -165,7 +165,7 @@ export default { selectLists: { translations: [] }, - darkMode: false, + darkMode: this.$store.state.darkMode, obj: { /*concurrency": 7490431, "translationId": 1, @@ -235,6 +235,7 @@ export default { return window.$gz.form; }, darkModeChanged() { + this.$store.commit("setDarkMode", this.darkMode); this.$vuetify.theme.dark = this.darkMode; }, fieldValueChanged(ref) { @@ -438,7 +439,8 @@ function fetchTranslatedText(vm) { "UserEmailAddress", "Hour12", "UserColor", - "Translation" + "Translation", + "DarkMode" ]); }