Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuración del fin de partida, CSS de las pantallas #95

Merged
merged 6 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ jobs:
user: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
command: |

wget https://raw.githubusercontent.com/arquisoft/wiq_0/master/docker-compose.yml -O docker-compose.yml
wget https://raw.githubusercontent.com/arquisoft/wiq_0/master/.env -O .env
wget https://raw.githubusercontent.com/arquisoft/wiq_es2b/master/docker-compose.yml -O docker-compose.yml
wget https://raw.githubusercontent.com/arquisoft/wiq_es2b/master/.env -O .env
docker compose --profile prod down
docker compose --profile prod up -d --pull always


27 changes: 12 additions & 15 deletions webapp/src/components/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const Game = () => {
const [questionCounter, setQuestionCounter] = useState(0);
const [incorrectCounter, setIncorrectCounter] = useState(0);

const [numberOfQuestions, setNumberOfQuestions] = useState(10);
const [questionsToAnswer, setQuestionsToAnswer] = useState(10);
const [numberOfQuestions] = useState(3);
const [questionsToAnswer, setQuestionsToAnswer] = useState(3);
const [isFinished, setFinished] = useState(false);
const [percentage, setPercentage] = useState(0);

Expand Down Expand Up @@ -55,9 +55,16 @@ const Game = () => {
useEffect(() => {
if (isGameFinished() && !isFinished){
finishGame();
setFinished(true)
setFinished(true);
; }
}, [correctCounter]);

useEffect(() => {
if (isGameFinished() && !isFinished){
finishGame();
setFinished(true);
; }
}, [incorrectCounter]);

// This method will call the create question service
const handleShowQuestion = async () => {
Expand All @@ -84,16 +91,8 @@ const Game = () => {
button.onmouse = colorOnMousePreguntas;
});

// FIN DE LA PARTIDA
if (isGameFinished() && !isFinished){
finishGame();
setFinished(true);
}


incrementQuestion();


}catch (error){
console.error('Error:', error);
}
Expand Down Expand Up @@ -139,13 +138,11 @@ const Game = () => {

decrementQuestionsToAnswer();


if (!isFinished){
if (!isGameFinished()) {
setTimeout(() => {
handleShowQuestion();
}, 850);
}, 1000);
}

}

const isGameFinished = () => {
Expand Down
50 changes: 50 additions & 0 deletions webapp/src/components/HistoricalData.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
.contenedor {
display: flex;
flex-direction: column;
align-items: center;
}

div[title="botones"]{
display: grid;
grid-template-columns: 1fr 1fr;
align-items: center;
margin-top: 2em;
margin-bottom: 2em;
grid-gap: 2em;
}

button{
margin: 1em;
padding: 0.25em;
background-color: rgba(31, 60, 134, 0.764);
color: white;
font-size: 0.75em;
}

table {
width: 90%;
border-collapse: collapse;
color: black;
}

th, td {
padding: 0.25em;
text-align: center;
border: 0.1em solid #000;
}

th[title='pregunta'] {
background-color: rgba(41, 120, 152, 0.764);
}

th[title='correcta'] {
background-color: rgba(79, 141, 18, 0.726);
}

th[title='incorrecta'] {
background-color: rgba(230, 72, 72, 0.952);
}

td{
background-color: rgba(61, 178, 224, 0.764);
}
15 changes: 8 additions & 7 deletions webapp/src/components/HistoricalData.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import axios from 'axios';
import React, { useState} from 'react';
import { useNavigate} from 'react-router-dom';
import { Container, Button} from '@mui/material';
import './HistoricalData.css';

const HistoricalData = () => {
const navigate = useNavigate();
Expand All @@ -26,9 +27,9 @@ const HistoricalData = () => {

return (

<Container component="main" maxWidth="xs" sx={{ marginTop: 4 }}>
<Container component="main" maxWidth="xs" sx={{ marginTop: 4 }} className='contenedor' >

<div>
<div title='botones'>
<Button variant="contained" color="primary" onClick={handlePreviousPage}>
Página anterior
</Button>
Expand All @@ -41,11 +42,11 @@ const HistoricalData = () => {
<table>
<thead>
<tr>
<th>Pregunta</th>
<th>Opción correcta</th>
<th>Opción incorrecta 1</th>
<th>Opción incorrecta 2</th>
<th>Opción incorrecta 3</th>
<th title='pregunta'>Pregunta</th>
<th title='correcta'>Opción correcta</th>
<th title='incorrecta'>Opción incorrecta 1</th>
<th title='incorrecta'>Opción incorrecta 2</th>
<th title='incorrecta'>Opción incorrecta 3</th>
</tr>
</thead>
<tbody>
Expand Down
1 change: 1 addition & 0 deletions webapp/src/components/MainPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const MainPage = () => {
navigate(path);
};


return (
<Container component="main" maxWidth="xs" sx={{ marginTop: 4 }}>
<div title='main'>
Expand Down