diff options
author | Notkea | 2020-01-31 18:09:33 +0100 |
---|---|---|
committer | GitHub | 2020-01-31 18:09:33 +0100 |
commit | 245fee3fe5abdc6ad14513ef6522446aba4c905a (patch) | |
tree | 749ec466c404499f19d571834262b87c14f0d0af /viewer/src/components | |
parent | d94b987463169b254ab69a79ddb58e5beccb0941 (diff) | |
parent | be8ec3edaed843f08dac3d2bf2f10f7247ef3d3a (diff) | |
download | ldgallery-245fee3fe5abdc6ad14513ef6522446aba4c905a.tar.gz |
Merge pull request #68 from pacien/oz-viewer
Diffstat (limited to 'viewer/src/components')
-rw-r--r-- | viewer/src/components/LdBreadcrumb.vue | 58 | ||||
-rw-r--r-- | viewer/src/components/LdCommand.vue | 74 | ||||
-rw-r--r-- | viewer/src/components/LdPicture.vue | 119 | ||||
-rw-r--r-- | viewer/src/components/LdProposition.vue | 10 | ||||
-rw-r--r-- | viewer/src/components/LdTagInput.vue | 6 | ||||
-rw-r--r-- | viewer/src/components/LdThumbnail.vue | 81 |
6 files changed, 341 insertions, 7 deletions
diff --git a/viewer/src/components/LdBreadcrumb.vue b/viewer/src/components/LdBreadcrumb.vue new file mode 100644 index 0000000..8c5b7eb --- /dev/null +++ b/viewer/src/components/LdBreadcrumb.vue | |||
@@ -0,0 +1,58 @@ | |||
1 | <!-- ldgallery - A static generator which turns a collection of tagged | ||
2 | -- pictures into a searchable web gallery. | ||
3 | -- | ||
4 | -- Copyright (C) 2019-2020 Guillaume FOUET | ||
5 | -- | ||
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 | ||
8 | -- published by the Free Software Foundation, either version 3 of the | ||
9 | -- License, or (at your option) any later version. | ||
10 | -- | ||
11 | -- This program is distributed in the hope that it will be useful, | ||
12 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | -- GNU Affero General Public License for more details. | ||
15 | -- | ||
16 | -- You should have received a copy of the GNU Affero General Public License | ||
17 | -- along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
18 | --> | ||
19 | |||
20 | <template> | ||
21 | <ul class="ld-breadcrumb"> | ||
22 | <li v-for="(item,idx) in $galleryStore.currentItemPath" :key="item.path"> | ||
23 | <router-link :to="item.path"> | ||
24 | <fa-icon :icon="getIcon(item)" size="lg" /> | ||
25 | {{item.title}} | ||
26 | </router-link> | ||
27 | <fa-icon v-if="(idx+1) < $galleryStore.currentItemPath.length" icon="angle-right" /> | ||
28 | </li> | ||
29 | </ul> | ||
30 | </template> | ||
31 | |||
32 | <script lang="ts"> | ||
33 | import { Component, Vue } from "vue-property-decorator"; | ||
34 | import Tools from "@/tools"; | ||
35 | |||
36 | @Component | ||
37 | export default class LdBreadcrumb extends Vue { | ||
38 | getIcon(item: Gallery.Item) { | ||
39 | return Tools.getIcon(item); | ||
40 | } | ||
41 | } | ||
42 | </script> | ||
43 | |||
44 | <style lang="scss"> | ||
45 | .ld-breadcrumb { | ||
46 | border-left: 2px solid rgba(white, 0.1); | ||
47 | padding-left: 15px; | ||
48 | display: flex; | ||
49 | list-style: none; | ||
50 | margin: 5px; | ||
51 | a { | ||
52 | margin-right: 5px; | ||
53 | } | ||
54 | li:not(:first-child) { | ||
55 | margin-left: 10px; | ||
56 | } | ||
57 | } | ||
58 | </style> | ||
diff --git a/viewer/src/components/LdCommand.vue b/viewer/src/components/LdCommand.vue new file mode 100644 index 0000000..07cb354 --- /dev/null +++ b/viewer/src/components/LdCommand.vue | |||
@@ -0,0 +1,74 @@ | |||
1 | <!-- ldgallery - A static generator which turns a collection of tagged | ||
2 | -- pictures into a searchable web gallery. | ||
3 | -- | ||
4 | -- Copyright (C) 2019-2020 Guillaume FOUET | ||
5 | -- | ||
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 | ||
8 | -- published by the Free Software Foundation, either version 3 of the | ||
9 | -- License, or (at your option) any later version. | ||
10 | -- | ||
11 | -- This program is distributed in the hope that it will be useful, | ||
12 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | -- GNU Affero General Public License for more details. | ||
15 | -- | ||
16 | -- You should have received a copy of the GNU Affero General Public License | ||
17 | -- along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
18 | --> | ||
19 | |||
20 | <template> | ||
21 | <div class="flex command-btns"> | ||
22 | <div class="link" title="$t('title.tags')" @click="$uiStore.toggleFullWidth()"> | ||
23 | <fa-icon :icon="commandTagsIcon()" size="lg" /> | ||
24 | </div> | ||
25 | <router-link to="/" :class="{'disabled': isRoot()}" title="$t('title.home')"> | ||
26 | <fa-icon icon="home" size="lg" /> | ||
27 | </router-link> | ||
28 | <div class="link" title="$t('title.back')" @click="$router.go(-1)"> | ||
29 | <fa-icon icon="arrow-left" size="lg" /> | ||
30 | </div> | ||
31 | <router-link :class="{'disabled': isRoot()}" title="$t('title.parent')" :to="parent()"> | ||
32 | <fa-icon icon="folder" size="xs" /> | ||
33 | <fa-icon icon="level-up-alt" size="lg" /> | ||
34 | </router-link> | ||
35 | </div> | ||
36 | </template> | ||
37 | |||
38 | <script lang="ts"> | ||
39 | import { Component, Vue } from "vue-property-decorator"; | ||
40 | import { RawLocation } from "vue-router"; | ||
41 | |||
42 | @Component | ||
43 | export default class LdCommand extends Vue { | ||
44 | commandTagsIcon(): string { | ||
45 | return this.$uiStore.fullWidth ? "tags" : "window-close"; | ||
46 | } | ||
47 | |||
48 | isRoot(): boolean { | ||
49 | return this.$galleryStore.currentItemPath.length <= 1; | ||
50 | } | ||
51 | |||
52 | parent(): RawLocation { | ||
53 | if (!this.isRoot()) return this.$galleryStore.currentItemPath[this.$galleryStore.currentItemPath.length - 2]; | ||
54 | return ""; | ||
55 | } | ||
56 | } | ||
57 | </script> | ||
58 | |||
59 | <style lang="scss"> | ||
60 | @import "@/assets/scss/theme.scss"; | ||
61 | |||
62 | .command-btns { | ||
63 | justify-content: space-around; | ||
64 | vertical-align: middle; | ||
65 | align-items: center; | ||
66 | width: $layout-left; | ||
67 | > * { | ||
68 | // Unify the minor size differences between icons | ||
69 | width: 26px; | ||
70 | height: 26px; | ||
71 | margin-top: 2px; | ||
72 | } | ||
73 | } | ||
74 | </style> | ||
diff --git a/viewer/src/components/LdPicture.vue b/viewer/src/components/LdPicture.vue new file mode 100644 index 0000000..5425a00 --- /dev/null +++ b/viewer/src/components/LdPicture.vue | |||
@@ -0,0 +1,119 @@ | |||
1 | <!-- ldgallery - A static generator which turns a collection of tagged | ||
2 | -- pictures into a searchable web gallery. | ||
3 | -- | ||
4 | -- Copyright (C) 2019-2020 Guillaume FOUET | ||
5 | -- | ||
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 | ||
8 | -- published by the Free Software Foundation, either version 3 of the | ||
9 | -- License, or (at your option) any later version. | ||
10 | -- | ||
11 | -- This program is distributed in the hope that it will be useful, | ||
12 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | -- GNU Affero General Public License for more details. | ||
15 | -- | ||
16 | -- You should have received a copy of the GNU Affero General Public License | ||
17 | -- along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
18 | --> | ||
19 | |||
20 | <template> | ||
21 | <div | ||
22 | v-dragscroll | ||
23 | class="scrollbar" | ||
24 | :class="{'fit-to-screen': !$uiStore.fullscreen, 'original-size': $uiStore.fullscreen}" | ||
25 | @click="onClick" | ||
26 | @dragscrollstart="dragging=true" | ||
27 | > | ||
28 | <v-lazy-image | ||
29 | :src="pictureSrc()" | ||
30 | :class="{'slow-loading': Boolean(slowLoadingStyle)}" | ||
31 | :style="slowLoadingStyle" | ||
32 | @load="clearTimer" | ||
33 | /> | ||
34 | <b-loading :active="Boolean(slowLoadingStyle)" :is-full-page="false" class="ld-picture-loader" /> | ||
35 | </div> | ||
36 | </template> | ||
37 | |||
38 | <script lang="ts"> | ||
39 | import { Component, Vue, Prop } from "vue-property-decorator"; | ||
40 | |||
41 | @Component | ||
42 | export default class LdPicture extends Vue { | ||
43 | @Prop({ required: true }) readonly picture!: Gallery.Picture; | ||
44 | |||
45 | readonly SLOW_LOADING_TIMEOUT_MS: number = 1500; | ||
46 | |||
47 | dragging: boolean = false; | ||
48 | slowLoadingStyle: string | null = null; | ||
49 | timer: NodeJS.Timeout | null = null; | ||
50 | |||
51 | mounted() { | ||
52 | if (this.picture.thumbnail) this.timer = setTimeout(this.generateSlowLoadingStyle, this.SLOW_LOADING_TIMEOUT_MS); | ||
53 | } | ||
54 | |||
55 | destroyed() { | ||
56 | this.clearTimer(); | ||
57 | } | ||
58 | |||
59 | clearTimer() { | ||
60 | if (this.timer) clearTimeout(this.timer); | ||
61 | this.timer = null; | ||
62 | this.slowLoadingStyle = null; | ||
63 | } | ||
64 | |||
65 | pictureSrc() { | ||
66 | return `${process.env.VUE_APP_DATA_URL}${this.picture.properties.resource}`; | ||
67 | } | ||
68 | |||
69 | generateSlowLoadingStyle() { | ||
70 | this.clearTimer(); | ||
71 | this.slowLoadingStyle = `background-image: url('${process.env.VUE_APP_DATA_URL}${this.picture.thumbnail}');`; | ||
72 | } | ||
73 | |||
74 | onClick() { | ||
75 | if (!this.dragging) this.$uiStore.toggleFullscreen(); | ||
76 | this.dragging = false; | ||
77 | } | ||
78 | } | ||
79 | </script> | ||
80 | |||
81 | <style lang="scss"> | ||
82 | @import "@/assets/scss/theme.scss"; | ||
83 | |||
84 |