aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/store/uiStore.ts
diff options
context:
space:
mode:
authorpacien2020-09-25 16:01:49 +0200
committerpacien2020-09-25 16:01:49 +0200
commite93f7b1eb84c083d67567115284c0002a3a7d5fc (patch)
tree8d373e8f7f571485e1330928f43b090ed004c525 /viewer/src/store/uiStore.ts
parent8e3ac8fe44bebb38e1882ca7f06b8100078ad88d (diff)
parentfd542f75a1d94ee5f804d0925823276b97f38581 (diff)
downloadldgallery-e93f7b1eb84c083d67567115284c0002a3a7d5fc.tar.gz
Merge branch 'develop' for release v2.0v2.0
Diffstat (limited to 'viewer/src/store/uiStore.ts')
-rw-r--r--viewer/src/store/uiStore.ts19
1 files changed, 16 insertions, 3 deletions
diff --git a/viewer/src/store/uiStore.ts b/viewer/src/store/uiStore.ts
index 892d35e..f065cdd 100644
--- a/viewer/src/store/uiStore.ts
+++ b/viewer/src/store/uiStore.ts
@@ -18,17 +18,18 @@
18*/ 18*/
19 19
20import { createModule, mutation, action } from "vuex-class-component"; 20import { createModule, mutation, action } from "vuex-class-component";
21import ItemComparators, { ItemSort } from "@/services/itemComparators";
21 22
22const VuexModule = createModule({ 23const VuexModule = createModule({
23 namespaced: "uiStore", 24 namespaced: "uiStore",
24 strict: true 25 strict: true,
25}) 26});
26 27
27export default class UIStore extends VuexModule { 28export default class UIStore extends VuexModule {
28
29 fullscreen: boolean = false; 29 fullscreen: boolean = false;
30 fullWidth: boolean = window.innerWidth < Number(process.env.VUE_APP_FULLWIDTH_LIMIT); 30 fullWidth: boolean = window.innerWidth < Number(process.env.VUE_APP_FULLWIDTH_LIMIT);
31 searchMode: boolean = false; 31 searchMode: boolean = false;
32 sort: ItemSort = ItemComparators.DEFAULT;
32 33
33 // --- 34 // ---
34 35
@@ -43,4 +44,16 @@ export default class UIStore extends VuexModule {
43 @mutation toggleSearchMode(value?: boolean) { 44 @mutation toggleSearchMode(value?: boolean) {
44 this.searchMode = value ?? !this.searchMode; 45 this.searchMode = value ?? !this.searchMode;
45 } 46 }
47
48 @mutation setSort(sort: ItemSort) {
49 this.sort = sort;
50 }
51
52 @action async initFromConfig(config: Gallery.Config) {
53 if (config.initialItemSort) {
54 const itemSort = ItemComparators.ITEM_SORTS[config.initialItemSort];
55 if (itemSort) this.setSort(itemSort);
56 else throw new Error("Unknown sort type: " + config.initialItemSort);
57 }
58 }
46} 59}