diff options
Diffstat (limited to 'viewer/src/views/PanelTop.vue')
-rw-r--r-- | viewer/src/views/PanelTop.vue | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/viewer/src/views/PanelTop.vue b/viewer/src/views/PanelTop.vue new file mode 100644 index 0000000..eb8e6ed --- /dev/null +++ b/viewer/src/views/PanelTop.vue | |||
@@ -0,0 +1,67 @@ | |||
1 | <template> | ||
2 | <div v-if="isReady"> | ||
3 | <b-steps | ||
4 | v-model="activeStep" | ||
5 | class="pathBreadcrumb" | ||
6 | type="is-info" | ||
7 | :has-navigation="false" | ||
8 | :animated="false" | ||
9 | @input="onStepClick" | ||
10 | > | ||
11 | <b-step-item | ||
12 | v-for="item in $galleryStore.currentItemPath" | ||
13 | :key="item.path" | ||
14 | :label="item.title" | ||
15 | :icon="getIcon(item)" | ||
16 | :to="item.path" | ||
17 | /> | ||
18 | </b-steps> | ||
19 | </div> | ||
20 | </template> | ||
21 | |||
22 | <script lang="ts"> | ||
23 | import { Component, Vue, Prop, Watch } from "vue-property-decorator"; | ||
24 | import Gallery from "./Gallery.vue"; | ||
25 | |||
26 | @Component | ||
27 | export default class PanelTop extends Vue { | ||
28 | activeStep: number = -1; | ||
29 | |||
30 | mounted() { | ||
31 | this.currentItemPathChanged(); | ||
32 | } | ||
33 | |||
34 | get isReady() { | ||
35 | return this.activeStep >= 0; | ||
36 | } | ||
37 | |||
38 | @Watch("$galleryStore.currentItemPath") | ||
39 | currentItemPathChanged() { | ||
40 | this.activeStep = -1; | ||
41 | this.$nextTick(() => (this.activeStep = this.$galleryStore.currentItemPath.length - 1)); | ||
42 | } | ||
43 | |||
44 | getIcon(item: Gallery.Item) { | ||
45 | switch (item.properties.type) { | ||
46 | case "picture": | ||
47 | return "image"; | ||
48 | case "directory": | ||
49 | return "folder"; | ||
50 | } | ||
51 | } | ||
52 | |||
53 | onStepClick(index: number) { | ||
54 | const item = this.$galleryStore.currentItemPath[index]; | ||
55 | if (item) this.$router.push(item.path); | ||
56 | } | ||
57 | } | ||
58 | </script> | ||
59 | |||
60 | <style lang="scss"> | ||
61 | .pathBreadcrumb { | ||
62 | margin: 3px; | ||
63 | } | ||
64 | .step-title { | ||
65 | color: white; | ||
66 | } | ||
67 | </style> | ||