Skip to content

Commit

Permalink
Added buttons to game
Browse files Browse the repository at this point in the history
  • Loading branch information
uo289769 committed Mar 11, 2024
1 parent 45f7072 commit fce8d4f
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions webapp/src/components/GetQuestion.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import axios from 'axios';
import { Container, Typography, Box, Button } from '@mui/material';
import './stylesheets/GetQuestionCss.css';
import { useLocation } from "react-router-dom";
import {useNavigate} from "react-router-dom";

const GetQuestion = () => {
//all the information about the question
Expand All @@ -15,6 +16,7 @@ const GetQuestion = () => {
const [answerFeedback, setAnswerFeedback] = useState('');
const [nextQuestion, setNextQuestion] = useState(true);
const [timer, setTimer] = useState(15);
const navigate = useNavigate();

//accedo al usuario logeado
const location = useLocation();
Expand Down Expand Up @@ -58,6 +60,16 @@ const GetQuestion = () => {
}
};

const showRecord = () => {
getQuestion();
navigate("/record", {state: {username}});
};

const showHome = () => {
getQuestion();
navigate("/home", {state: {username}});
};

const saveHistorial = async (selectedAnswer, correct) => {

const username2 = username;
Expand Down Expand Up @@ -175,6 +187,20 @@ const GetQuestion = () => {
disabled={nextQuestion}>
Next question
</Button>
<Button
variant="contained"
style={{ width: '100%', fontWeight: 'bold' }}
onClick={showRecord}
disabled={nextQuestion}>
View Record
</Button>
<Button
variant="contained"
style={{ width: '100%', fontWeight: 'bold' }}
onClick={showHome}
disabled={nextQuestion}>
Home
</Button>
</div>
)}

Expand Down

0 comments on commit fce8d4f

Please sign in to comment.