Skip to content

Commit

Permalink
Merge branch 'dev' into luis
Browse files Browse the repository at this point in the history
  • Loading branch information
uo277310 committed Feb 25, 2024
2 parents 36aa466 + 270f6ed commit 43af1f9
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 43af1f9

Please sign in to comment.