feat: Modification de l'échelle de résultat
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details

This commit is contained in:
Simon 2024-02-21 14:29:41 +01:00
parent d2f5d7d840
commit d7922166ba
2 changed files with 26 additions and 10 deletions

View File

@ -61,7 +61,7 @@ function formatScore(score) {
function getTranslation(translations, key) {
return translations.find((translation) => translation[key] == store.language);
}
const trad = getTranslation(score.translations, "languages_id")
const trad = getTranslation(score.translations, "languages_id");
const title = score ? trad.title : "";
const questions = ref(formatScore(score));
@ -88,8 +88,10 @@ function getResultsFromScore(score) {
effets: translation.length > 0 ? translation[0].effets : "",
facteur: translation.length > 0 ? translation[0].facteur : "",
pde: translation.length > 0 ? translation[0].pde : "",
title: translation.length > 0 ? translation[0].title : "",
};
});
})
.reverse();
}
const results = ref(getResultsFromScore(score));
const result = computed(() =>
@ -151,7 +153,11 @@ async function share() {
body.classList.add("print");
const dataUrl = await toPng(body, { filter: filter });
body.classList.remove("print");
const fileName = new Date().toISOString().replace(/T/, '_').replace(/\..+/, '').replaceAll(':', '-')
const fileName = new Date()
.toISOString()
.replace(/T/, "_")
.replace(/\..+/, "")
.replaceAll(":", "-");
saveAs(dataUrl, `Ceiba-score-${fileName}.png`);
sharing.value = false;
}
@ -185,14 +191,14 @@ async function share() {
<div>
<h2 class="center">{{ trad.result_title }}</h2>
<h2 class="center">{{ result.pde_qtra }}</h2>
<div class="gradient">
<div :class="'gradient size-' + results.length">
<div
v-for="(item, index) in [...Array(7).keys()]"
:class="{ active: result && result.pde_qtra === index + 1 }"
v-for="item in results"
:class="{ active: result && result.pde_qtra === item.pde_qtra }"
:key="item"
:data-title=trad.result_sigle
:data-title="trad.result_sigle"
>
{{ index + 1 }}
{{ item.title }}
</div>
</div>
<div class="details">
@ -381,8 +387,18 @@ label
text-shadow: 1px 1px 4px var(--color-highlight-text-invert),-1px -1px 4px var(--color-highlight-text-invert), -1px 1px 4px var(--color-highlight-text-invert), 1px -1px 4px var(--color-highlight-text-invert)
color: var(--color-highlight-text)
div
&.size-3 div
width: calc(100%/3)
&.size-4 div
width: calc(100%/4)
&.size-5 div
width: calc(100%/5)
&.size-6 div
width: calc(100%/6)
&.size-7 div
width: calc(100%/7)
div
text-align: center
align-self: center
font-weight: bold