import React from "react"; 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 (
{answer.userAnsweredCorrectly === true && ( <>

{currentScreenTranslations.right_answer}

)} {answer.userAnsweredCorrectly === false && ( <>

{currentScreenTranslations.wrong_answer}

)} {answer.correctAnswer === "safe" && (

{currentScreenTranslations.it_is_not_risk}

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

{currentScreenTranslations.it_is_risk}

)}

{answerExplanation}

); }