diff options
Diffstat (limited to 'viewer/src/views')
-rw-r--r-- | viewer/src/views/GalleryNavigation.vue | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/viewer/src/views/GalleryNavigation.vue b/viewer/src/views/GalleryNavigation.vue index 7c6d11b..08c8218 100644 --- a/viewer/src/views/GalleryNavigation.vue +++ b/viewer/src/views/GalleryNavigation.vue | |||
@@ -18,18 +18,14 @@ | |||
18 | --> | 18 | --> |
19 | 19 | ||
20 | <template> | 20 | <template> |
21 | <!-- TODO: eliminate intermediate div --> | ||
21 | <div> | 22 | <div> |
22 | <gallery-search v-if="query.length" :path="path" /> | 23 | <component :is="dispatch().component" v-bind="dispatch().properties" /> |
23 | <gallery-directory v-else-if="checkType('directory')" :directory="$galleryStore.currentItem" /> | ||
24 | <ld-picture v-else-if="checkType('picture')" :picture="$galleryStore.currentItem" /> | ||
25 | <div v-else>{{$t("gallery.unknowntype")}}</div> | ||
26 | </div> | 24 | </div> |
27 | </template> | 25 | </template> |
28 | 26 | ||
29 | <script lang="ts"> | 27 | <script lang="ts"> |
30 | import { Component, Vue, Prop, Watch } from "vue-property-decorator"; | 28 | import { Component, Vue, Prop, Watch } from "vue-property-decorator"; |
31 | import { Operation } from "@/@types/Operation"; | ||
32 | import Navigation from "@/services/navigation"; | ||
33 | import GalleryDirectory from "./GalleryDirectory.vue"; | 29 | import GalleryDirectory from "./GalleryDirectory.vue"; |
34 | import GallerySearch from "@/views/GallerySearch.vue"; | 30 | import GallerySearch from "@/views/GallerySearch.vue"; |
35 | 31 | ||
@@ -52,8 +48,28 @@ export default class GalleryNavigation extends Vue { | |||
52 | this.$galleryStore.setCurrentPath(this.path); | 48 | this.$galleryStore.setCurrentPath(this.path); |
53 | } | 49 | } |
54 | 50 | ||
55 | private checkType(type: Gallery.ItemType): boolean { | 51 | dispatch(): { component: string, properties: {} } { |
56 | return Navigation.checkType(this.$galleryStore.currentItem, type); | 52 | switch (this.$galleryStore.currentItem?.properties.type ?? null) { |
53 | case null: | ||
54 | return { | ||
55 | component: "ld-error", | ||
56 | properties: { icon: "folder-open", message: this.$t("gallery.unknown-resource") } | ||
57 | }; | ||
58 | |||
59 | case "directory": | ||
60 | return this.query.length > 0 | ||
61 | ? { component: "gallery-search", properties: { path: this.path } } | ||
62 | : { component: "gallery-directory", properties: { directory: this.$galleryStore.currentItem } }; | ||
63 | |||
64 | case "picture": | ||
65 | return { component: "ld-picture", properties: { picture: this.$galleryStore.currentItem } }; | ||
66 | |||
67 | default: | ||
68 | return { | ||
69 | component: "ld-error", | ||
70 | properties: { icon: "file", message: this.$t("gallery.unknown-type") } | ||
71 | }; | ||
72 | } | ||
57 | } | 73 | } |
58 | } | 74 | } |
59 | </script> | 75 | </script> |