aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/views/GallerySearch.vue
diff options
context:
space:
mode:
authorZero~Informatique2020-02-14 09:19:53 +0100
committerZero~Informatique2020-02-24 00:04:39 +0100
commit370e3db3455f548699ff5e046e0f8dcc304991ac (patch)
treee29fe9e2afb940eea74c8ed510c46a1eb0fa4d84 /viewer/src/views/GallerySearch.vue
parente42f4e864bac21ed3b19d1869df2cdd4f8c3433c (diff)
downloadldgallery-370e3db3455f548699ff5e046e0f8dcc304991ac.tar.gz
viewer: major code and search mode overhaul
Updated libraries to the lastest version SCSS Formatter as suggested VSC extensions Renamed toolbar-color by scrollbar-color LD components use Props in favor of touching the stores directly (when possible) Moved most common algorithms to a "services" folder Complete search overhaul (lots of code change)
Diffstat (limited to 'viewer/src/views/GallerySearch.vue')
-rw-r--r--viewer/src/views/GallerySearch.vue36
1 files changed, 26 insertions, 10 deletions
diff --git a/viewer/src/views/GallerySearch.vue b/viewer/src/views/GallerySearch.vue
index 97c5c66..eacbcdd 100644
--- a/viewer/src/views/GallerySearch.vue
+++ b/viewer/src/views/GallerySearch.vue
@@ -18,25 +18,41 @@
18--> 18-->
19 19
20<template> 20<template>
21 <div class="thumbnail-tiles"> 21 <ld-gallery :items="items()" :noresult="$t('search.no-results')" />
22 <div v-for="(item) in items" :key="item.path">
23 <router-link :to="item.path" @click.native="$uiStore.setModeNavigation()">
24 <ld-thumbnail :item="item" />
25 </router-link>
26 </div>
27 <div v-if="items.length===0">{{$t('search.no-results')}}</div>
28 </div>
29</template> 22</template>
30 23
31<script lang="ts"> 24<script lang="ts">
32import { Component, Vue, Prop } from "vue-property-decorator"; 25import { Component, Vue, Prop, Watch } from "vue-property-decorator";
26import { Operation } from "@/@types/Operation";
27import IndexSearch from "@/services/indexsearch";
28import IndexFactory from "../services/indexfactory";
33 29
34@Component 30@Component
35export default class GalleryPicture extends Vue { 31export default class GalleryPicture extends Vue {
36 @Prop({ required: true }) readonly items!: Gallery.Item[]; 32 @Prop(String) readonly path!: string;
33 @Prop(Array) readonly query!: string[];
34
35 currentSearch: Tag.Search[] = [];
37 36
38 mounted() { 37 mounted() {
39 this.$uiStore.fullscreen = false; 38 this.$uiStore.fullscreen = false;
39 this.$uiStore.searchMode = true;
40 this.restoreSearchFilters();
41 }
42
43 destroyed() {
44 this.$uiStore.searchMode = false;
45 }
46
47 items() {
48 return IndexSearch.search(this.currentSearch, this.path);
49 }
50
51 @Watch("query")
52 restoreSearchFilters() {
53 const tagsIndex = this.$galleryStore.tagsIndex;
54 this.currentSearch = this.query.flatMap(filter => IndexFactory.searchTags(tagsIndex, filter));
55 this.$uiStore.searchFilters = [...this.currentSearch];
40 } 56 }
41} 57}
42</script> 58</script>