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/components/LdGallery.vue | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'viewer/src/components/LdGallery.vue')

diff --git a/viewer/src/components/LdGallery.vue b/viewer/src/components/LdGallery.vue
index 5a72d99..0c0a43c 100644
--- a/viewer/src/components/LdGallery.vue
+++ b/viewer/src/components/LdGallery.vue
@@ -20,7 +20,7 @@
 <template>
   <ld-error v-if="hasNoResults" icon="search" :message="noresult" />
   <div v-else class="thumbnail-tiles">
-    <router-link v-for="item in items" :key="item.path" :to="item.path">
+    <router-link v-for="item in sortedItems" :key="item.path" :to="item.path">
       <ld-thumbnail :item="item" />
     </router-link>
   </div>
@@ -35,6 +35,10 @@ export default class LdPicture extends Vue {
   @Prop({ type: Array, required: true }) readonly items!: Gallery.Item[];
   @Prop(String) readonly noresult?: string;
 
+  get sortedItems() {
+    return this.items.sort(this.$uiStore.sortFn);
+  }
+
   get hasNoResults(): boolean {
     return Boolean(this.noresult) && this.items.length === 0;
   }
-- 
cgit v1.2.3

