From 1f64099983e3cc377e13b455cb14bab0b3d6a634 Mon Sep 17 00:00:00 2001 From: uo283055 Date: Sun, 25 Feb 2024 18:40:57 +0100 Subject: [PATCH 1/2] seleccion respuesta correcta --- webapp/src/components/Game.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/webapp/src/components/Game.js b/webapp/src/components/Game.js index b899c00c..76ab449d 100644 --- a/webapp/src/components/Game.js +++ b/webapp/src/components/Game.js @@ -113,12 +113,9 @@ const Game=() =>{ - ); } From 90a3987382cfefd7bce091be96c131d0d7bee3c3 Mon Sep 17 00:00:00 2001 From: uo283055 Date: Sun, 25 Feb 2024 19:18:24 +0100 Subject: [PATCH 2/2] control finalizar maximo 10 preguntas --- webapp/src/components/Game.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/webapp/src/components/Game.js b/webapp/src/components/Game.js index 76ab449d..60474d6f 100644 --- a/webapp/src/components/Game.js +++ b/webapp/src/components/Game.js @@ -13,7 +13,7 @@ const Game=() =>{ const [respuestaCorrecta, setRespuestaCorrecta] = useState(''); const [questionType, setQuestionType] = useState('');;//para el tipo de pregunta a buscar const [answerType, setAnswerType] = useState('');;//para el tipo de respuesta a buscar - + const [numberClics, setNumberClics] = useState(1); const apiEndpoint = process.env.REACT_APP_API_ENDPOINT || 'http://localhost:8000'; @@ -89,6 +89,9 @@ const Game=() =>{ }; const handleButtonClick = () => { + + setNumberClics(numberClics + 1);//aumento el numero de clics en 1 + obtenerPreguntaAleatoria(); //pais, libro,actor, edificio if (questionType=='pais'){ @@ -105,8 +108,14 @@ const Game=() =>{ return ( + + +
-

Pregunta:

+ {numberClics > 10 ? ( +

Fin

+ ) : (<> +

Pregunta NĂºmero {numberClics} :

{questionBody} {informacionWikidata} @@ -115,9 +124,14 @@ const Game=() =>{ +
+ + )}
- ); +); + + } export default Game;