diff options
author | Zero~Informatique | 2020-06-19 22:12:03 +0200 |
---|---|---|
committer | Zero~Informatique | 2020-06-19 22:12:03 +0200 |
commit | 69dc0d20706ed41e5ecdbb77515066d8a7d7703b (patch) | |
tree | 8b69fcb1d4a96290134980e75281563f8b4c271e /viewer/src/views | |
parent | a053076d692be5e3698fe1a2c071d077cb4b6b73 (diff) | |
download | ldgallery-69dc0d20706ed41e5ecdbb77515066d8a7d7703b.tar.gz |
viewer: code update (no functional change)
Types { [x: T]: R } updated to Record<T, R>
Methods in template updated to getters (computed in VueJS), which are reactive and cached
Code formatting
Diffstat (limited to 'viewer/src/views')
-rw-r--r-- | viewer/src/views/GalleryDirectory.vue | 4 | ||||
-rw-r--r-- | viewer/src/views/GallerySearch.vue | 6 | ||||
-rw-r--r-- | viewer/src/views/PanelLeft.vue | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/viewer/src/views/GalleryDirectory.vue b/viewer/src/views/GalleryDirectory.vue index 30f651c..bfe484e 100644 --- a/viewer/src/views/GalleryDirectory.vue +++ b/viewer/src/views/GalleryDirectory.vue | |||
@@ -18,7 +18,7 @@ | |||
18 | --> | 18 | --> |
19 | 19 | ||
20 | <template> | 20 | <template> |
21 | <ld-gallery :items="orderedItems()" :noresult="$t('directory.no-results')" /> | 21 | <ld-gallery :items="orderedItems" :noresult="$t('directory.no-results')" /> |
22 | </template> | 22 | </template> |
23 | 23 | ||
24 | <script lang="ts"> | 24 | <script lang="ts"> |
@@ -33,7 +33,7 @@ export default class GalleryDirectory extends Vue { | |||
33 | this.$uiStore.toggleFullscreen(false); | 33 | this.$uiStore.toggleFullscreen(false); |
34 | } | 34 | } |
35 | 35 | ||
36 | orderedItems() { | 36 | get orderedItems() { |
37 | return Navigation.directoriesFirst(this.directory.properties.items); | 37 | return Navigation.directoriesFirst(this.directory.properties.items); |
38 | } | 38 | } |
39 | } | 39 | } |
diff --git a/viewer/src/views/GallerySearch.vue b/viewer/src/views/GallerySearch.vue index dfaa5d3..4b98cea 100644 --- a/viewer/src/views/GallerySearch.vue +++ b/viewer/src/views/GallerySearch.vue | |||
@@ -18,7 +18,7 @@ | |||
18 | --> | 18 | --> |
19 | 19 | ||
20 | <template> | 20 | <template> |
21 | <ld-gallery :items="items()" :noresult="noResult()" /> | 21 | <ld-gallery :items="items" :noresult="noResult" /> |
22 | </template> | 22 | </template> |
23 | 23 | ||
24 | <script lang="ts"> | 24 | <script lang="ts"> |
@@ -41,14 +41,14 @@ export default class GalleryPicture extends Vue { | |||
41 | this.$galleryStore.setCurrentSearch([]); | 41 | this.$galleryStore.setCurrentSearch([]); |
42 | } | 42 | } |
43 | 43 | ||
44 | items() { | 44 | get items() { |
45 | const searchResult = IndexSearch.search(this.$galleryStore.currentSearch); | 45 | const searchResult = IndexSearch.search(this.$galleryStore.currentSearch); |
46 | const filteredByPath = searchResult.filter(item => item.path.startsWith(this.path)); | 46 | const filteredByPath = searchResult.filter(item => item.path.startsWith(this.path)); |
47 | this.otherCount = searchResult.length - filteredByPath.length; | 47 | this.otherCount = searchResult.length - filteredByPath.length; |
48 | return filteredByPath; | 48 | return filteredByPath; |
49 | } | 49 | } |
50 | 50 | ||
51 | noResult() { | 51 | get noResult() { |
52 | return this.$tc("search.no-result-fmt", this.otherCount, [this.otherCount]); | 52 | return this.$tc("search.no-result-fmt", this.otherCount, [this.otherCount]); |
53 | } | 53 | } |
54 | } | 54 | } |
diff --git a/viewer/src/views/PanelLeft.vue b/viewer/src/views/PanelLeft.vue index e3821a8..1d49648 100644 --- a/viewer/src/views/PanelLeft.vue +++ b/viewer/src/views/PanelLeft.vue | |||
@@ -34,7 +34,7 @@ | |||
34 | :show-category="$galleryStore.tagsCategories.length > 1" | 34 | :show-category="$galleryStore.tagsCategories.length > 1" |
35 | :search-filters.sync="searchFilters" | 35 | :search-filters.sync="searchFilters" |
36 | :tags-index="category.index" | 36 | :tags-index="category.index" |
37 | :current-tags="currentTags()" | 37 | :current-tags="currentTags" |
38 | /> | 38 | /> |
39 | </div> | 39 | </div> |
40 | </div> | 40 | </div> |
@@ -72,7 +72,7 @@ export default class PanelLeft extends Vue { | |||
72 | return query; | 72 | return query; |
73 | } | 73 | } |
74 | 74 | ||
75 | currentTags() { | 75 | get currentTags() { |
76 | return this.$galleryStore.currentItem?.tags ?? []; | 76 | return this.$galleryStore.currentItem?.tags ?? []; |
77 | } | 77 | } |
78 | 78 | ||