From 118666b4c3faeaeaf153a2ea7172764a3cbcffab Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Wed, 29 Jan 2020 23:04:30 +0100 Subject: viewer: the loader now correctly waits for the json to be loaded and indexes to be processed before displaying the UI. resolves #61 --- viewer/src/store/galleryStore.ts | 2 +- viewer/src/views/MainLayout.vue | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'viewer') diff --git a/viewer/src/store/galleryStore.ts b/viewer/src/store/galleryStore.ts index 663340f..b2ff74e 100644 --- a/viewer/src/store/galleryStore.ts +++ b/viewer/src/store/galleryStore.ts @@ -61,7 +61,7 @@ export default class GalleryStore extends VuexModule { // Fetches the gallery's JSON metadata @action async fetchGalleryItems(url: string) { - fetch(url) + return fetch(url) .then(response => response.json()) .then(this.setGalleryItemsRoot) .then(this.indexTags); diff --git a/viewer/src/views/MainLayout.vue b/viewer/src/views/MainLayout.vue index 7a75eb1..f608b9d 100644 --- a/viewer/src/views/MainLayout.vue +++ b/viewer/src/views/MainLayout.vue @@ -19,9 +19,9 @@ @@ -35,7 +35,7 @@ import PanelTop from "./PanelTop.vue"; components: { PanelLeft, PanelTop }, }) export default class MainLayout extends Vue { - isLoading: boolean = false; + isLoading: boolean = true; mounted() { this.fetchGalleryItems(); -- cgit v1.2.3 From 8670fb146e90f98653c776b01f29d905e5a6fe9f Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Wed, 29 Jan 2020 23:11:55 +0100 Subject: viewer: fixed subdirectory deploiement; all paths are now relative to index.html. resolves #17 --- viewer/.env | 2 +- viewer/src/views/MainLayout.vue | 2 +- viewer/vue.config.js | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'viewer') diff --git a/viewer/.env b/viewer/.env index 59b220a..9092dea 100644 --- a/viewer/.env +++ b/viewer/.env @@ -1,4 +1,4 @@ VUE_APP_I18N_LOCALE=en VUE_APP_I18N_FALLBACK_LOCALE=en -VUE_APP_DATA_URL=/gallery/ VUE_APP_EXAMPLE_PROJECT=../example/out/ +VUE_APP_DATA_URL=gallery/ diff --git a/viewer/src/views/MainLayout.vue b/viewer/src/views/MainLayout.vue index f608b9d..cedef58 100644 --- a/viewer/src/views/MainLayout.vue +++ b/viewer/src/views/MainLayout.vue @@ -44,7 +44,7 @@ export default class MainLayout extends Vue { fetchGalleryItems() { this.isLoading = true; this.$galleryStore - .fetchGalleryItems(`${process.env.VUE_APP_DATA_URL}/index.json`) + .fetchGalleryItems(`${process.env.VUE_APP_DATA_URL}index.json`) .finally(() => (this.isLoading = false)) .catch(this.displayError); } diff --git a/viewer/vue.config.js b/viewer/vue.config.js index 55cd2e7..67b7461 100644 --- a/viewer/vue.config.js +++ b/viewer/vue.config.js @@ -18,6 +18,7 @@ */ module.exports = { + publicPath: "./", pluginOptions: { i18n: { locale: "en", @@ -31,7 +32,7 @@ module.exports = { port: 8085, serveIndex: true, before: (app, server, compiler) => { - app.get(`${process.env.VUE_APP_DATA_URL}*`, (req, res) => { + app.get(`/${process.env.VUE_APP_DATA_URL}*`, (req, res) => { const fs = require("fs"); const url = req.url.slice(process.env.VUE_APP_DATA_URL.length); const paramIdx = url.indexOf('?'); -- cgit v1.2.3 From 1a6412e17077b8ea9939edfa9cc700db0730a1c6 Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Thu, 30 Jan 2020 15:12:34 +0100 Subject: viewer: scrollbars styling closer to flat design --- viewer/src/assets/scss/global.scss | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'viewer') diff --git a/viewer/src/assets/scss/global.scss b/viewer/src/assets/scss/global.scss index 1903c9e..6488dee 100644 --- a/viewer/src/assets/scss/global.scss +++ b/viewer/src/assets/scss/global.scss @@ -50,13 +50,14 @@ overflow: auto; } .scrollbar::-webkit-scrollbar { - width: 12px; + width: 10px; + height: 10px; } .scrollbar::-webkit-scrollbar-corner { background-color: transparent; } .scrollbar::-webkit-scrollbar-thumb { - box-shadow: inset 0 0 6px black; + box-shadow: inset 0 0 1px black; background-color: $toolbar-color; } -- cgit v1.2.3 From 234d0d13c767786393494810526a77d3d89b0e83 Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Thu, 30 Jan 2020 17:01:56 +0100 Subject: viewer: global keypress componant. ESC gets out of fullscreen. --- viewer/src/components/LdKeyPress.vue | 49 ++++++++++++++++++++++++++++++++++++ viewer/src/views/MainLayout.vue | 1 + 2 files changed, 50 insertions(+) create mode 100644 viewer/src/components/LdKeyPress.vue (limited to 'viewer') diff --git a/viewer/src/components/LdKeyPress.vue b/viewer/src/components/LdKeyPress.vue new file mode 100644 index 0000000..8276607 --- /dev/null +++ b/viewer/src/components/LdKeyPress.vue @@ -0,0 +1,49 @@ + + + \ No newline at end of file diff --git a/viewer/src/views/MainLayout.vue b/viewer/src/views/MainLayout.vue index cedef58..f0809b6 100644 --- a/viewer/src/views/MainLayout.vue +++ b/viewer/src/views/MainLayout.vue @@ -23,6 +23,7 @@ + -- cgit v1.2.3 From 76af6cffce939ef3c9a0952e6f7adc234e92f782 Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Thu, 30 Jan 2020 17:04:09 +0100 Subject: viewer: directories first and sorted by title in the navigation mode --- viewer/src/@types/gallery/index.d.ts | 9 ++- viewer/src/router/index.ts | 2 +- viewer/src/tools.ts | 17 ++++++ viewer/src/views/Gallery.vue | 104 -------------------------------- viewer/src/views/GalleryDirectory.vue | 8 ++- viewer/src/views/MainGallery.vue | 108 ++++++++++++++++++++++++++++++++++ 6 files changed, 141 insertions(+), 107 deletions(-) delete mode 100644 viewer/src/views/Gallery.vue create mode 100644 viewer/src/views/MainGallery.vue (limited to 'viewer') diff --git a/viewer/src/@types/gallery/index.d.ts b/viewer/src/@types/gallery/index.d.ts index 25407e8..b112b6d 100644 --- a/viewer/src/@types/gallery/index.d.ts +++ b/viewer/src/@types/gallery/index.d.ts @@ -18,6 +18,9 @@ */ declare namespace Gallery { + interface Other extends Item { + properties: OtherProperties, + } interface Picture extends Item { properties: PictureProperties, } @@ -31,7 +34,10 @@ declare namespace Gallery { tags: RawTag[], path: string, thumbnail?: string, - properties: PictureProperties | DirectoryProperties, + properties: OtherProperties | PictureProperties | DirectoryProperties, + } + interface OtherProperties { + type: "other", } interface PictureProperties { type: "picture", @@ -42,4 +48,5 @@ declare namespace Gallery { items: Item[] } type RawTag = string; + type ItemType = "other" | "picture" | "directory"; } \ No newline at end of file diff --git a/viewer/src/router/index.ts b/viewer/src/router/index.ts index 55b4b6c..0f3d2c7 100644 --- a/viewer/src/router/index.ts +++ b/viewer/src/router/index.ts @@ -19,7 +19,7 @@ import Vue from "vue"; import VueRouter from "vue-router"; -import Gallery from "@/views/Gallery.vue"; +import Gallery from "@/views/MainGallery.vue"; Vue.use(VueRouter); diff --git a/viewer/src/tools.ts b/viewer/src/tools.ts index 5eb287e..57a889d 100644 --- a/viewer/src/tools.ts +++ b/viewer/src/tools.ts @@ -27,4 +27,21 @@ export default class Tools { .toLowerCase(); } + + public static checkType(item: Gallery.Item | null, type: Gallery.ItemType): boolean { + return item?.properties.type === type ?? false; + } + + public static directoriesFirst(items: Gallery.Item[]) { + return [ + ...items + .filter(child => Tools.checkType(child, "directory")) + .sort((a, b) => a.title.localeCompare(b.title)), + + ...items + .filter(child => !Tools.checkType(child, "directory")), + ]; + } + + } \ No newline at end of file diff --git a/viewer/src/views/Gallery.vue b/viewer/src/views/Gallery.vue deleted file mode 100644 index fad7cc3..0000000 --- a/viewer/src/views/Gallery.vue +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - diff --git a/viewer/src/views/GalleryDirectory.vue b/viewer/src/views/GalleryDirectory.vue index 1df0c4d..d01032d 100644 --- a/viewer/src/views/GalleryDirectory.vue +++ b/viewer/src/views/GalleryDirectory.vue @@ -19,7 +19,7 @@ @@ -56,6 +56,7 @@ export default class GalleryPicture extends Vue { height: 100%; & > img { object-fit: contain; + cursor: zoom-in; } } .originalSize { @@ -67,6 +68,7 @@ export default class GalleryPicture extends Vue { max-width: unset; max-height: unset; object-fit: none; + cursor: zoom-out; } } -- cgit v1.2.3 From 16d319ac092aea56ac9f872129d23fface4b379d Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Thu, 30 Jan 2020 18:34:34 +0100 Subject: viewer: thumbnail loader styling --- viewer/src/assets/scss/theme.scss | 2 +- viewer/src/views/GalleryThumbnail.vue | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'viewer') diff --git a/viewer/src/assets/scss/theme.scss b/viewer/src/assets/scss/theme.scss index efd5d79..3f2b623 100644 --- a/viewer/src/assets/scss/theme.scss +++ b/viewer/src/assets/scss/theme.scss @@ -30,4 +30,4 @@ $content-bgcolor: #1e1e1e; $toolbar-color: #d62929; -$loader-color: #119; +$loader-color: #272727; diff --git a/viewer/src/views/GalleryThumbnail.vue b/viewer/src/views/GalleryThumbnail.vue index 7ceea4f..433a673 100644 --- a/viewer/src/views/GalleryThumbnail.vue +++ b/viewer/src/views/GalleryThumbnail.vue @@ -57,16 +57,14 @@ export default class GalleryThumbnail extends Vue { max-height: 250px; } .preload { - background: linear-gradient(to right, rgba(0, 0, 0, 0) 8%, $loader-color 18%, rgba(0, 0, 0, 0) 33%); - background-size: 200% 50px; - animation: preloadAnimation 2s infinite linear; + animation: preloadAnimation 1s infinite ease-in-out alternate; } @keyframes preloadAnimation { from { - background-position: -200px 0; + background-color: $content-bgcolor; } to { - background-position: 200px 0; + background-color: $loader-color; } } // Temporary size until we get the true thumbnail size -- cgit v1.2.3 From 42105af46681d81959a5d5a9a16ec9e98463a92e Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Thu, 30 Jan 2020 21:24:15 +0100 Subject: viewer: new breadcrumb. navigation buttons. and styling improvements --- viewer/src/assets/scss/buefy.scss | 3 +- viewer/src/assets/scss/global.scss | 15 +++++++ viewer/src/assets/scss/theme.scss | 7 +-- viewer/src/components/LdProposition.vue | 14 +++--- viewer/src/plugins/fontawesome.ts | 8 ++++ viewer/src/views/GalleryThumbnail.vue | 2 +- viewer/src/views/PanelLeft.vue | 5 +-- viewer/src/views/PanelTop.vue | 78 ++++++++++++++++----------------- 8 files changed, 74 insertions(+), 58 deletions(-) (limited to 'viewer') diff --git a/viewer/src/assets/scss/buefy.scss b/viewer/src/assets/scss/buefy.scss index 7fdb883..735ce6a 100644 --- a/viewer/src/assets/scss/buefy.scss +++ b/viewer/src/assets/scss/buefy.scss @@ -24,8 +24,7 @@ @import "buefy_variables"; // 2. Setup your Custom Colors -// $linkedin: #0077b5; -// $linkedin-invert: findColorInvert($linkedin); +@import "@/assets/scss/theme.scss"; @import "~bulma/sass/utilities/derived-variables"; diff --git a/viewer/src/assets/scss/global.scss b/viewer/src/assets/scss/global.scss index 645d4a0..3cfa1a5 100644 --- a/viewer/src/assets/scss/global.scss +++ b/viewer/src/assets/scss/global.scss @@ -44,6 +44,21 @@ align-items: center; } +// === Links + +.link { + color: $link; + cursor: pointer; + text-decoration: none; + & :hover { + color: $link-hover; + } +} + +.disabled { + color: $disabled-color !important; +} + // === Scrollbar styling .scrollbar { diff --git a/viewer/src/assets/scss/theme.scss b/viewer/src/assets/scss/theme.scss index 3f2b623..2314ee8 100644 --- a/viewer/src/assets/scss/theme.scss +++ b/viewer/src/assets/scss/theme.scss @@ -19,7 +19,7 @@ // === Theme -$layout-top: 70px; +$layout-top: 35px; $layout-left: 250px; $panel-top-bgcolor: #225; @@ -27,7 +27,8 @@ $panel-top-txtcolor: white; $panel-left-bgcolor: $panel-top-bgcolor; $panel-left-txtcolor: $panel-top-txtcolor; $content-bgcolor: #1e1e1e; - $toolbar-color: #d62929; - $loader-color: #272727; +$link: $panel-top-txtcolor; +$link-hover: lightblue; +$disabled-color: rgba($link, 0.3); diff --git a/viewer/src/components/LdProposition.vue b/viewer/src/components/LdProposition.vue index 9a32e0a..f653e4d 100644 --- a/viewer/src/components/LdProposition.vue +++ b/viewer/src/components/LdProposition.vue @@ -19,7 +19,7 @@ diff --git a/viewer/src/views/PanelTop.vue b/viewer/src/views/PanelTop.vue index 7e24699..e7421f0 100644 --- a/viewer/src/views/PanelTop.vue +++ b/viewer/src/views/PanelTop.vue @@ -20,7 +20,7 @@ -- cgit v1.2.3 From 293c2803794a5cc4f9a045d48ff28ae99beaa030 Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Fri, 31 Jan 2020 00:37:55 +0100 Subject: viewer: moved router.ts to the plugins directory for simplicity --- viewer/src/main.ts | 2 +- viewer/src/plugins/router.ts | 41 +++++++++++++++++++++++++++++++++++++++++ viewer/src/router/index.ts | 41 ----------------------------------------- 3 files changed, 42 insertions(+), 42 deletions(-) create mode 100644 viewer/src/plugins/router.ts delete mode 100644 viewer/src/router/index.ts (limited to 'viewer') diff --git a/viewer/src/main.ts b/viewer/src/main.ts index 75a238f..a8ff322 100644 --- a/viewer/src/main.ts +++ b/viewer/src/main.ts @@ -26,7 +26,7 @@ import "@/plugins/lazyimage"; import "@/plugins/dragscroll"; import store from '@/store' import i18n from "@/plugins/i18n"; -import router from "@/router"; +import router from "@/plugins/router"; import MainLayout from "@/views/MainLayout.vue"; Vue.config.productionTip = false; diff --git a/viewer/src/plugins/router.ts b/viewer/src/plugins/router.ts new file mode 100644 index 0000000..0f3d2c7 --- /dev/null +++ b/viewer/src/plugins/router.ts @@ -0,0 +1,41 @@ +/* ldgallery - A static generator which turns a collection of tagged +-- pictures into a searchable web gallery. +-- +-- Copyright (C) 2019-2020 Guillaume FOUET +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU Affero General Public License as +-- published by the Free Software Foundation, either version 3 of the +-- License, or (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU Affero General Public License for more details. +-- +-- You should have received a copy of the GNU Affero General Public License +-- along with this program. If not, see . +*/ + +import Vue from "vue"; +import VueRouter from "vue-router"; +import Gallery from "@/views/MainGallery.vue"; + +Vue.use(VueRouter); + +// async way : component: () => import(/* webpackChunkName: "Gallery" */ "@/views/Gallery.vue"), + +const routes = [ + { + path: "*", + name: "Gallery", + component: Gallery, + props: true + }, +]; + +const router = new VueRouter({ + routes, +}); + +export default router; diff --git a/viewer/src/router/index.ts b/viewer/src/router/index.ts deleted file mode 100644 index 0f3d2c7..0000000 --- a/viewer/src/router/index.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* ldgallery - A static generator which turns a collection of tagged --- pictures into a searchable web gallery. --- --- Copyright (C) 2019-2020 Guillaume FOUET --- --- This program is free software: you can redistribute it and/or modify --- it under the terms of the GNU Affero General Public License as --- published by the Free Software Foundation, either version 3 of the --- License, or (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU Affero General Public License for more details. --- --- You should have received a copy of the GNU Affero General Public License --- along with this program. If not, see . -*/ - -import Vue from "vue"; -import VueRouter from "vue-router"; -import Gallery from "@/views/MainGallery.vue"; - -Vue.use(VueRouter); - -// async way : component: () => import(/* webpackChunkName: "Gallery" */ "@/views/Gallery.vue"), - -const routes = [ - { - path: "*", - name: "Gallery", - component: Gallery, - props: true - }, -]; - -const router = new VueRouter({ - routes, -}); - -export default router; -- cgit v1.2.3 From 2157b66f3ea43137391939992cac4dc901a4ac4e Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Fri, 31 Jan 2020 02:15:26 +0100 Subject: compiler: output viewer config.json Write a file at the root of the viewer directory with some info about the gallery root path and generation date time. --- viewer/public/config.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 viewer/public/config.json (limited to 'viewer') diff --git a/viewer/public/config.json b/viewer/public/config.json new file mode 100644 index 0000000..7023edb --- /dev/null +++ b/viewer/public/config.json @@ -0,0 +1,4 @@ +{ + "generationTimestamp": 0, + "galleryRoot": "gallery/" +} \ No newline at end of file -- cgit v1.2.3