From 5374f541039cee614833ba6128309208ccf8a374 Mon Sep 17 00:00:00 2001
From: paidge <paidge_cs@hotmail.com>
Date: Mon, 31 Jan 2022 13:23:22 +0100
Subject: [PATCH] add units on blockchain's parameters

---
 i18n/locales/de.json                 |  2 +-
 i18n/locales/en.json                 |  2 +-
 i18n/locales/es.json                 |  2 +-
 i18n/locales/fr.json                 |  2 +-
 pages/parametres.vue                 | 31 +++++++++++++++++++++++++++-
 pages/previsions/futures_sorties.vue |  8 ++++---
 6 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/i18n/locales/de.json b/i18n/locales/de.json
index 711a407..a20e4de 100644
--- a/i18n/locales/de.json
+++ b/i18n/locales/de.json
@@ -85,7 +85,7 @@
 	"infos": "Informationen",
 	"inout": "Bei- und Austritte des Vertrauensnetz in den 2 letzten Tagen",
 	"inpreparation": "In Vorbereitung",
-	"jours": "0 Tage | 1 Tag | {n} Tage",
+	"jours": "0&nbsp;Tage | 1&nbsp;Tag | {n}&nbsp;Tage",
 	"lexique": "Lexicon",
 	"membre": {
 		"calculant": {
diff --git a/i18n/locales/en.json b/i18n/locales/en.json
index d1e6a03..abece6e 100644
--- a/i18n/locales/en.json
+++ b/i18n/locales/en.json
@@ -86,7 +86,7 @@
 	"infos": "Informations",
 	"inout": "Entries and exits of the web of trust for the last 2 days",
 	"inpreparation": "In preparation",
-	"jours": "0 days | 1 day | {n} days",
+	"jours": "0&nbsp;days | 1&nbsp;day | {n}&nbsp;days",
 	"lexique": "Lexicon",
 	"membre": {
 		"calculant": {
diff --git a/i18n/locales/es.json b/i18n/locales/es.json
index 48ec2cf..8ef0f7b 100644
--- a/i18n/locales/es.json
+++ b/i18n/locales/es.json
@@ -86,7 +86,7 @@
 	"infos": "Informaciones",
 	"inout": "Entradas y salidas de la red de confianza en los últimos 2 días",
 	"inpreparation": "En preparación",
-	"jours": "0 días | 1 día | {n} días",
+	"jours": "0&nbsp;días | 1&nbsp;día | {n}&nbsp;días",
 	"lexique": "Léxico",
 	"membre": {
 		"calculant": {
diff --git a/i18n/locales/fr.json b/i18n/locales/fr.json
index 8ab132d..9ab92d4 100644
--- a/i18n/locales/fr.json
+++ b/i18n/locales/fr.json
@@ -86,7 +86,7 @@
 	"infos": "Informations",
 	"inout": "Entrées et sorties de la toile de confiance des 2 derniers jours",
 	"inpreparation": "En préparation",
-	"jours": "0 jours | 1 jour | {n} jours",
+	"jours": "0&nbsp;jours | 1&nbsp;jour | {n}&nbsp;jours",
 	"lexique": "Lexique",
 	"membre": {
 		"calculant": {
diff --git a/pages/parametres.vue b/pages/parametres.vue
index c581da2..7ac030d 100644
--- a/pages/parametres.vue
+++ b/pages/parametres.vue
@@ -20,7 +20,19 @@
 							<td class="d-none d-sm-table-cell">
 								{{ param.par_type }}
 							</td>
-							<td>{{ param.value }}</td>
+							<td
+								v-if="param.par_type == 'DURATION'"
+								v-html="getDuration(param.value)"></td>
+							<td v-else-if="param.par_type == 'DATE'">
+								{{ $d(new Date(param.value * 1000), "short") }}
+							</td>
+							<td v-else-if="param.par_type == 'FLOAT'">
+								{{ param.value * 100 + "%" }}
+							</td>
+							<td
+								v-else-if="param.name == 'ud0'"
+								v-html="param.value / 100 + '&nbsp;Äž1'"></td>
+							<td v-else>{{ param.value }}</td>
 							<td
 								class="d-none d-md-table-cell"
 								v-html="$t('params.name.' + param.name)"></td>
@@ -51,6 +63,23 @@ export default {
 			error: null
 		}
 	},
+	methods: {
+		getDuration(duration) {
+			let min = Math.floor(duration / 60)
+			let sec = duration % 60
+			let h = Math.floor(min / 60)
+			min = min % 60
+			let days = Math.floor(h / 24)
+			h = h % 24
+
+			sec = sec == 0 ? "" : sec + "s"
+			min = min == 0 ? "" : min + "min"
+			h = h == 0 ? "" : h + "h"
+			days = days == 0 ? "" : this.$tc("jours", days) + "&nbsp;"
+
+			return days + h + min + sec
+		}
+	},
 	apollo: {
 		allParameters: {
 			query: PARAMS,
diff --git a/pages/previsions/futures_sorties.vue b/pages/previsions/futures_sorties.vue
index 48a9d8b..dc01ed1 100644
--- a/pages/previsions/futures_sorties.vue
+++ b/pages/previsions/futures_sorties.vue
@@ -12,9 +12,11 @@
 					aria-describedby="periodHelp"
 					v-model="period"
 					@change="save">
-					<option v-for="index in 30" :key="index" :value="index">
-						{{ $tc("jours", index) }}
-					</option>
+					<option
+						v-for="index in 30"
+						:key="index"
+						:value="index"
+						v-html="$tc('jours', index)"></option>
 				</select>
 				<small id="periodHelp" class="form-text text-muted">{{
 					$t("previsions.period.desc")
-- 
GitLab