diff options
Diffstat (limited to 'viewer/src/views/MainLayout.vue')
-rw-r--r-- | viewer/src/views/MainLayout.vue | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/viewer/src/views/MainLayout.vue b/viewer/src/views/MainLayout.vue new file mode 100644 index 0000000..5308205 --- /dev/null +++ b/viewer/src/views/MainLayout.vue | |||
@@ -0,0 +1,121 @@ | |||
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="{fullscreen: $uiStore.fullscreen}"> | ||
22 | <panel-top class="layout layout-top" /> | ||
23 | <panel-left class="layout layout-left" /> | ||
24 | <router-view class="layout layout-content" /> | ||
25 | <ld-button-fullscreen /> | ||
26 | <b-loading :active="isLoading" is-full-page /> | ||
27 | </div> | ||
28 | </template> | ||
29 | |||
30 | <script lang="ts"> | ||
31 | import { Component, Vue } from "vue-property-decorator"; | ||
32 | import PanelLeft from "./PanelLeft.vue"; | ||
33 | import PanelTop from "./PanelTop.vue"; | ||
34 | |||
35 | @Component({ | ||
36 | components: { PanelLeft, PanelTop }, | ||
37 | }) | ||
38 | export default class MainLayout extends Vue { | ||
39 | isLoading: boolean = false; | ||
40 | |||
41 | mounted() { | ||
42 | this.fetchGalleryItems(); | ||
43 | } | ||
44 | |||
45 | fetchGalleryItems() { | ||
46 | this.isLoading = true; | ||
47 | this.$galleryStore | ||
48 | .fetchGalleryItems(`${process.env.VUE_APP_DATA_URL}/index.json`) | ||
49 | .finally(() => (this.isLoading = false)) | ||
50 | .catch(this.displayError); | ||
51 | } | ||
52 | |||
53 | displayError(reason: any) { | ||
54 | this.$buefy.snackbar.open({ | ||
55 | message: `Error ${reason}`, | ||
56 | actionText: "Retry", | ||
57 | position: "is-top", | ||
58 | type: "is-danger", | ||
59 | indefinite: true, | ||
60 | onAction: this.fetchGalleryItems, | ||
61 | }); | ||
62 | } | ||
63 | } | ||
64 | </script> | ||
65 | |||
66 | <style lang="scss"> | ||
67 | @import "@/assets/scss/theme.scss"; | ||
68 | |||
69 | body, | ||
70 | html { | ||
71 | height: 100%; | ||
72 | overflow: hidden; | ||
73 | --layout-top: #{$layout-top}; | ||
74 | --layout-left: #{$layout-left}; | ||
75 | } | ||
76 | .layout { | ||
77 | position: fixed; | ||
78 | transition: all 0.1s linear; | ||
79 | top: 0; | ||
80 | bottom: 0; | ||
81 | left: 0; | ||
82 | right: 0; | ||
83 | &.layout-top { | ||
84 | height: $layout-top; | ||
85 | z-index: 1; | ||
86 | } | ||
87 | &.layout-left { | ||
88 | top: $layout-top; | ||
89 | width: $layout-left; | ||
90 | z-index: 2; | ||
91 | } | ||
92 | &.layout-content { | ||
93 | top: var(--layout-top); | ||
94 | left: var(--layout-left); | ||
95 | z-index: 3; | ||
96 | } | ||
97 | } | ||
98 | .fullscreen { | ||
99 | --layout-left: 0px; | ||
100 | --layout-top: 0px; | ||
101 | .layout { | ||
102 | &.layout-left { | ||
103 | transform: translate(-$layout-left, 0); | ||
104 | } | ||
105 | } | ||
106 | } | ||
107 | |||
108 | .layout { | ||
109 | &.layout-top { | ||
110 | background-color: $panel-top-bgcolor; | ||
111 | color: $panel-top-txtcolor; | ||
112 | } | ||
113 | &.layout-left { | ||
114 | background-color: $panel-left-bgcolor; | ||
115 | color: $panel-left-txtcolor; | ||
116 | } | ||
117 | &.layout-content { | ||
118 | background-color: $content-bgcolor; | ||
119 | } | ||
120 | } | ||
121 | </style> \ No newline at end of file | ||