From 119348acfba1851848635729973e8ecc6aae83f7 Mon Sep 17 00:00:00 2001 From: Antoine M Date: Wed, 21 Feb 2024 11:03:47 +0100 Subject: [PATCH] hadnling translations --- src/components/game/GameAnswerExplanation.jsx | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/components/game/GameAnswerExplanation.jsx b/src/components/game/GameAnswerExplanation.jsx index a5a37db..4bf8608 100644 --- a/src/components/game/GameAnswerExplanation.jsx +++ b/src/components/game/GameAnswerExplanation.jsx @@ -3,16 +3,23 @@ import { useGame } from "../../hooks/useGame"; import sucessIcon from "../../assets/img/icons/behaviour-type-success.svg"; import errorIcon from "../../assets/img/icons/behaviour-type-error.svg"; +import { useUser } from "../../hooks/useUser"; +import Loading from "../animations/Loading"; export default function GameAnwerExplanation({ questionId }) { const { answers, contextGameDatas, setCurrentGameModal, checkIfGameIsComplete } = useGame(); + const { screensTranslations } = useUser(); + + if (!screensTranslations || !screensTranslations.tutorial) return ; + const currentScreenTranslations = screensTranslations.game; + const answer = answers[questionId]; const answerExplanation = contextGameDatas.gameObjects[questionId].attrs.objectBehaviourDescription ?? "Pas d'explication pour cette question"; const objectPictureUrl = contextGameDatas.gameObjects[questionId].attrs.objectPictureUrl; - + console.log(answer); return (
@@ -20,7 +27,7 @@ export default function GameAnwerExplanation({ questionId }) { <>

- Bonne réponse ! + {currentScreenTranslations.right_answer}

- Mauvaise réponse + {currentScreenTranslations.wrong_answer} )} -

C'est un risque

+ {answer.correctAnswer === "safe" && ( +

+ {currentScreenTranslations.it_is_not_risk} +

+ )} + {answer.correctAnswer === "unsafe" && ( +

+ {currentScreenTranslations.it_is_risk} +

+ )}

{answerExplanation}