From e6c2a8d9653ffde924632ca2f260c3a8cddc14ed Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Fri, 11 Sep 2020 00:15:04 +0200 Subject: viewer: item display order github: resolves #28 --- viewer/src/store/uiStore.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'viewer/src/store/uiStore.ts') 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 @@ */ import { createModule, mutation, action } from "vuex-class-component"; +import ItemSortFn from "@/services/itemSortFn"; const VuexModule = createModule({ namespaced: "uiStore", strict: true, }); +type TItemSortFn = (left: Gallery.Item, right: Gallery.Item) => number; + export default class UIStore extends VuexModule { fullscreen: boolean = false; fullWidth: boolean = window.innerWidth < Number(process.env.VUE_APP_FULLWIDTH_LIMIT); searchMode: boolean = false; + sortFn: TItemSortFn = ItemSortFn.sortByName; // --- @@ -42,4 +46,8 @@ export default class UIStore extends VuexModule { @mutation toggleSearchMode(value?: boolean) { this.searchMode = value ?? !this.searchMode; } + + @mutation setSortFn(sortFn: TItemSortFn) { + this.sortFn = sortFn; + } } -- cgit v1.2.3