Skip to content

Commit

Permalink
Merge pull request #65 from Arquisoft/laura
Browse files Browse the repository at this point in the history
Botón respuesta correcta y tope de 10 preguntas
  • Loading branch information
uo285427 authored Feb 25, 2024
2 parents 8eaea3b + 90a3987 commit 270f6ed
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions webapp/src/components/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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'){
Expand All @@ -105,22 +108,30 @@ const Game=() =>{

return (




<div>
<h1>Pregunta: </h1>
{numberClics > 10 ? (
<p>Fin</p>
) : (<>
<h1>Pregunta Número {numberClics} :</h1>
<div>
<Typography component="h1" variant="h5" sx={{ textAlign: 'center' }}>
{questionBody} {informacionWikidata}
</Typography>

<Button variant="contained" color="primary" onClick={handleButtonClick}>
Generar pregunta
{respuestaCorrecta}
</Button>

</div>
<Button variant="contained" color="primary" size="large">
{respuestaCorrecta}
</Button>
</>
)}
</div>
);
);


}

export default Game;

0 comments on commit 270f6ed

Please sign in to comment.