diff options
Diffstat (limited to 'viewer/src/store')
-rw-r--r-- | viewer/src/store/galleryStore.ts | 8 | ||||
-rw-r--r-- | viewer/src/store/index.ts | 16 | ||||
-rw-r--r-- | viewer/src/store/uiStore.ts | 5 |
3 files changed, 13 insertions, 16 deletions
diff --git a/viewer/src/store/galleryStore.ts b/viewer/src/store/galleryStore.ts index a57122c..5458f20 100644 --- a/viewer/src/store/galleryStore.ts +++ b/viewer/src/store/galleryStore.ts | |||
@@ -23,11 +23,10 @@ import Navigation from "@/services/navigation"; | |||
23 | 23 | ||
24 | const VuexModule = createModule({ | 24 | const VuexModule = createModule({ |
25 | namespaced: "galleryStore", | 25 | namespaced: "galleryStore", |
26 | strict: true | 26 | strict: true, |
27 | }) | 27 | }); |
28 | 28 | ||
29 | export default class GalleryStore extends VuexModule { | 29 | export default class GalleryStore extends VuexModule { |
30 | |||
31 | config: Gallery.Config | null = null; | 30 | config: Gallery.Config | null = null; |
32 | galleryIndex: Gallery.Index | null = null; | 31 | galleryIndex: Gallery.Index | null = null; |
33 | tagsIndex: Tag.Index = {}; | 32 | tagsIndex: Tag.Index = {}; |
@@ -65,8 +64,7 @@ export default class GalleryStore extends VuexModule { | |||
65 | 64 | ||
66 | get currentItemPath(): Gallery.Item[] { | 65 | get currentItemPath(): Gallery.Item[] { |
67 | const root = this.galleryIndex?.tree; | 66 | const root = this.galleryIndex?.tree; |
68 | if (root) | 67 | if (root) return Navigation.searchCurrentItemPath(root, this.currentPath); |
69 | return Navigation.searchCurrentItemPath(root, this.currentPath); | ||
70 | return []; | 68 | return []; |
71 | } | 69 | } |
72 | 70 | ||
diff --git a/viewer/src/store/index.ts b/viewer/src/store/index.ts index d5339e8..f86d66b 100644 --- a/viewer/src/store/index.ts +++ b/viewer/src/store/index.ts | |||
@@ -17,30 +17,30 @@ | |||
17 | -- along with this program. If not, see <https://www.gnu.org/licenses/>. | 17 | -- along with this program. If not, see <https://www.gnu.org/licenses/>. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | import Vue from "vue" | 20 | import Vue from "vue"; |
21 | import Vuex from "vuex" | 21 | import Vuex from "vuex"; |
22 | import { extractVuexModule } from "vuex-class-component"; | 22 | import { extractVuexModule } from "vuex-class-component"; |
23 | import { createProxy } from "vuex-class-component"; | 23 | import { createProxy } from "vuex-class-component"; |
24 | import UIStore from "@/store/uiStore"; | 24 | import UIStore from "@/store/uiStore"; |
25 | import GalleryStore from "@/store/galleryStore"; | 25 | import GalleryStore from "@/store/galleryStore"; |
26 | 26 | ||
27 | Vue.use(Vuex) | 27 | Vue.use(Vuex); |
28 | 28 | ||
29 | const store = new Vuex.Store({ | 29 | const store = new Vuex.Store({ |
30 | modules: { | 30 | modules: { |
31 | ...extractVuexModule(UIStore), | 31 | ...extractVuexModule(UIStore), |
32 | ...extractVuexModule(GalleryStore) | 32 | ...extractVuexModule(GalleryStore), |
33 | }, | 33 | }, |
34 | strict: process.env.NODE_ENV !== "production", | 34 | strict: process.env.NODE_ENV !== "production", |
35 | }); | 35 | }); |
36 | 36 | ||
37 | Vue.use((vue) => vue.prototype.$uiStore = createProxy(store, UIStore)); | 37 | Vue.use(vue => (vue.prototype.$uiStore = createProxy(store, UIStore))); |
38 | Vue.use((vue) => vue.prototype.$galleryStore = createProxy(store, GalleryStore)); | 38 | Vue.use(vue => (vue.prototype.$galleryStore = createProxy(store, GalleryStore))); |
39 | 39 | ||
40 | declare module "vue/types/vue" { | 40 | declare module "vue/types/vue" { |
41 | interface Vue { | 41 | interface Vue { |
42 | $uiStore: UIStore, | 42 | $uiStore: UIStore; |
43 | $galleryStore: GalleryStore | 43 | $galleryStore: GalleryStore; |
44 | } | 44 | } |
45 | } | 45 | } |
46 | 46 | ||
diff --git a/viewer/src/store/uiStore.ts b/viewer/src/store/uiStore.ts index 892d35e..91ac338 100644 --- a/viewer/src/store/uiStore.ts +++ b/viewer/src/store/uiStore.ts | |||
@@ -21,11 +21,10 @@ import { createModule, mutation, action } from "vuex-class-component"; | |||
21 | 21 | ||
22 | const VuexModule = createModule({ | 22 | const VuexModule = createModule({ |
23 | namespaced: "uiStore", | 23 | namespaced: "uiStore", |
24 | strict: true | 24 | strict: true, |
25 | }) | 25 | }); |
26 | 26 | ||
27 | export default class UIStore extends VuexModule { | 27 | export default class UIStore extends VuexModule { |
28 | |||
29 | fullscreen: boolean = false; | 28 | fullscreen: boolean = false; |
30 | fullWidth: boolean = window.innerWidth < Number(process.env.VUE_APP_FULLWIDTH_LIMIT); | 29 | fullWidth: boolean = window.innerWidth < Number(process.env.VUE_APP_FULLWIDTH_LIMIT); |
31 | searchMode: boolean = false; | 30 | searchMode: boolean = false; |