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

Implementación CSS de HistoricalData y otros cambios #91

Closed
wants to merge 1 commit into from
Closed
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
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
39 changes: 39 additions & 0 deletions webapp/src/components/HistoricalQuestions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import axios from 'axios';
import React, { useState} from 'react';
import { useNavigate} from 'react-router-dom';
import { Container, Button} from '@mui/material';

const HistoricalQuestions = () => {
const navigate = useNavigate();
const apiEndpoint = process.env.REACT_APP_API_ENDPOINT || 'http://localhost:8000';

const [questionsHistory, setQuestionsHistory] = useState([]);

const handleShowHistory = async () => {
try{
// It makes a petition to the api and store the response
const response = await axios.post(`${apiEndpoint}/getquestionshistory`, { });
setQuestionsHistory(response.data);
}catch (error){
console.error('Error:', error);
}
}

const handlePreviousPage = async () => {
let path= '/MainPage';
navigate(path);
}

return (

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

<div>

</div>
</Container>

);
};

export default HistoricalQuestions;
8 changes: 8 additions & 0 deletions webapp/src/components/MainPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ const MainPage = () => {
navigate(path);
};

const handleShowHistoricalQuestions = () => {
let path= '/HistoricalQuestions';
navigate(path);
};

return (
<Container component="main" maxWidth="xs" sx={{ marginTop: 4 }}>
<div title='main'>
Expand All @@ -33,6 +38,9 @@ const MainPage = () => {
<Button variant="contained" color="primary" onClick={handleShowHistoricalData}>
Histórico de partidas
</Button>
<Button variant="contained" color="primary" onClick={handleShowHistoricalQuestions}>
Histórico de preguntas
</Button>
</div>
</Container>
)
Expand Down