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

Game menu view #49

Merged
merged 9 commits into from
Mar 6, 2024
12 changes: 8 additions & 4 deletions docs/src/01_introduction_and_goals.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ These include
****

=== Requirements Overview
The system will follow the functionality of the "Saber y Ganar" TV program, and so it will allow the users to select an answer between some options.
The questions and answers will be automatically generated using the WikiData API, that will also determine which of the answers is in fact the correct one.
The system will also store the historical data of the users and will be accessible through the web.
The system will follow the functionality of the "Saber y Ganar" TV program, and so it will allow the users to select an answer between some options. +
The questions and answers will be automatically generated using the WikiData API, that will also determine which of the answers is in fact the correct one. +
In adition to this, the system will also store the historical data of the users, thanks to the login and registering service featured in the application, and users will be able to access their information. +
The application will have at least English as an available language. +
Moreover, the project will be stored and deployed through GitHub. +
Lastly, the system will give access to non sensitive user's information through a public API as well as another API for the questions generated.


[role="arc42help"]
****
Expand Down Expand Up @@ -53,7 +57,7 @@ See https://docs.arc42.org/section-1/[Introduction and Goals] in the arc42 docum
|Quality attribute|Scenario
| Usability | The user must be able to understand the function of the application before the minute mark.
| Performance | The application will be able to operate within reasonable response times, taking into account the already present waiting times (time to answer, between questions, etc).
| Security | The information stored about a user can only be accessed by said user, never others.
| Security & Privacy | The information stored about a user can only be accessed by said user, never others.
| Robustness | The application will be able to handle any user error that could happen at runtime.
| Accessibility | The application will be accessible by all users, even if the suffer from visual impediments such as colorblindness.
|===
Expand Down
26 changes: 13 additions & 13 deletions docs/src/06_runtime_view.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ entity Backend as "Webapp Backend"
database Wikidata
User -> Frontend: next question
Frontend -> Backend: get question
Backend -> Wikidata: request data
Backend -> Wikidata: request data\n(1s timeout)
Wikidata -> Backend: receive data
Backend -> Backend: generate question
Backend -> Frontend: return question and answers
Expand All @@ -62,11 +62,11 @@ actor User
entity Frontend as "Webapp Frontend"
entity Backend as "Webapp Backend"
database DB
User -> Frontend: answer
Frontend -> Backend: forward answer
Backend -> Backend: process answer
Backend -> DB: store result
Backend -> Frontend: return correctness
User -> Frontend: answer\n(30s timelimit)
Frontend -> Frontend: process answer
Frontend -> Backend: forward result
Backend -> DB: store result\n(1s timeout)
Backend -> Frontend: answer
Frontend -> User: show correctness
----

Expand All @@ -80,7 +80,7 @@ entity Backend as "Webapp Backend"
database DB
User -> Frontend: send credentials
Frontend -> Backend: forward credentials
Backend -> DB: query for username
Backend -> DB: query for username\n(1s timeout)
DB -> Backend: retrieve user data
Backend -> Backend: validate password
Backend -> Frontend: login successful
Expand All @@ -97,7 +97,7 @@ entity Backend as "Webapp Backend"
database DB
User -> Frontend: send credentials
Frontend -> Backend: forward credentials
Backend -> DB: query for username
Backend -> DB: query for username\n(1s timeout)
DB -> Backend: retrieve user data
Backend-> Backend: validate password
Backend -> Frontend: wrong password
Expand All @@ -116,9 +116,9 @@ entity Backend as "Webapp Backend"
database DB
User -> Frontend: send signup form
Frontend -> Backend: forward signup form
Backend -> DB: check if username exists
Backend -> DB: check if username exists\n(1s timeout)
DB -> Backend: answer
Backend -> DB: insert data
Backend -> DB: insert data\n(1s timeout)
Backend -> Frontend: signup successful
Frontend -> User: signup successful
----
Expand All @@ -133,7 +133,7 @@ entity Backend as "Webapp Backend"
database DB
User -> Frontend: send signup form
Frontend -> Backend: forward signup form
Backend -> DB: check if username exists
Backend -> DB: check if username exists\n(1s timeout)
DB -> Backend: answer
Backend -> Frontend: error: username in use
Frontend -> User: username in use
Expand All @@ -153,7 +153,7 @@ database Wikidata
User -> Frontend: next question
Frontend -> Backend: get question
Backend -> Wikidata: request data
Wikidata -> Backend: error
Wikidata -> Backend: error/timeout
Backend -> Backend: error handling
Backend -> Frontend: wikidata error
Frontend -> User: show error message
Expand All @@ -170,7 +170,7 @@ database DB
User -> Frontend: request
Frontend -> Backend: request
Backend -> DB: request
DB -> Backend: error
DB -> Backend: error/timeout
Backend -> Backend: error handling
Backend -> Frontend: DB error
Frontend -> User: show error message
Expand Down
22 changes: 22 additions & 0 deletions webapp/src/components/GameMenu/GameMenu.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
button{
width: 100%;
height: 45px;
background: darkblue;
border: none;
outline: none;
border-radius: 40px;
box-shadow: 0 0 10px black;
cursor:pointer;
font-size: 16px;
color: white;
font-weight: 700;
margin: 0.5em;
}

div{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}
27 changes: 27 additions & 0 deletions webapp/src/components/GameMenu/GameMenu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import './GameMenu.css';
export default function GameMenu() {
return (
<div>
<h2>Game</h2>
<ButtonHistoricalData />
<ButtonNewGame />
</div>
);
}

function ButtonHistoricalData() {
function handleClick() {
//ir a la vista de historical data
alert("Historical DAta");
}
return <button onClick={handleClick}>Historical Data</button>;
}

function ButtonNewGame() {
function handleClick() {
//ir a la vista de la primera pregunta
alert("New game");
}
return <button onClick={handleClick}>Create New Game</button>;
}

Loading