From 928c501dda0c3580e3cb0389efc16fc1dde16b68 Mon Sep 17 00:00:00 2001
From: Zero~Informatique
Date: Sat, 3 Jul 2021 05:06:44 +0200
Subject: viewer: optional user-defined markdown splash screen

GitHub: closes #284
---
 viewer/src/views/SplashScreen.vue | 72 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 viewer/src/views/SplashScreen.vue

(limited to 'viewer/src/views/SplashScreen.vue')

diff --git a/viewer/src/views/SplashScreen.vue b/viewer/src/views/SplashScreen.vue
new file mode 100644
index 0000000..808567e
--- /dev/null
+++ b/viewer/src/views/SplashScreen.vue
@@ -0,0 +1,72 @@
+<template>
+  <b-loading v-if="isLoading" active />
+  <div v-else-if="markdown" :class="$style.splashscreen" class="scrollbar">
+    <Markdown :style="config.style" class="flex-grow-1" :markdown="markdown" />
+    <b-button size="is-large" :label="buttonAcknowledgeLabel" :class="$style.buttonAcknowledge" @click="validation" />
+  </div>
+</template>
+
+<script lang="ts">
+import { SplashScreenConfig } from "@/@types/splashscreen";
+import { Markdown } from "@/components/async";
+import FetchWithCheck from "@/services/fetchWithCheck";
+import { TranslateResult } from "vue-i18n";
+import { Component, Emit, Vue } from "vue-property-decorator";
+
+@Component({
+  components: {
+    Markdown,
+  },
+})
+export default class SplashScreen extends Vue {
+  isLoading: boolean = true;
+  markdown: string | null = null;
+
+  get config(): SplashScreenConfig {
+    return this.$uiStore.splashScreenConfig!;
+  }
+
+  created() {
+    this.fetchMarkdown();
+  }
+
+  fetchMarkdown() {
+    FetchWithCheck.get(`${process.env.VUE_APP_DATA_URL}${this.config.resource}?${this.config.dontshowagainUID ?? ""}`)
+      .then(response => response.text())
+      .then(text => (this.markdown = text))
+      .finally(() => (this.isLoading = false))
+      .catch(this.displayError);
+  }
+
+  displayError(reason: any) {
+    this.$buefy.snackbar.open({
+      message: `${reason}`,
+      actionText: this.$t("snack.retry"),
+      position: "is-top",
+      type: "is-danger",
+      indefinite: true,
+      onAction: this.fetchMarkdown,
+    });
+  }
+
+  get buttonAcknowledgeLabel(): TranslateResult {
+    return this.config.buttonAcknowledgeLabel ?? this.$t("splashScreen.button.acknowledge");
+  }
+
+  @Emit()
+  validation() {}
+}
+</script>
+
+<style lang="scss" module>
+.splashscreen {
+  display: flex;
+  flex-flow: column;
+  align-items: center;
+  padding: 32px;
+}
+.buttonAcknowledge {
+  min-width: 310px;
+  align-self: center;
+}
+</style>
-- 
cgit v1.2.3


From c28b29b12810548a5927a02ca80714fcce24a61b Mon Sep 17 00:00:00 2001
From: pacien
Date: Sun, 4 Jul 2021 18:37:46 +0200
Subject: viewer/SplashScreen: remove useless style class

---
 viewer/src/views/SplashScreen.vue | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

(limited to 'viewer/src/views/SplashScreen.vue')

diff --git a/viewer/src/views/SplashScreen.vue b/viewer/src/views/SplashScreen.vue
index 808567e..a2f499a 100644
--- a/viewer/src/views/SplashScreen.vue
+++ b/viewer/src/views/SplashScreen.vue
@@ -2,7 +2,7 @@
   <b-loading v-if="isLoading" active />
   <div v-else-if="markdown" :class="$style.splashscreen" class="scrollbar">
     <Markdown :style="config.style" class="flex-grow-1" :markdown="markdown" />
-    <b-button size="is-large" :label="buttonAcknowledgeLabel" :class="$style.buttonAcknowledge" @click="validation" />
+    <b-button size="is-large" :label="buttonAcknowledgeLabel" @click="validation" />
   </div>
 </template>
 
@@ -65,8 +65,4 @@ export default class SplashScreen extends Vue {
   align-items: center;
   padding: 32px;
 }
-.buttonAcknowledge {
-  min-width: 310px;
-  align-self: center;
-}
 </style>
-- 
cgit v1.2.3


From c83f44cd69a227f873a026c01653ef434b6ae045 Mon Sep 17 00:00:00 2001
From: Zero~Informatique
Date: Mon, 5 Jul 2021 19:10:20 +0200
Subject: viewer: viewer: optional user-defined markdown splash screen

Code review changes
---
 viewer/src/views/SplashScreen.vue | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'viewer/src/views/SplashScreen.vue')

diff --git a/viewer/src/views/SplashScreen.vue b/viewer/src/views/SplashScreen.vue
index a2f499a..dcb845d 100644
--- a/viewer/src/views/SplashScreen.vue
+++ b/viewer/src/views/SplashScreen.vue
@@ -31,7 +31,7 @@ export default class SplashScreen extends Vue {
   }
 
   fetchMarkdown() {
-    FetchWithCheck.get(`${process.env.VUE_APP_DATA_URL}${this.config.resource}?${this.config.dontshowagainUID ?? ""}`)
+    FetchWithCheck.get(`${process.env.VUE_APP_DATA_URL}${this.config.resource}?${this.config.acknowledgmentKey ?? ""}`)
       .then(response => response.text())
       .then(text => (this.markdown = text))
       .finally(() => (this.isLoading = false))
-- 
cgit v1.2.3

