diff --git a/webapp/src/components/HistoricalData.css b/webapp/src/components/HistoricalData.css new file mode 100644 index 00000000..1e20a1c4 --- /dev/null +++ b/webapp/src/components/HistoricalData.css @@ -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); + } \ No newline at end of file diff --git a/webapp/src/components/HistoricalData.js b/webapp/src/components/HistoricalData.js index 6e746026..379f4b8b 100644 --- a/webapp/src/components/HistoricalData.js +++ b/webapp/src/components/HistoricalData.js @@ -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(); @@ -26,9 +27,9 @@ const HistoricalData = () => { return ( - + -
+
@@ -41,11 +42,11 @@ const HistoricalData = () => { - - - - - + + + + + diff --git a/webapp/src/components/HistoricalQuestions.js b/webapp/src/components/HistoricalQuestions.js new file mode 100644 index 00000000..2e734412 --- /dev/null +++ b/webapp/src/components/HistoricalQuestions.js @@ -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 ( + + + +
+ +
+
+ + ); +}; + +export default HistoricalQuestions; \ No newline at end of file diff --git a/webapp/src/components/MainPage.js b/webapp/src/components/MainPage.js index 09ecef3c..ea0152d1 100644 --- a/webapp/src/components/MainPage.js +++ b/webapp/src/components/MainPage.js @@ -16,6 +16,11 @@ const MainPage = () => { navigate(path); }; + const handleShowHistoricalQuestions = () => { + let path= '/HistoricalQuestions'; + navigate(path); + }; + return (
@@ -33,6 +38,9 @@ const MainPage = () => { +
)
PreguntaOpción correctaOpción incorrecta 1Opción incorrecta 2Opción incorrecta 3PreguntaOpción correctaOpción incorrecta 1Opción incorrecta 2Opción incorrecta 3