From 7ae68f079ddfb74c9a1b17c4f30dfe4c258d4a9f Mon Sep 17 00:00:00 2001
From: Zero~Informatique
Date: Fri, 20 Dec 2019 17:47:04 +0100
Subject: Viewer project foundations
---
viewer/src/assets/scss/_buefy_variables.scss | 152 +++++++++++++++++++++++++++
viewer/src/assets/scss/buefy.scss | 37 +++++++
viewer/src/assets/scss/global.scss | 14 +++
viewer/src/locales/en.json | 3 +
viewer/src/main.ts | 15 +++
viewer/src/plugins/buefy.ts | 9 ++
viewer/src/plugins/fontawesome.js | 9 ++
viewer/src/plugins/i18n.ts | 23 ++++
viewer/src/router/index.ts | 18 ++++
viewer/src/shims-tsx.d.ts | 13 +++
viewer/src/shims-vue.d.ts | 4 +
viewer/src/views/LdGallery.vue | 82 +++++++++++++++
viewer/src/views/Root.vue | 18 ++++
13 files changed, 397 insertions(+)
create mode 100644 viewer/src/assets/scss/_buefy_variables.scss
create mode 100644 viewer/src/assets/scss/buefy.scss
create mode 100644 viewer/src/assets/scss/global.scss
create mode 100644 viewer/src/locales/en.json
create mode 100644 viewer/src/main.ts
create mode 100644 viewer/src/plugins/buefy.ts
create mode 100644 viewer/src/plugins/fontawesome.js
create mode 100644 viewer/src/plugins/i18n.ts
create mode 100644 viewer/src/router/index.ts
create mode 100644 viewer/src/shims-tsx.d.ts
create mode 100644 viewer/src/shims-vue.d.ts
create mode 100644 viewer/src/views/LdGallery.vue
create mode 100644 viewer/src/views/Root.vue
(limited to 'viewer/src')
diff --git a/viewer/src/assets/scss/_buefy_variables.scss b/viewer/src/assets/scss/_buefy_variables.scss
new file mode 100644
index 0000000..716a1ec
--- /dev/null
+++ b/viewer/src/assets/scss/_buefy_variables.scss
@@ -0,0 +1,152 @@
+// Included below are all the defined variables from Bulma
+// Modify as needed, removing the !default attribute.
+
+// Colors
+
+$black: hsl(0, 0%, 4%) !default;
+$black-bis: hsl(0, 0%, 7%) !default;
+$black-ter: hsl(0, 0%, 14%) !default;
+
+$grey-darker: hsl(0, 0%, 21%) !default;
+$grey-dark: hsl(0, 0%, 29%) !default;
+$grey: hsl(0, 0%, 48%) !default;
+$grey-light: hsl(0, 0%, 71%) !default;
+$grey-lighter: hsl(0, 0%, 86%) !default;
+
+$white-ter: hsl(0, 0%, 96%) !default;
+$white-bis: hsl(0, 0%, 98%) !default;
+$white: hsl(0, 0%, 100%) !default;
+
+$orange: hsl(14, 100%, 53%) !default;
+$yellow: hsl(48, 100%, 67%) !default;
+$green: hsl(141, 71%, 48%) !default;
+$turquoise: hsl(171, 100%, 41%) !default;
+$cyan: hsl(204, 86%, 53%) !default;
+$blue: hsl(217, 71%, 53%) !default;
+$purple: hsl(271, 100%, 71%) !default;
+$red: hsl(348, 100%, 61%) !default;
+
+// Typography
+
+$family-sans-serif: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif !default;
+$family-monospace: monospace !default;
+$render-mode: optimizeLegibility !default;
+
+$size-1: 3rem !default;
+$size-2: 2.5rem !default;
+$size-3: 2rem !default;
+$size-4: 1.5rem !default;
+$size-5: 1.25rem !default;
+$size-6: 1rem !default;
+$size-7: 0.75rem !default;
+
+$weight-light: 300 !default;
+$weight-normal: 400 !default;
+$weight-medium: 500 !default;
+$weight-semibold: 600 !default;
+$weight-bold: 700 !default;
+
+// Responsiveness
+
+// The container horizontal gap, which acts as the offset for breakpoints
+$gap: 32px !default;
+// 960, 1152, and 1344 have been chosen because they are divisible by both 12 and 16
+$tablet: 769px !default;
+// 960px container + 4rem
+$desktop: 960px + (2 * $gap) !default;
+// 1152px container + 4rem
+$widescreen: 1152px + (2 * $gap) !default;
+// 1344px container + 4rem;
+$fullhd: 1344px + (2 * $gap) !default;
+
+// Miscellaneous
+
+$easing: ease-out !default;
+$radius-small: 2px !default;
+$radius: 3px !default;
+$radius-large: 5px !default;
+$radius-rounded: 290486px !default;
+$speed: 86ms !default;
+
+// Flags
+
+$variable-columns: true !default;
+
+
+// The default Bulma derived variables are declared below
+
+$primary: $turquoise !default;
+
+$info: $cyan !default;
+$success: $green !default;
+$warning: $yellow !default;
+$danger: $red !default;
+
+$light: $white-ter !default;
+$dark: $grey-darker !default;
+
+// Invert colors
+
+$orange-invert: findColorInvert($orange) !default;
+$yellow-invert: findColorInvert($yellow) !default;
+$green-invert: findColorInvert($green) !default;
+$turquoise-invert: findColorInvert($turquoise) !default;
+$cyan-invert: findColorInvert($cyan) !default;
+$blue-invert: findColorInvert($blue) !default;
+$purple-invert: findColorInvert($purple) !default;
+$red-invert: findColorInvert($red) !default;
+
+$primary-invert: $turquoise-invert !default;
+$info-invert: $cyan-invert !default;
+$success-invert: $green-invert !default;
+$warning-invert: $yellow-invert !default;
+$danger-invert: $red-invert !default;
+$light-invert: $dark !default;
+$dark-invert: $light !default;
+
+// General colors
+
+$background: $white-ter !default;
+
+$border: $grey-lighter !default;
+$border-hover: $grey-light !default;
+
+// Text colors
+
+$text: $grey-dark !default;
+$text-invert: findColorInvert($text) !default;
+$text-light: $grey !default;
+$text-strong: $grey-darker !default;
+
+// Code colors
+
+$code: $red !default;
+$code-background: $background !default;
+
+$pre: $text !default;
+$pre-background: $background !default;
+
+// Link colors
+
+$link: $blue !default;
+$link-invert: $blue-invert !default;
+$link-visited: $purple !default;
+
+$link-hover: $grey-darker !default;
+$link-hover-border: $grey-light !default;
+
+$link-focus: $grey-darker !default;
+$link-focus-border: $blue !default;
+
+$link-active: $grey-darker !default;
+$link-active-border: $grey-dark !default;
+
+// Typography
+
+$family-primary: $family-sans-serif !default;
+$family-code: $family-monospace !default;
+
+$size-small: $size-7 !default;
+$size-normal: $size-6 !default;
+$size-medium: $size-5 !default;
+$size-large: $size-4 !default;
diff --git a/viewer/src/assets/scss/buefy.scss b/viewer/src/assets/scss/buefy.scss
new file mode 100644
index 0000000..5249899
--- /dev/null
+++ b/viewer/src/assets/scss/buefy.scss
@@ -0,0 +1,37 @@
+@import "~bulma/sass/utilities/initial-variables";
+@import "~bulma/sass/utilities/functions";
+// 1. Set your own initial variables and derived
+// variables in _variables.scss
+@import "buefy_variables";
+
+// 2. Setup your Custom Colors
+$linkedin: #0077b5;
+$linkedin-invert: findColorInvert($linkedin);
+$twitter: #55acee;
+$twitter-invert: findColorInvert($twitter);
+$github: #333;
+$github-invert: findColorInvert($github);
+
+@import "~bulma/sass/utilities/derived-variables";
+
+// 3. Add new color variables to the color map.
+$addColors: (
+ "twitter": (
+ $twitter,
+ $twitter-invert
+ ),
+ "linkedin": (
+ $linkedin,
+ $linkedin-invert
+ ),
+ "github": (
+ $github,
+ $github-invert
+ )
+);
+$colors: map-merge($colors, $addColors);
+
+@import "~bulma";
+@import "~buefy/src/scss/buefy";
+
+// 4. Provide custom buefy overrides and site styles here
diff --git a/viewer/src/assets/scss/global.scss b/viewer/src/assets/scss/global.scss
new file mode 100644
index 0000000..0bfeab9
--- /dev/null
+++ b/viewer/src/assets/scss/global.scss
@@ -0,0 +1,14 @@
+// Global CSS
+
+// === Forms
+
+.required label::after {
+ content: "*";
+ color: red;
+}
+
+// === Tools
+
+.nowrap {
+ white-space: nowrap;
+}
diff --git a/viewer/src/locales/en.json b/viewer/src/locales/en.json
new file mode 100644
index 0000000..d966983
--- /dev/null
+++ b/viewer/src/locales/en.json
@@ -0,0 +1,3 @@
+{
+ "message": "hello i18n !!"
+}
\ No newline at end of file
diff --git a/viewer/src/main.ts b/viewer/src/main.ts
new file mode 100644
index 0000000..352b565
--- /dev/null
+++ b/viewer/src/main.ts
@@ -0,0 +1,15 @@
+import Vue from "vue";
+import "@/assets/scss/global.scss";
+import "@/plugins/fontawesome";
+import "@/plugins/buefy";
+import i18n from "@/plugins/i18n";
+import router from "@/router";
+import LdGallery from "@/views/LdGallery.vue";
+
+Vue.config.productionTip = false;
+
+new Vue({
+ router,
+ i18n,
+ render: h => h(LdGallery),
+}).$mount("#ldgallery");
diff --git a/viewer/src/plugins/buefy.ts b/viewer/src/plugins/buefy.ts
new file mode 100644
index 0000000..a880cee
--- /dev/null
+++ b/viewer/src/plugins/buefy.ts
@@ -0,0 +1,9 @@
+import Vue from "vue";
+
+import Buefy from "buefy";
+import "@/assets/scss/buefy.scss";
+
+Vue.use(Buefy, {
+ defaultIconComponent: 'fa-icon',
+ defaultIconPack: 'fas',
+});
diff --git a/viewer/src/plugins/fontawesome.js b/viewer/src/plugins/fontawesome.js
new file mode 100644
index 0000000..9bf4dba
--- /dev/null
+++ b/viewer/src/plugins/fontawesome.js
@@ -0,0 +1,9 @@
+import Vue from "vue";
+
+import { library } from "@fortawesome/fontawesome-svg-core";
+import { faExpandArrowsAlt } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
+
+library.add(faExpandArrowsAlt);
+
+Vue.component("fa-icon", FontAwesomeIcon);
diff --git a/viewer/src/plugins/i18n.ts b/viewer/src/plugins/i18n.ts
new file mode 100644
index 0000000..da2cd87
--- /dev/null
+++ b/viewer/src/plugins/i18n.ts
@@ -0,0 +1,23 @@
+import Vue from "vue";
+import VueI18n, { LocaleMessages } from "vue-i18n";
+
+Vue.use(VueI18n);
+
+function loadLocaleMessages(): LocaleMessages {
+ const locales = require.context("@/locales", true, /[A-Za-z0-9-_,\s]+\.json$/i);
+ const messages: LocaleMessages = {};
+ locales.keys().forEach(key => {
+ const matched = key.match(/([A-Za-z0-9-_]+)\./i);
+ if (matched && matched.length > 1) {
+ const locale = matched[1];
+ messages[locale] = locales(key);
+ }
+ });
+ return messages;
+}
+
+export default new VueI18n({
+ locale: process.env.VUE_APP_I18N_LOCALE || "en",
+ fallbackLocale: process.env.VUE_APP_I18N_FALLBACK_LOCALE || "en",
+ messages: loadLocaleMessages(),
+});
diff --git a/viewer/src/router/index.ts b/viewer/src/router/index.ts
new file mode 100644
index 0000000..03ae1cd
--- /dev/null
+++ b/viewer/src/router/index.ts
@@ -0,0 +1,18 @@
+import Vue from "vue";
+import VueRouter from "vue-router";
+
+Vue.use(VueRouter);
+
+const routes = [
+ {
+ path: "/",
+ name: "root",
+ component: () => import(/* webpackChunkName: "root" */ "@/views/Root.vue"),
+ },
+];
+
+const router = new VueRouter({
+ routes,
+});
+
+export default router;
diff --git a/viewer/src/shims-tsx.d.ts b/viewer/src/shims-tsx.d.ts
new file mode 100644
index 0000000..2bcdf9f
--- /dev/null
+++ b/viewer/src/shims-tsx.d.ts
@@ -0,0 +1,13 @@
+import Vue, { VNode } from "vue";
+
+declare global {
+ namespace JSX {
+ // tslint:disable no-empty-interface
+ interface Element extends VNode {}
+ // tslint:disable no-empty-interface
+ interface ElementClass extends Vue {}
+ interface IntrinsicElements {
+ [elem: string]: any;
+ }
+ }
+}
diff --git a/viewer/src/shims-vue.d.ts b/viewer/src/shims-vue.d.ts
new file mode 100644
index 0000000..0660bd6
--- /dev/null
+++ b/viewer/src/shims-vue.d.ts
@@ -0,0 +1,4 @@
+declare module "*.vue" {
+ import Vue from "vue";
+ export default Vue;
+}
diff --git a/viewer/src/views/LdGallery.vue b/viewer/src/views/LdGallery.vue
new file mode 100644
index 0000000..a77dc24
--- /dev/null
+++ b/viewer/src/views/LdGallery.vue
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/viewer/src/views/Root.vue b/viewer/src/views/Root.vue
new file mode 100644
index 0000000..384dcbe
--- /dev/null
+++ b/viewer/src/views/Root.vue
@@ -0,0 +1,18 @@
+
+ Hello World!
+
+
+
+
+
--
cgit v1.2.3
From bdce958eddc527912a57afa5b8151e1a90e38355 Mon Sep 17 00:00:00 2001
From: Zero~Informatique
Date: Fri, 20 Dec 2019 23:54:56 +0100
Subject: Updated EsLint Removed logic from the view
---
viewer/src/views/LdGallery.vue | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
(limited to 'viewer/src')
diff --git a/viewer/src/views/LdGallery.vue b/viewer/src/views/LdGallery.vue
index a77dc24..98f083f 100644
--- a/viewer/src/views/LdGallery.vue
+++ b/viewer/src/views/LdGallery.vue
@@ -3,11 +3,7 @@
header
panel
-
+
@@ -17,6 +13,10 @@ import { Component, Vue } from "vue-property-decorator";
@Component
export default class LdGallery extends Vue {
fullscreen: boolean = false;
+
+ toggleFullscreen() {
+ this.fullscreen = !this.fullscreen;
+ }
}
--
cgit v1.2.3
From 62005141132da1e9761598fa3e4b35b4dab38a89 Mon Sep 17 00:00:00 2001
From: Zero~Informatique
Date: Sat, 21 Dec 2019 02:06:02 +0100
Subject: Implemented VueX and a basic UIStore with the fullscreen mutation
Some renaming
---
viewer/src/main.ts | 4 +++-
viewer/src/plugins/fontawesome.js | 9 ---------
viewer/src/plugins/fontawesome.ts | 9 +++++++++
viewer/src/plugins/vuex.ts | 23 +++++++++++++++++++++++
viewer/src/store/uiStore.ts | 15 +++++++++++++++
viewer/src/views/LdGallery.vue | 16 +++++++---------
6 files changed, 57 insertions(+), 19 deletions(-)
delete mode 100644 viewer/src/plugins/fontawesome.js
create mode 100644 viewer/src/plugins/fontawesome.ts
create mode 100644 viewer/src/plugins/vuex.ts
create mode 100644 viewer/src/store/uiStore.ts
(limited to 'viewer/src')
diff --git a/viewer/src/main.ts b/viewer/src/main.ts
index 352b565..3a3593c 100644
--- a/viewer/src/main.ts
+++ b/viewer/src/main.ts
@@ -2,6 +2,7 @@ import Vue from "vue";
import "@/assets/scss/global.scss";
import "@/plugins/fontawesome";
import "@/plugins/buefy";
+import store from '@/plugins/vuex'
import i18n from "@/plugins/i18n";
import router from "@/router";
import LdGallery from "@/views/LdGallery.vue";
@@ -11,5 +12,6 @@ Vue.config.productionTip = false;
new Vue({
router,
i18n,
- render: h => h(LdGallery),
+ store,
+ render: h => h(LdGallery)
}).$mount("#ldgallery");
diff --git a/viewer/src/plugins/fontawesome.js b/viewer/src/plugins/fontawesome.js
deleted file mode 100644
index 9bf4dba..0000000
--- a/viewer/src/plugins/fontawesome.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import Vue from "vue";
-
-import { library } from "@fortawesome/fontawesome-svg-core";
-import { faExpandArrowsAlt } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
-
-library.add(faExpandArrowsAlt);
-
-Vue.component("fa-icon", FontAwesomeIcon);
diff --git a/viewer/src/plugins/fontawesome.ts b/viewer/src/plugins/fontawesome.ts
new file mode 100644
index 0000000..9bf4dba
--- /dev/null
+++ b/viewer/src/plugins/fontawesome.ts
@@ -0,0 +1,9 @@
+import Vue from "vue";
+
+import { library } from "@fortawesome/fontawesome-svg-core";
+import { faExpandArrowsAlt } from "@fortawesome/free-solid-svg-icons";
+import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
+
+library.add(faExpandArrowsAlt);
+
+Vue.component("fa-icon", FontAwesomeIcon);
diff --git a/viewer/src/plugins/vuex.ts b/viewer/src/plugins/vuex.ts
new file mode 100644
index 0000000..9b2fa46
--- /dev/null
+++ b/viewer/src/plugins/vuex.ts
@@ -0,0 +1,23 @@
+import Vue from 'vue'
+import Vuex from 'vuex'
+import { extractVuexModule } from "vuex-class-component";
+import { createProxy } from "vuex-class-component";
+import UIStore from '@/store/uiStore';
+
+Vue.use(Vuex)
+
+const store = new Vuex.Store({
+ modules: {
+ ...extractVuexModule(UIStore)
+ }
+});
+
+Vue.use((vue) => vue.prototype.$uiStore = createProxy(store, UIStore));
+
+declare module 'vue/types/vue' {
+ interface Vue {
+ $uiStore: UIStore
+ }
+}
+
+export default store;
diff --git a/viewer/src/store/uiStore.ts b/viewer/src/store/uiStore.ts
new file mode 100644
index 0000000..c4143a1
--- /dev/null
+++ b/viewer/src/store/uiStore.ts
@@ -0,0 +1,15 @@
+import { createModule, mutation, action } from "vuex-class-component";
+
+const VuexModule = createModule({
+ namespaced: "uiStore",
+ strict: true
+})
+
+export default class UIStore extends VuexModule {
+
+ fullscreen: boolean = false;
+
+ @mutation toggleFullscreen() {
+ this.fullscreen = !this.fullscreen;
+ }
+}
diff --git a/viewer/src/views/LdGallery.vue b/viewer/src/views/LdGallery.vue
index 98f083f..d22bfa6 100644
--- a/viewer/src/views/LdGallery.vue
+++ b/viewer/src/views/LdGallery.vue
@@ -1,9 +1,13 @@
-
+
@@ -11,13 +15,7 @@
import { Component, Vue } from "vue-property-decorator";
@Component
-export default class LdGallery extends Vue {
- fullscreen: boolean = false;
-
- toggleFullscreen() {
- this.fullscreen = !this.fullscreen;
- }
-}
+export default class LdGallery extends Vue {}
diff --git a/viewer/src/components/index.ts b/viewer/src/components/index.ts
new file mode 100644
index 0000000..1406b34
--- /dev/null
+++ b/viewer/src/components/index.ts
@@ -0,0 +1,22 @@
+import Vue from 'vue'
+
+const requireComponent = require.context(
+ '@/components',
+ false, // Whether or not to look in subfolders
+ // The regular expression used to match base component filenames
+ /Ld[A-Z]\w+\.vue$/
+)
+
+requireComponent.keys().forEach(fileName => {
+ const componentConfig = requireComponent(fileName)
+ const componentName = fileName.split('/').pop()!.replace(/\.vue$/, '');
+
+ // Register component globally
+ Vue.component(
+ componentName,
+ // Look for the component options on `.default`, which will
+ // exist if the component was exported with `export default`,
+ // otherwise fall back to module's root.
+ componentConfig.default || componentConfig
+ )
+})
\ No newline at end of file
diff --git a/viewer/src/main.ts b/viewer/src/main.ts
index 3a3593c..ca439bc 100644
--- a/viewer/src/main.ts
+++ b/viewer/src/main.ts
@@ -1,5 +1,6 @@
import Vue from "vue";
import "@/assets/scss/global.scss";
+import "@/components"
import "@/plugins/fontawesome";
import "@/plugins/buefy";
import store from '@/plugins/vuex'
diff --git a/viewer/src/views/LdGallery.vue b/viewer/src/views/LdGallery.vue
index d22bfa6..ecdfa1b 100644
--- a/viewer/src/views/LdGallery.vue
+++ b/viewer/src/views/LdGallery.vue
@@ -1,13 +1,9 @@
-
header
-
panel
-
-
+
header
+
panel
+
+
@@ -19,61 +15,59 @@ export default class LdGallery extends Vue {}
diff --git a/viewer/src/views/LdGallery.vue b/viewer/src/views/LdGallery.vue
deleted file mode 100644
index 04474c3..0000000
--- a/viewer/src/views/LdGallery.vue
+++ /dev/null
@@ -1,100 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/viewer/src/views/MainLayout.vue b/viewer/src/views/MainLayout.vue
new file mode 100644
index 0000000..9f3a17b
--- /dev/null
+++ b/viewer/src/views/MainLayout.vue
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/viewer/src/views/Root.vue b/viewer/src/views/Root.vue
deleted file mode 100644
index 384dcbe..0000000
--- a/viewer/src/views/Root.vue
+++ /dev/null
@@ -1,18 +0,0 @@
-
- Hello World!
-
-
-
-
-
--
cgit v1.2.3
From 91d3148f97ca59769648f9307f3d7e65b1bd7e95 Mon Sep 17 00:00:00 2001
From: Zero~Informatique
Date: Sat, 21 Dec 2019 11:04:14 +0100
Subject: viewer: ESLint rules
---
viewer/src/views/Gallery.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'viewer/src')
diff --git a/viewer/src/views/Gallery.vue b/viewer/src/views/Gallery.vue
index 3625838..55b93db 100644
--- a/viewer/src/views/Gallery.vue
+++ b/viewer/src/views/Gallery.vue
@@ -44,7 +44,7 @@ export default class Root extends Vue {
return null;
}
- private checkType(type: string) {
+ private checkType(type: string): boolean {
return (this.currentItem && this.currentItem.properties.type === type) || false;
}
}
--
cgit v1.2.3
From 57d1b89d314970bf56d3d398c393f6a67a4ed0b5 Mon Sep 17 00:00:00 2001
From: Zero~Informatique
Date: Sat, 21 Dec 2019 20:14:33 +0100
Subject: viewer: Isolated the Directory and Image views in their own
components
---
viewer/src/views/Gallery.vue | 15 +++++++--------
viewer/src/views/GalleryDirectory.vue | 20 ++++++++++++++++++++
viewer/src/views/GalleryImage.vue | 17 +++++++++++++++++
3 files changed, 44 insertions(+), 8 deletions(-)
create mode 100644 viewer/src/views/GalleryDirectory.vue
create mode 100644 viewer/src/views/GalleryImage.vue
(limited to 'viewer/src')
diff --git a/viewer/src/views/Gallery.vue b/viewer/src/views/Gallery.vue
index 55b93db..10ff323 100644
--- a/viewer/src/views/Gallery.vue
+++ b/viewer/src/views/Gallery.vue
@@ -1,19 +1,18 @@
-
-
Directory: {{currentItem.path}}
-
- Thumbnail: {{index}}-{{item.path}}
-
-
-
Image: {{currentItem.path}}
+
+
+
+
diff --git a/viewer/src/views/GalleryImage.vue b/viewer/src/views/GalleryImage.vue
new file mode 100644
index 0000000..daaa504
--- /dev/null
+++ b/viewer/src/views/GalleryImage.vue
@@ -0,0 +1,17 @@
+
+
+ Image: {{image.path}}
+
+
+
+
+
+
--
cgit v1.2.3
From c2b4c5d144db17ebf2dc9de32ba25cc836831ae2 Mon Sep 17 00:00:00 2001
From: Zero~Informatique
Date: Sat, 21 Dec 2019 21:15:59 +0100
Subject: viewer: Improved the Gallery type definitions. Basic display of the
images and thumbnails example: "thumbnails" instead of "thumbs"
---
viewer/src/@types/gallery/index.d.ts | 12 +++++++++---
viewer/src/views/Gallery.vue | 8 +-------
viewer/src/views/GalleryDirectory.vue | 18 ++++++++++++++----
viewer/src/views/GalleryImage.vue | 7 ++++++-
viewer/src/views/GalleryThumbnail.vue | 23 +++++++++++++++++++++++
5 files changed, 53 insertions(+), 15 deletions(-)
create mode 100644 viewer/src/views/GalleryThumbnail.vue
(limited to 'viewer/src')
diff --git a/viewer/src/@types/gallery/index.d.ts b/viewer/src/@types/gallery/index.d.ts
index 2dd11fb..b47c812 100644
--- a/viewer/src/@types/gallery/index.d.ts
+++ b/viewer/src/@types/gallery/index.d.ts
@@ -1,4 +1,10 @@
declare namespace Gallery {
+ interface Image extends Item {
+ properties: ImageProperties,
+ }
+ interface Directory extends Item {
+ properties: DirectoryProperties,
+ }
interface Item {
title: string,
date: string,
@@ -8,9 +14,9 @@ declare namespace Gallery {
thumbnail: {
path: string,
},
- properties: Image | Directory,
+ properties: ImageProperties | DirectoryProperties,
}
- interface Image {
+ interface ImageProperties {
type: "image",
filesize: number,
resolution: {
@@ -18,7 +24,7 @@ declare namespace Gallery {
height: number,
}
}
- interface Directory {
+ interface DirectoryProperties {
type: "directory",
items: Item[]
}
diff --git a/viewer/src/views/Gallery.vue b/viewer/src/views/Gallery.vue
index 10ff323..954903a 100644
--- a/viewer/src/views/Gallery.vue
+++ b/viewer/src/views/Gallery.vue
@@ -1,5 +1,5 @@
-
+
@@ -50,10 +50,4 @@ export default class Root extends Vue {
diff --git a/viewer/src/views/GalleryDirectory.vue b/viewer/src/views/GalleryDirectory.vue
index bed1664..1dda027 100644
--- a/viewer/src/views/GalleryDirectory.vue
+++ b/viewer/src/views/GalleryDirectory.vue
@@ -1,20 +1,30 @@
Directory: {{directory.path}}
-
-
Thumbnail: {{index}}-{{item.path}}
+
diff --git a/viewer/src/views/GalleryImage.vue b/viewer/src/views/GalleryImage.vue
index daaa504..07f8cc8 100644
--- a/viewer/src/views/GalleryImage.vue
+++ b/viewer/src/views/GalleryImage.vue
@@ -1,6 +1,7 @@
Image: {{image.path}}
+
@@ -8,8 +9,12 @@
import { Component, Vue, Prop } from "vue-property-decorator";
@Component
-export default class GalleryDirectory extends Vue {
+export default class GalleryImage extends Vue {
@Prop({ required: true }) readonly image!: Gallery.Image;
+
+ get imageSrc() {
+ return `/gallery${this.image.path}`;
+ }
}
diff --git a/viewer/src/views/GalleryThumbnail.vue b/viewer/src/views/GalleryThumbnail.vue
new file mode 100644
index 0000000..8e3e826
--- /dev/null
+++ b/viewer/src/views/GalleryThumbnail.vue
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
--
cgit v1.2.3
From e34be1261d9219e5b2b92ebe271f609f11d55f63 Mon Sep 17 00:00:00 2001
From: Zero~Informatique
Date: Sun, 22 Dec 2019 03:50:40 +0100
Subject: vewer: Tags indexing and search input
---
viewer/src/@types/tag/index.d.ts | 8 +++++++
viewer/src/components/LdTagInput.vue | 40 +++++++++++++++++++++++++++++++++++
viewer/src/locales/en.json | 4 +++-
viewer/src/store/galleryStore.ts | 41 ++++++++++++++++++++++++++++++++----
viewer/src/store/uiStore.ts | 5 ++++-
viewer/src/views/Gallery.vue | 6 +++---
viewer/src/views/MainLayout.vue | 7 ++++--
viewer/src/views/PanelLeft.vue | 20 ++++++++++++++++++
8 files changed, 120 insertions(+), 11 deletions(-)
create mode 100644 viewer/src/@types/tag/index.d.ts
create mode 100644 viewer/src/components/LdTagInput.vue
create mode 100644 viewer/src/views/PanelLeft.vue
(limited to 'viewer/src')
diff --git a/viewer/src/@types/tag/index.d.ts b/viewer/src/@types/tag/index.d.ts
new file mode 100644
index 0000000..6a027d4
--- /dev/null
+++ b/viewer/src/@types/tag/index.d.ts
@@ -0,0 +1,8 @@
+declare namespace Tag {
+ interface Node {
+ tag: string;
+ items: Gallery.Item[];
+ children: Index;
+ }
+ type Index = { [index: string]: Node };
+}
\ No newline at end of file
diff --git a/viewer/src/components/LdTagInput.vue b/viewer/src/components/LdTagInput.vue
new file mode 100644
index 0000000..4edc1ce
--- /dev/null
+++ b/viewer/src/components/LdTagInput.vue
@@ -0,0 +1,40 @@
+
+
+ {{props.option.tag}} ({{props.option.items.length}})
+ {{$t('tagInput.nomatch')}}
+
+
+
+
+
+
diff --git a/viewer/src/locales/en.json b/viewer/src/locales/en.json
index d966983..f24ac1f 100644
--- a/viewer/src/locales/en.json
+++ b/viewer/src/locales/en.json
@@ -1,3 +1,5 @@
{
- "message": "hello i18n !!"
+ "tagInput.placeholder": "Tags",
+ "panelLeft.title": "Filters",
+ "tagInput.nomatch": "No match"
}
\ No newline at end of file
diff --git a/viewer/src/store/galleryStore.ts b/viewer/src/store/galleryStore.ts
index 4751561..c875837 100644
--- a/viewer/src/store/galleryStore.ts
+++ b/viewer/src/store/galleryStore.ts
@@ -7,16 +7,49 @@ const VuexModule = createModule({
export default class GalleryStore extends VuexModule {
- galleryItems: Gallery.Item | null = null;
+ galleryItemsRoot: Gallery.Item | null = null;
+ tags: Tag.Index = {};
- @mutation setGalleryItems(galleryItems: Gallery.Item) {
- this.galleryItems = galleryItems;
+ // ---
+
+ @mutation setGalleryItemsRoot(galleryItemsRoot: Gallery.Item) {
+ this.galleryItemsRoot = galleryItemsRoot;
+ }
+
+ @mutation private setTags(tags: Tag.Index) {
+ this.tags = tags;
}
+ // ---
+
@action async fetchGalleryItems(url: string) {
fetch(url)
.then(response => response.json())
- .then(this.setGalleryItems);
+ .then(this.setGalleryItemsRoot)
+ .then(this.indexTags);
}
+ @action async indexTags() {
+ let index = {};
+ if (this.galleryItemsRoot)
+ GalleryStore.pushTagsForItem(index, this.galleryItemsRoot);
+ console.log(index);
+ this.setTags(index);
+ }
+
+ private static pushTagsForItem(index: Tag.Index, item: Gallery.Item) {
+ console.log("IndexingTagsFor: ", item.path);
+ for (const tag of item.tags) {
+ const parts = tag.split('.');
+ let lastPart: string | null = null;
+ for (const part of parts) {
+ if (!index[part]) index[part] = { tag: part, items: [], children: {} };
+ index[part].items.push(item);
+ if (lastPart) index[lastPart].children[part] = index[part];
+ lastPart = part;
+ }
+ }
+ if (item.properties.type === "directory")
+ item.properties.items.forEach(item => this.pushTagsForItem(index, item));
+ }
}
\ No newline at end of file
diff --git a/viewer/src/store/uiStore.ts b/viewer/src/store/uiStore.ts
index c4143a1..e04b507 100644
--- a/viewer/src/store/uiStore.ts
+++ b/viewer/src/store/uiStore.ts
@@ -2,12 +2,15 @@ import { createModule, mutation, action } from "vuex-class-component";
const VuexModule = createModule({
namespaced: "uiStore",
- strict: true
+ strict: false
})
export default class UIStore extends VuexModule {
fullscreen: boolean = false;
+ currentTags: Tag.Node[] = [];
+
+ // ---
@mutation toggleFullscreen() {
this.fullscreen = !this.fullscreen;
diff --git a/viewer/src/views/Gallery.vue b/viewer/src/views/Gallery.vue
index 954903a..2020280 100644
--- a/viewer/src/views/Gallery.vue
+++ b/viewer/src/views/Gallery.vue
@@ -13,7 +13,7 @@ import GalleryImage from "./GalleryImage.vue";
@Component({
components: { GalleryDirectory, GalleryImage },
})
-export default class Root extends Vue {
+export default class Gallery extends Vue {
@Prop(String) readonly pathMatch!: string;
get isDirectory(): boolean {
@@ -25,8 +25,8 @@ export default class Root extends Vue {
}
get currentItem(): Gallery.Item | null {
- const galleryItems = this.$galleryStore.galleryItems;
- if (galleryItems) return this.searchCurrentItem(galleryItems, this.pathMatch);
+ const galleryItemsRoot = this.$galleryStore.galleryItemsRoot;
+ if (galleryItemsRoot) return this.searchCurrentItem(galleryItemsRoot, this.pathMatch);
return null;
}
diff --git a/viewer/src/views/MainLayout.vue b/viewer/src/views/MainLayout.vue
index 9f3a17b..2afd4b9 100644
--- a/viewer/src/views/MainLayout.vue
+++ b/viewer/src/views/MainLayout.vue
@@ -1,7 +1,7 @@
header
-
panel
+
@@ -10,8 +10,11 @@
+
+
--
cgit v1.2.3
From dc251fffc2998f1cf4f8e9631928c4b92ac0d90e Mon Sep 17 00:00:00 2001
From: Zero~Informatique
Date: Sun, 22 Dec 2019 07:40:55 +0100
Subject: viewer: Implemented the search by tags. Pushed the special urls to
ENV.
---
viewer/src/assets/scss/buefy.scss | 24 ++++++++----------------
viewer/src/assets/scss/global.scss | 11 +++++++++++
viewer/src/components/LdModeRadio.vue | 22 ++++++++++++++++++++++
viewer/src/locales/en.json | 8 ++++++--
viewer/src/plugins/fontawesome.ts | 4 ++--
viewer/src/store/galleryStore.ts | 21 +++++++++++++++++++--
viewer/src/store/uiStore.ts | 19 +++++++++++++++++++
viewer/src/views/Gallery.vue | 31 ++++++++++++++++---------------
viewer/src/views/GalleryDirectory.vue | 5 +----
viewer/src/views/GalleryImage.vue | 2 +-
viewer/src/views/GallerySearch.vue | 25 +++++++++++++++++++++++++
viewer/src/views/GalleryThumbnail.vue | 10 ++++++++--
viewer/src/views/MainLayout.vue | 2 +-
viewer/src/views/PanelLeft.vue | 9 +++++----
14 files changed, 144 insertions(+), 49 deletions(-)
create mode 100644 viewer/src/components/LdModeRadio.vue
create mode 100644 viewer/src/views/GallerySearch.vue
(limited to 'viewer/src')
diff --git a/viewer/src/assets/scss/buefy.scss b/viewer/src/assets/scss/buefy.scss
index 5249899..b018fd3 100644
--- a/viewer/src/assets/scss/buefy.scss
+++ b/viewer/src/assets/scss/buefy.scss
@@ -5,28 +5,20 @@
@import "buefy_variables";
// 2. Setup your Custom Colors
-$linkedin: #0077b5;
-$linkedin-invert: findColorInvert($linkedin);
-$twitter: #55acee;
-$twitter-invert: findColorInvert($twitter);
-$github: #333;
-$github-invert: findColorInvert($github);
+// $linkedin: #0077b5;
+// $linkedin-invert: findColorInvert($linkedin);
@import "~bulma/sass/utilities/derived-variables";
// 3. Add new color variables to the color map.
$addColors: (
- "twitter": (
- $twitter,
- $twitter-invert
+ "green": (
+ $green,
+ $green-invert
),
- "linkedin": (
- $linkedin,
- $linkedin-invert
- ),
- "github": (
- $github,
- $github-invert
+ "purple": (
+ $purple,
+ $purple-invert
)
);
$colors: map-merge($colors, $addColors);
diff --git a/viewer/src/assets/scss/global.scss b/viewer/src/assets/scss/global.scss
index 0bfeab9..5d12976 100644
--- a/viewer/src/assets/scss/global.scss
+++ b/viewer/src/assets/scss/global.scss
@@ -12,3 +12,14 @@
.nowrap {
white-space: nowrap;
}
+
+.flex {
+ display: flex;
+}
+.flex-column {
+ display: flex;
+ flex-direction: column;
+}
+.flex-center {
+ align-items: center;
+}
diff --git a/viewer/src/components/LdModeRadio.vue b/viewer/src/components/LdModeRadio.vue
new file mode 100644
index 0000000..614bf33
--- /dev/null
+++ b/viewer/src/components/LdModeRadio.vue
@@ -0,0 +1,22 @@
+
+
+
+
+ {{$t('mode.navigation')}}
+
+
+
+ {{$t('mode.search')}}
+
+
+
+
+
+
+
diff --git a/viewer/src/locales/en.json b/viewer/src/locales/en.json
index f24ac1f..d885872 100644
--- a/viewer/src/locales/en.json
+++ b/viewer/src/locales/en.json
@@ -1,5 +1,9 @@
{
"tagInput.placeholder": "Tags",
- "panelLeft.title": "Filters",
- "tagInput.nomatch": "No match"
+ "panelLeft.filters": "Filters",
+ "tagInput.nomatch": "No match",
+ "panelLeft.mode": "Mode",
+ "mode.navigation": "Navigation",
+ "mode.search": "Search",
+ "search.no-results": "No results"
}
\ No newline at end of file
diff --git a/viewer/src/plugins/fontawesome.ts b/viewer/src/plugins/fontawesome.ts
index 9bf4dba..3af77b6 100644
--- a/viewer/src/plugins/fontawesome.ts
+++ b/viewer/src/plugins/fontawesome.ts
@@ -1,9 +1,9 @@
import Vue from "vue";
import { library } from "@fortawesome/fontawesome-svg-core";
-import { faExpandArrowsAlt } from "@fortawesome/free-solid-svg-icons";
+import { faExpandArrowsAlt, faFolder, faSearch } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
-library.add(faExpandArrowsAlt);
+library.add(faExpandArrowsAlt, faFolder, faSearch);
Vue.component("fa-icon", FontAwesomeIcon);
diff --git a/viewer/src/store/galleryStore.ts b/viewer/src/store/galleryStore.ts
index c875837..ca36a32 100644
--- a/viewer/src/store/galleryStore.ts
+++ b/viewer/src/store/galleryStore.ts
@@ -22,6 +22,7 @@ export default class GalleryStore extends VuexModule {
// ---
+ // Fetches the gallery's JSON metadata
@action async fetchGalleryItems(url: string) {
fetch(url)
.then(response => response.json())
@@ -29,14 +30,18 @@ export default class GalleryStore extends VuexModule {
.then(this.indexTags);
}
+ // Indexes the gallery
@action async indexTags() {
let index = {};
if (this.galleryItemsRoot)
GalleryStore.pushTagsForItem(index, this.galleryItemsRoot);
- console.log(index);
+ console.log("Index: ", index);
this.setTags(index);
}
+ // ---
+
+ // Pushes all tags for a root item (and its children) to the index
private static pushTagsForItem(index: Tag.Index, item: Gallery.Item) {
console.log("IndexingTagsFor: ", item.path);
for (const tag of item.tags) {
@@ -44,7 +49,7 @@ export default class GalleryStore extends VuexModule {
let lastPart: string | null = null;
for (const part of parts) {
if (!index[part]) index[part] = { tag: part, items: [], children: {} };
- index[part].items.push(item);
+ if (!index[part].items.includes(item)) index[part].items.push(item);
if (lastPart) index[lastPart].children[part] = index[part];
lastPart = part;
}
@@ -52,4 +57,16 @@ export default class GalleryStore extends VuexModule {
if (item.properties.type === "directory")
item.properties.items.forEach(item => this.pushTagsForItem(index, item));
}
+
+ // Searches for an item by path from a root item (navigation)
+ static searchCurrentItem(item: Gallery.Item, path: string): Gallery.Item | null {
+ if (path === item.path) return item;
+ if (item.properties.type === "directory" && path.startsWith(item.path)) {
+ const itemFound = item.properties.items
+ .map(item => this.searchCurrentItem(item, path))
+ .find(item => Boolean(item));
+ return itemFound || null;
+ }
+ return null;
+ }
}
\ No newline at end of file
diff --git a/viewer/src/store/uiStore.ts b/viewer/src/store/uiStore.ts
index e04b507..4a6f487 100644
--- a/viewer/src/store/uiStore.ts
+++ b/viewer/src/store/uiStore.ts
@@ -8,11 +8,30 @@ const VuexModule = createModule({
export default class UIStore extends VuexModule {
fullscreen: boolean = false;
+ mode: "navigation" | "search" = "navigation";
currentTags: Tag.Node[] = [];
// ---
+ get isModeSearch() {
+ return this.mode === "search";
+ }
+
+ get isModeNavigation() {
+ return this.mode === "navigation";
+ }
+
+ // ---
+
@mutation toggleFullscreen() {
this.fullscreen = !this.fullscreen;
}
+
+ @mutation setModeNavigation() {
+ this.mode = "navigation";
+ }
+
+ @mutation setModeSearch() {
+ this.mode = "search";
+ }
}
diff --git a/viewer/src/views/Gallery.vue b/viewer/src/views/Gallery.vue
index 2020280..38199b9 100644
--- a/viewer/src/views/Gallery.vue
+++ b/viewer/src/views/Gallery.vue
@@ -1,17 +1,20 @@
-
-
+
+
+