aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/store
diff options
context:
space:
mode:
Diffstat (limited to 'viewer/src/store')
-rw-r--r--viewer/src/store/galleryStore.ts8
-rw-r--r--viewer/src/store/index.ts16
-rw-r--r--viewer/src/store/uiStore.ts5
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
24const VuexModule = createModule({ 24const VuexModule = createModule({
25 namespaced: "galleryStore", 25 namespaced: "galleryStore",
26 strict: true 26 strict: true,
27}) 27});
28 28
29export default class GalleryStore extends VuexModule { 29export 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
20import Vue from "vue" 20import Vue from "vue";
21import Vuex from "vuex" 21import Vuex from "vuex";
22import { extractVuexModule } from "vuex-class-component"; 22import { extractVuexModule } from "vuex-class-component";
23import { createProxy } from "vuex-class-component"; 23import { createProxy } from "vuex-class-component";
24import UIStore from "@/store/uiStore"; 24import UIStore from "@/store/uiStore";
25import GalleryStore from "@/store/galleryStore"; 25import GalleryStore from "@/store/galleryStore";
26 26
27Vue.use(Vuex) 27Vue.use(Vuex);
28 28
29const store = new Vuex.Store({ 29const 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
37Vue.use((vue) => vue.prototype.$uiStore = createProxy(store, UIStore)); 37Vue.use(vue => (vue.prototype.$uiStore = createProxy(store, UIStore)));
38Vue.use((vue) => vue.prototype.$galleryStore = createProxy(store, GalleryStore)); 38Vue.use(vue => (vue.prototype.$galleryStore = createProxy(store, GalleryStore)));
39 39
40declare module "vue/types/vue" { 40declare 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
22const VuexModule = createModule({ 22const VuexModule = createModule({
23 namespaced: "uiStore", 23 namespaced: "uiStore",
24 strict: true 24 strict: true,
25}) 25});
26 26
27export default class UIStore extends VuexModule { 27export 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;