From 58a6da1d94593872910754a7f158c399c39207d5 Mon Sep 17 00:00:00 2001 From: Simon C Date: Mon, 24 Apr 2023 23:15:13 +0200 Subject: [PATCH] feat: Modification du design --- README.md | 4 + scripts/fetchData.js | 21 ++++- src/assets/base.css | 22 ++++- src/components/Question.vue | 130 +++++++++++++++++++------ src/components/Score.vue | 118 ++++++++++++++++------- src/components/ScoreHeader.vue | 9 +- src/components/ScoresList.vue | 167 ++++++++++++++++++++++----------- 7 files changed, 343 insertions(+), 128 deletions(-) diff --git a/README.md b/README.md index 89b4bd3..aac3380 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ Vous trouverez ici le code source de l'application de Scores de [Ceiba Conseil](https://www.ceiba-conseil.com/). +## Information + +- Les emojis ont été pris depuis le site https://twemoji-cheatsheet.vercel.app/ + ## Recommended IDE Setup [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.vscode-typescript-vue-plugin). diff --git a/scripts/fetchData.js b/scripts/fetchData.js index 5c45ab5..d69c915 100644 --- a/scripts/fetchData.js +++ b/scripts/fetchData.js @@ -47,12 +47,27 @@ async function fetchData() { const url = `/items/scores?${fields .map((item) => `fields[]=${item}`) .join("&")}`; - const data = (await fetchJSONApi(url)).data; - await fs.writeFile("./src/data.json", JSON.stringify(data), "utf8"); + const scores = (await fetchJSONApi(url)).data; + await fs.writeFile("./src/data.json", JSON.stringify(scores), "utf8"); const folder = "public/answers"; if (!existsSync(folder)) mkdirSync(folder); - for (const score of data) { + for (const score of scores) { + const uuid_score = score.image; + if (uuid_score) { + console.log(`Score image : ${folder}/${uuid_score}`); + const response = await fetchAsset(uuid_score); + try { + const thumbnail = sharp().resize({ height: 200 }).webp(); + await streamPipeline( + response.body, + thumbnail, + createWriteStream(`${folder}/${uuid_score}.webp`) + ); + } catch (err) { + console.log(err); + } + } for (const question of score.questions) { for (const answer of question.questions_id.answers) { const uuid = answer.answers_id.image; diff --git a/src/assets/base.css b/src/assets/base.css index 5bd4f85..6dc337d 100644 --- a/src/assets/base.css +++ b/src/assets/base.css @@ -12,21 +12,35 @@ /* semantic color variables for this project */ :root, body.theme-light { + --color-header-background: var(--color-green); + --color-header-text: var(--color-white); --color-background: var(--color-white); --color-text: var(--color-black); - --color-highlight: var(--color-green); - --header-size: var(--header-size-small); + --color-highlight-background: var(--color-green); + --color-highlight-text: var(--color-white); + --color-highlight-text-invert: var(--color-black); + --header-size: var(--header-size-small) } body.theme-dark { + --color-header-background: var(--color-green); + --color-header-text: var(--color-black); --color-background: var(--color-black); --color-text: var(--color-white); + --color-highlight-background: var(--color-green); + --color-highlight-text: var(--color-black); + --color-highlight-text-invert: var(--color-white); } @media (prefers-color-scheme: dark) { :root { + --color-header-background: var(--color-green); + --color-header-text: var(--color-black); --color-background: var(--color-black); --color-text: var(--color-white); + --color-highlight-background: var(--color-green); + --color-highlight-text: var(--color-black); + --color-highlight-text-invert: var(--color-white); } } @@ -51,6 +65,10 @@ html, body, #app { padding: 0; } +#app { + min-width: 320px; +} + body { color: var(--color-text); background: var(--color-background); diff --git a/src/components/Question.vue b/src/components/Question.vue index 658c470..4685473 100644 --- a/src/components/Question.vue +++ b/src/components/Question.vue @@ -30,54 +30,120 @@ function slideMove(splide, newIndex) { diff --git a/src/components/Score.vue b/src/components/Score.vue index c79eea6..7c57745 100644 --- a/src/components/Score.vue +++ b/src/components/Score.vue @@ -105,7 +105,10 @@ function answerSelected(question, answerWeight) { } function nextQuestion() { - setTimeout(() => slides.value.go(">"), 100); + setTimeout(() => { + slides.value.go(">"); + console.log(slides); + }, 100); } @@ -132,23 +135,34 @@ function nextQuestion() { @nextQuestion="nextQuestion" /> - +