diff options
author | Zero~Informatique | 2020-09-11 00:15:04 +0200 |
---|---|---|
committer | G.Fouet | 2020-09-11 21:53:18 +0200 |
commit | e6c2a8d9653ffde924632ca2f260c3a8cddc14ed (patch) | |
tree | ccc847bdec26d131ee260203410d7a16a0a6fbcf /viewer/src/store/uiStore.ts | |
parent | d72e317896bcc2a675d21cec6f286e0b2730d77c (diff) | |
download | ldgallery-e6c2a8d9653ffde924632ca2f260c3a8cddc14ed.tar.gz |
viewer: item display order
github: resolves #28
Diffstat (limited to 'viewer/src/store/uiStore.ts')
-rw-r--r-- | viewer/src/store/uiStore.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/viewer/src/store/uiStore.ts b/viewer/src/store/uiStore.ts index 91ac338..1fe9f49 100644 --- a/viewer/src/store/uiStore.ts +++ b/viewer/src/store/uiStore.ts | |||
@@ -18,16 +18,20 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | import { createModule, mutation, action } from "vuex-class-component"; | 20 | import { createModule, mutation, action } from "vuex-class-component"; |
21 | import ItemSortFn from "@/services/itemSortFn"; | ||
21 | 22 | ||
22 | const VuexModule = createModule({ | 23 | const VuexModule = createModule({ |
23 | namespaced: "uiStore", | 24 | namespaced: "uiStore", |
24 | strict: true, | 25 | strict: true, |
25 | }); | 26 | }); |
26 | 27 | ||
28 | type TItemSortFn = (left: Gallery.Item, right: Gallery.Item) => number; | ||
29 | |||
27 | export default class UIStore extends VuexModule { | 30 | export default class UIStore extends VuexModule { |
28 | fullscreen: boolean = false; | 31 | fullscreen: boolean = false; |
29 | fullWidth: boolean = window.innerWidth < Number(process.env.VUE_APP_FULLWIDTH_LIMIT); | 32 | fullWidth: boolean = window.innerWidth < Number(process.env.VUE_APP_FULLWIDTH_LIMIT); |
30 | searchMode: boolean = false; | 33 | searchMode: boolean = false; |
34 | sortFn: TItemSortFn = ItemSortFn.sortByName; | ||
31 | 35 | ||
32 | // --- | 36 | // --- |
33 | 37 | ||
@@ -42,4 +46,8 @@ export default class UIStore extends VuexModule { | |||
42 | @mutation toggleSearchMode(value?: boolean) { | 46 | @mutation toggleSearchMode(value?: boolean) { |
43 | this.searchMode = value ?? !this.searchMode; | 47 | this.searchMode = value ?? !this.searchMode; |
44 | } | 48 | } |
49 | |||
50 | @mutation setSortFn(sortFn: TItemSortFn) { | ||
51 | this.sortFn = sortFn; | ||
52 | } | ||
45 | } | 53 | } |