aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/components
diff options
context:
space:
mode:
authorZero~Informatique2020-01-31 09:17:57 +0100
committerZero~Informatique2020-01-31 09:27:06 +0100
commit170da2d55fec0359cbac780786383710b734eda7 (patch)
treeeb6fe6f60e9b83a9e5886b504aa65521711fd4a3 /viewer/src/components
parenta7d459a2620fa9523dd7ce8c9de519133ad5b1b7 (diff)
downloadldgallery-170da2d55fec0359cbac780786383710b734eda7.tar.gz
viewer: code cleaning, moved some views to components
Diffstat (limited to 'viewer/src/components')
-rw-r--r--viewer/src/components/LdBreadcrumb.vue58
-rw-r--r--viewer/src/components/LdCommand.vue68
-rw-r--r--viewer/src/components/LdPicture.vue74
-rw-r--r--viewer/src/components/LdProposition.vue4
-rw-r--r--viewer/src/components/LdTagInput.vue2
-rw-r--r--viewer/src/components/LdThumbnail.vue81
6 files changed, 284 insertions, 3 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">
33import { Component, Vue } from "vue-property-decorator";
34import Tools from "@/tools";
35
36@Component
37export 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..484e56a
--- /dev/null
+++ b/viewer/src/components/LdCommand.vue
@@ -0,0 +1,68 @@
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">
39import { Component, Vue } from "vue-property-decorator";
40import { RawLocation } from "vue-router";
41
42@Component
43export 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</style>
diff --git a/viewer/src/components/LdPicture.vue b/viewer/src/components/LdPicture.vue
new file mode 100644
index 0000000..b6a719f
--- /dev/null
+++ b/viewer/src/components/LdPicture.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
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 :src="pictureSrc" />
29 </div>
30</template>
31
32<script lang="ts">
33import { Component, Vue, Prop } from "vue-property-decorator";
34
35@Component
36export default class LdPicture extends Vue {
37 @Prop({ required: true }) readonly picture!: Gallery.Picture;
38
39 dragging: boolean = false;
40
41 get pictureSrc() {
42 return `${process.env.VUE_APP_DATA_URL}${this.picture.properties.resource}`;
43 }
44
45 onClick() {
46 if (!this.dragging) this.$uiStore.toggleFullscreen();
47 this.dragging = false;
48 }
49}
50</script>
51
52<style lang="scss">
53.fit-to-screen {
54 display: flex;
55 justify-content: space-around;
56 height: 100%;
57 & > img {
58 object-fit: contain;
59 cursor: zoom-in;
60 }
61}
62.original-size {
63 display: block;
64 text-align: center;
65 cursor: grab;
66 height: 100%;
67 & > img {
68 max-width: unset;
69 max-height: unset;
70 object-fit: none;
71 cursor: zoom-out;
72 }
73}
74</style>
diff --git a/viewer/src/components/LdProposition.vue b/viewer/src/components/LdProposition.vue
index a380021..6be0aee 100644
--- a/viewer/src/components/LdProposition.vue
+++ b/viewer/src/components/LdProposition.vue
@@ -37,10 +37,10 @@
37 37
38<script lang="ts"> 38<script lang="ts">
39import { Component, Vue } from "vue-property-decorator"; 39import { Component, Vue } from "vue-property-decorator";
40import { Operation } from "@/@types/tag/Operation"; 40import { Operation } from "@/@types/Operation";
41 41
42@Component 42@Component
43export default class LdTagInput extends Vue { 43export default class LdProposition extends Vue {
44 get Operation() { 44 get Operation() {
45 return Operation; 45 return Operation;