diff options
author | Zéro~Informatique | 2022-07-26 08:44:34 +0200 |
---|---|---|
committer | pacien | 2022-09-03 01:30:42 +0200 |
commit | 00510820a2794efcadbc83f7f8b54318fe198ecb (patch) | |
tree | a894d99c22a601197869c7a6928d40bb4ae2c392 /viewer/src/views/GallerySearch.vue | |
parent | 88aa098c07e067f9f737fbeba1f52a9bd5042e53 (diff) | |
download | ldgallery-00510820a2794efcadbc83f7f8b54318fe198ecb.tar.gz |
viewer: migrate to vue 3, general refactoring and cleanup
Non-exhaustive list of fixes and improvements done at the same time:
- html default background to grey (avoids white flash during init)
- unified links behavior
- added more theme variables
- removed the flex-expand transition (it wasn't working) and replaced it
with a slide
- fixed LdLoading not centered on the content
- title on removable tags
- fixed an issue with encoded URI from vue-router
- unified Item resource URLs
- removed the iframe for PlainTextViewer (it wasn't working properly)
and replaced it with a pre
- fixed clear and search buttons tabindex
- fixed the information panel bumping up during the fade animation of
tag's dropdown
- fixed some focus outlines not appearing correctly
- moved CSS variables to the :root context
- Code cleaning
GitHub: closes #217
GitHub: closes #300
GitHub: closes #297
GitHub: closes #105
GitHub: closes #267
GitHub: closes #275
GitHub: closes #228
GitHub: closes #215
GitHub: closes #112
Diffstat (limited to 'viewer/src/views/GallerySearch.vue')
-rw-r--r-- | viewer/src/views/GallerySearch.vue | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/viewer/src/views/GallerySearch.vue b/viewer/src/views/GallerySearch.vue index 5ab56e0..d148b9c 100644 --- a/viewer/src/views/GallerySearch.vue +++ b/viewer/src/views/GallerySearch.vue | |||
@@ -1,7 +1,7 @@ | |||
1 | <!-- ldgallery - A static generator which turns a collection of tagged | 1 | <!-- ldgallery - A static generator which turns a collection of tagged |
2 | -- pictures into a searchable web gallery. | 2 | -- pictures into a searchable web gallery. |
3 | -- | 3 | -- |
4 | -- Copyright (C) 2019-2020 Guillaume FOUET | 4 | -- Copyright (C) 2019-2022 Guillaume FOUET |
5 | -- | 5 | -- |
6 | -- This program is free software: you can redistribute it and/or modify | 6 | -- This program is free software: you can redistribute it and/or modify |
7 | -- it under the terms of the GNU Affero General Public License as | 7 | -- it under the terms of the GNU Affero General Public License as |
@@ -18,37 +18,39 @@ | |||
18 | --> | 18 | --> |
19 | 19 | ||
20 | <template> | 20 | <template> |
21 | <ld-gallery :items="items" :noresult="noResult" /> | 21 | <GalleryTiles |
22 | :items="items.filteredByPath" | ||
23 | :noresult-message="noResult" | ||
24 | /> | ||
22 | </template> | 25 | </template> |
23 | 26 | ||
24 | <script lang="ts"> | 27 | <script setup lang="ts"> |
25 | import IndexSearch from "@/services/indexsearch"; | 28 | import { useIndexSearch } from '@/services/indexSearch'; |
26 | import { Component, Prop, Vue } from "vue-property-decorator"; | 29 | import { useGalleryStore } from '@/store/galleryStore'; |
30 | import { useUiStore } from '@/store/uiStore'; | ||
31 | import { computed, onUnmounted } from 'vue'; | ||
32 | import { useI18n } from 'vue-i18n'; | ||
33 | import GalleryTiles from './GalleryTiles.vue'; | ||
27 | 34 | ||
28 | @Component | 35 | const { t } = useI18n(); |
29 | export default class GalleryPicture extends Vue { | 36 | const uiStore = useUiStore(); |
30 | @Prop(String) readonly path!: string; | 37 | const galleryStore = useGalleryStore(); |
31 | otherCount: number = 0; | 38 | const indexSearch = useIndexSearch(); |
32 | 39 | ||
33 | mounted() { | 40 | uiStore.toggleFullscreen(false); |
34 | this.$uiStore.toggleFullscreen(false); | 41 | uiStore.searchMode = true; |
35 | this.$uiStore.toggleSearchMode(true); | 42 | onUnmounted(() => { |
36 | } | 43 | uiStore.searchMode = false; |
44 | galleryStore.currentSearch = []; | ||
45 | }); | ||
37 | 46 | ||
38 | destroyed() { | 47 | const items = computed(() => { |
39 | this.$uiStore.toggleSearchMode(false); | 48 | const { currentPath, currentSearch } = galleryStore; |
40 | this.$galleryStore.setCurrentSearch([]); | 49 | if (!currentPath) return { searchResult: [], filteredByPath: [] }; |
41 | } | 50 | const searchResult = indexSearch(currentSearch); |
42 | 51 | const filteredByPath = searchResult.filter(item => item.path.startsWith(currentPath)); | |
43 | get items() { | 52 | return { searchResult, filteredByPath }; |
44 | const searchResult = IndexSearch.search(this.$galleryStore.currentSearch); | 53 | }); |
45 | const filteredByPath = searchResult.filter(item => item.path.startsWith(this.path)); | 54 | const otherCount = computed(() => items.value.searchResult.length - items.value.filteredByPath.length); |
46 | this.otherCount = searchResult.length - filteredByPath.length; | 55 | const noResult = computed(() => t('search.no-result-fmt', [otherCount.value])); |
47 | return filteredByPath; | ||
48 | } | ||
49 | |||
50 | get noResult() { | ||
51 | return this.$tc("search.no-result-fmt", this.otherCount, [this.otherCount]); | ||
52 | } | ||
53 | } | ||
54 | </script> | 56 | </script> |