diff --git a/src/components/game/GameObjects.jsx b/src/components/game/GameObjects.jsx new file mode 100644 index 0000000..98f9ed2 --- /dev/null +++ b/src/components/game/GameObjects.jsx @@ -0,0 +1,43 @@ +import React from "react"; +import GameQuestion from "./GameQuestion"; +import { useGame } from "../../hooks/useGame"; + +export default function GameObjects({ blocks }) { + const { setCurrentGameModal, answers } = useGame(); + + if (!blocks) return null; + + return ( + <> + {blocks.map((block, id) => { + const hasAnswered = answers && answers[id]?.userAnswer; + return ( + {block.attrs.objectPictureAlt} console.log(block.attrs.objectBehaviourDescription)} + // onClick={() => console.log(block.attrs.objectBehaviourDescription)} + onClick={() => + setCurrentGameModal( + + ) + } + /> + ); + })} + + ); +} diff --git a/src/components/game/GameQuestion.jsx b/src/components/game/GameQuestion.jsx new file mode 100644 index 0000000..a3f5b53 --- /dev/null +++ b/src/components/game/GameQuestion.jsx @@ -0,0 +1,41 @@ +import React from "react"; +import anwserIconSafe from "../../assets/img/icons/anwser_icon_safe.svg"; +import anwserIconUnsafe from "../../assets/img/icons/anwser_icon_unsafe.svg"; + +import { useGame } from "../../hooks/useGame"; +export default function GameQuestion({ questionId, correctAnswer }, ...props) { + const { answerQuestion, contextGameDatas } = useGame(); + const objectPictureUrl = contextGameDatas.gameObjects[questionId].attrs.objectPictureUrl; + + function handleAnswer(questionId, answer) { + answerQuestion(questionId, answer); + } + + return ( +
+ {correctAnswer} +
+

Trouvé !

+

securisé ou risqué ?

+ +

+ Est-ce que la situation comporte un risque majeur ou identifiez vous un bon + comportement ? +

+
+ + +
+
+ +
+ ); +} diff --git a/src/components/game/Score.jsx b/src/components/game/Score.jsx new file mode 100644 index 0000000..bb48bbe --- /dev/null +++ b/src/components/game/Score.jsx @@ -0,0 +1,57 @@ +import React from "react"; +import { useGame } from "../../hooks/useGame"; +import anwserIconSafe from "../../assets/img/icons/anwser_icon_safe.svg"; +import anwserIconUnsafe from "../../assets/img/icons/anwser_icon_unsafe.svg"; +import sucessIcon from "../../assets/img/icons/behaviour-type-success.svg"; +import errorIcon from "../../assets/img/icons/behaviour-type-error.svg"; + +export default function Score() { + let { answers } = useGame(); + if (!answers) return; + return ( +
+ +
+ ); +}