diff options
Diffstat (limited to 'viewer/src/components')
-rw-r--r-- | viewer/src/components/LdCommandSort.vue | 13 | ||||
-rw-r--r-- | viewer/src/components/LdGallery.vue | 2 |
2 files changed, 7 insertions, 8 deletions
diff --git a/viewer/src/components/LdCommandSort.vue b/viewer/src/components/LdCommandSort.vue index 30644c1..cfaa5c1 100644 --- a/viewer/src/components/LdCommandSort.vue +++ b/viewer/src/components/LdCommandSort.vue | |||
@@ -23,8 +23,8 @@ | |||
23 | <a slot="trigger" class="link"> | 23 | <a slot="trigger" class="link"> |
24 | <fa-icon icon="sort-amount-down" size="lg" /> | 24 | <fa-icon icon="sort-amount-down" size="lg" /> |
25 | </a> | 25 | </a> |
26 | <b-dropdown-item v-for="(sort, idx) in ITEM_SORTS" :key="idx" :value="idx"> | 26 | <b-dropdown-item v-for="(sort, idx) in ITEM_SORTS" :key="idx" :value="sort"> |
27 | <fa-icon :icon="['far', idx === selectedSort ? 'dot-circle' : 'circle']" /> | 27 | <fa-icon :icon="['far', sort === selectedSort ? 'dot-circle' : 'circle']" /> |
28 | <span :class="$style.dropdownLabel">{{ sort.text }}</span> | 28 | <span :class="$style.dropdownLabel">{{ sort.text }}</span> |
29 | </b-dropdown-item> | 29 | </b-dropdown-item> |
30 | </b-dropdown> | 30 | </b-dropdown> |
@@ -32,19 +32,18 @@ | |||
32 | 32 | ||
33 | <script lang="ts"> | 33 | <script lang="ts"> |
34 | import { Component, Vue, Prop } from "vue-property-decorator"; | 34 | import { Component, Vue, Prop } from "vue-property-decorator"; |
35 | import { RawLocation } from "vue-router"; | 35 | import ItemComparators, { ItemSort } from "@/services/itemComparators"; |
36 | import ItemComparators, { ItemComparator } from "@/services/itemComparators"; | ||
37 | 36 | ||
38 | @Component | 37 | @Component |
39 | export default class LdCommandSort extends Vue { | 38 | export default class LdCommandSort extends Vue { |
40 | readonly ITEM_SORTS = ItemComparators.ITEM_SORTS; | 39 | readonly ITEM_SORTS = ItemComparators.ITEM_SORTS; |
41 | 40 | ||
42 | get selectedSort() { | 41 | get selectedSort() { |
43 | return this.ITEM_SORTS.map(s => s.fn).indexOf(this.$uiStore.sortFn); | 42 | return this.$uiStore.sort; |
44 | } | 43 | } |
45 | 44 | ||
46 | set selectedSort(newValue: number) { | 45 | set selectedSort(newValue: ItemSort) { |
47 | this.$uiStore.setSortFn(this.ITEM_SORTS[newValue].fn); | 46 | this.$uiStore.setSort(newValue); |
48 | } | 47 | } |
49 | } | 48 | } |
50 | </script> | 49 | </script> |
diff --git a/viewer/src/components/LdGallery.vue b/viewer/src/components/LdGallery.vue index 0c0a43c..edd479c 100644 --- a/viewer/src/components/LdGallery.vue +++ b/viewer/src/components/LdGallery.vue | |||
@@ -36,7 +36,7 @@ export default class LdPicture extends Vue { | |||
36 | @Prop(String) readonly noresult?: string; | 36 | @Prop(String) readonly noresult?: string; |
37 | 37 | ||
38 | get sortedItems() { | 38 | get sortedItems() { |
39 | return this.items.sort(this.$uiStore.sortFn); | 39 | return this.items.sort(this.$uiStore.sort.fn); |
40 | } | 40 | } |
41 | 41 | ||
42 | get hasNoResults(): boolean { | 42 | get hasNoResults(): boolean { |