diff --git a/README.md b/README.md index 325d6af..b735bef 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Arquisoft_wiq_en3a&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Arquisoft_wiq_en3a) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=Arquisoft_wiq_en3a&metric=coverage)](https://sonarcloud.io/summary/new_code?id=Arquisoft_wiq_en3a) -# wiq_en3a -Thank you for checking out wiq_en3a! Below are some useful links to get started: +# Are you smarter than a penguin? 🐧 +Thank you for checking out our game! Below are some useful links to get started: - **[Application](http://51.103.210.249:3000/)**: Click this link to start playing! @@ -11,20 +11,19 @@ Thank you for checking out wiq_en3a! Below are some useful links to get started: - **[OpenAPI](http://51.103.210.249:8000/api-doc/)**: Explore detailed documentation of our API. -Feel free to explore the application and documentation, and don't hesitate to reach out if you have any questions or feedback. Enjoy playing wiq_en3a! +Feel free to explore the application and documentation, and don't hesitate to reach out if you have any questions or feedback. Enjoy playing STAP! -## Welcome to WIQ👩‍🎓👨‍🎓 +## Introduction -The WIQ is a web application where you can show off your knowledge. +This is a web application where you can show off your knowledge.🧠 +Experience the best of both worlds in "Are You Smarter Than a Penguin?🐧" with two exciting game modes: Normal and Trivia. + + In the Normal Game, answer general knowledge questions within a time limit🕐. If you choose Easy mode, you have more time to think through your answers, while Hard mode speeds things up with shorter time limits, adding an extra challenge. + + The Trivia Game tests your skills across five categories—Sports, Science, History, Geography, and Entertainment. Earn a "cheese🧀" for every correct answer, and collect all five to win. But watch out—you start with 6 hearts in Easy mode and only 3 in Hard mode, and if you lose them all, it's game over💕. -Creat an account or log in if you are already a member and start the engaging quiz! -Enjoy the variaty of questions, which are automatically generated from a vast pool of data available in Wikidata🌎. Each question offers multiple-choice options, including correct answer and several distractors🔍. Choose a right answer and win the prize🏆. Stay sharp and focused, there are also the time limits, --> the clock is ticking🕐 ⏳. - - -The more you know the more you win 🥇! -Play with your friends and compare the scores. Who is the smartest❓ - -🤓Let the game begin!👀🧠 +Create an account or log in to play with friends and find out who knows the most. Enjoy the variaty of questions, which are automatically generated from a vast pool of data available in Wikidata🌎. +Let's get started! diff --git a/docs/src/01_introduction_and_goals.adoc b/docs/src/01_introduction_and_goals.adoc index 5a1d871..2a53573 100644 --- a/docs/src/01_introduction_and_goals.adoc +++ b/docs/src/01_introduction_and_goals.adoc @@ -3,11 +3,11 @@ ifndef::imagesdir[:imagesdir: ../images] [[section-introduction-and-goals]] == Introduction and Goals -The WIQ web application is developed by HappySw for RTVE to create an experimental version of the Saber y Ganar quiz show. -The primary goal of WIQ is to provide users with an engaging platform where they can participate in quiz games, +The STAP (are you Smarter Than A Penguin) web application is developed for RTVE to create an experimental version of the 'Saber y Ganar' quiz show. +The primary goal of STAP is to provide users with an engaging platform where they can participate in quiz games, answer questions generated from Wikidata, and win prizes. -This document outlines the essential requirements guiding the software architects and development team in creating WIQ. +This document outlines the essential requirements guiding the software architects and development team in creating STAP. [role="arc42help"] **** @@ -119,9 +119,18 @@ Table with role names, person names, and their expectations with respect to the |=== | Role/Name | Contact | Expectations | Users | N/A | Intuitive and enjoyable quiz experience -| Professors | Pablo González (gonzalezgpablo@uniovi.es), Jose Emilio Labra (labra@uniovi.es) | The well-designed web application that fulfills the requirements -| RTVE | www.rtve.es | Reliable and engaging platform for users -| Development | Sergio Truébano Robles (uo289930@uniovi.es), Pedro Limeres Granado (uo282763@uniovi.es), Alberto Guerra Rodas (uo282421@uniovi.es), Ángel Macías Rodríguez (uo289362@uniovi.es), Rita Fernández-Catuxo Ortiz (uo284185@uniovi.es), Vira Terletska (uo305097@uniovi.es), Sergio Llenderrozos Piñera (uo283367@uniovi.es) | Clear documentation and reliable, performant and available system +| Professors | Pablo González (gonzalezgpablo@uniovi.es) + +Jose Emilio Labra (labra@uniovi.es) + +Cristian Augusto Alonso (augustocristian@uniovi.es) + +Jorge Álvarez Fidalgo (galvarezfidalgo@uniovi.es) | The well-designed web application that fulfills the requirements +| RTVE | https://www.rtve.es | Reliable and engaging platform for users +| Development | Sergio Truébano Robles (uo289930@uniovi.es) + +Pedro Limeres Granado (uo282763@uniovi.es) + + Alberto Guerra Rodas (uo282421@uniovi.es) + + Ángel Macías Rodríguez (uo289362@uniovi.es) + + Rita Fernández-Catuxo Ortiz (uo284185@uniovi.es) + + Vira Terletska (uo305097@uniovi.es) + + Sergio Llenderrozos Piñera (uo283367@uniovi.es) | Clear documentation and reliable, performant and available system |=== diff --git a/gatewayservice/gateway-service.js b/gatewayservice/gateway-service.js index d34988d..0179e3d 100644 --- a/gatewayservice/gateway-service.js +++ b/gatewayservice/gateway-service.js @@ -91,21 +91,7 @@ app.post('/getUser', async (req, res) => { app.get('/GetQuestions', async (_req, res) => { - try { - const wikiResponse = await axios.get(wikidataServiceUrl + '/getQuestions', { timeout: 10000 }); - if (wikiResponse.status !== 200) { - let statusCode = wikiResponse.status ? wikiResponse.status : 500; - - console.error('Error with the wikidata service:', statusCode); - res.status(statusCode).json({ error: 'Error with the wikidata service' }); - - } else { - res.json(wikiResponse.data); - } - } catch (error) { - console.error(error); - res.status(500).json({ error: error }); - } + getQuestions('/getQuestions', res); }); app.get('/GetCapitalsQuestions', async (_req, res) => { diff --git a/webapp/public/penguins.webp b/webapp/public/penguins.webp new file mode 100644 index 0000000..a5b9291 Binary files /dev/null and b/webapp/public/penguins.webp differ diff --git a/webapp/src/App.tsx b/webapp/src/App.tsx index a6ab857..ca773b1 100644 --- a/webapp/src/App.tsx +++ b/webapp/src/App.tsx @@ -3,6 +3,7 @@ import { loginWithToken } from './services/auth-service'; import Authentication from './components/auth/Authentication'; import { useUserStore } from './stores/user-store'; import { Home } from './components/general/Home'; +import Info from './components/general/Info'; import { BrowserRouter as Router, Route, Routes } from 'react-router-dom'; import { SimpleNav } from './components/general/SimpleNav'; import { TriviaGame } from './components/Game/Trivia/TriviaGame'; @@ -36,6 +37,7 @@ function App() { } /> }/> }/> + } /> } /> } /> diff --git a/webapp/src/components/Game/GameOver.tsx b/webapp/src/components/Game/GameOver.tsx index 52f43fd..f0a2275 100644 --- a/webapp/src/components/Game/GameOver.tsx +++ b/webapp/src/components/Game/GameOver.tsx @@ -38,7 +38,7 @@ const GameOver = (props: props) => { ) { imageToShow = images.lowScore; message = "You are NOT smarter than a penguin"; - } else if (scorePercentage < 75) { + } else if (scorePercentage < 100) { imageToShow = images.mediumScore; message = "You ARE smarter than a penguin"; } else { diff --git a/webapp/src/components/auth/AddUser.tsx b/webapp/src/components/auth/AddUser.tsx index c398613..ad40281 100644 --- a/webapp/src/components/auth/AddUser.tsx +++ b/webapp/src/components/auth/AddUser.tsx @@ -35,6 +35,12 @@ const AddUser = (props: props) => { } + const handleKeyPress = (event: { key: string; }) => { + if (event.key === 'Enter') { + registerUser(); + } + }; + return ( @@ -45,22 +51,22 @@ const AddUser = (props: props) => {
setUsername(e.target.value)} id="Username" /> + onChange={(e) => setUsername(e.target.value)} onKeyDown={handleKeyPress} id="Username" />
setEmail(e.target.value)} id="Email" /> + onChange={(e) => setEmail(e.target.value)} onKeyDown={handleKeyPress} id="Email" />
setPassword(e.target.value)} type="password" id="password" /> + onChange={(e) => setPassword(e.target.value)} onKeyDown={handleKeyPress} type="password" id="password" />
setConfirmPassword(e.target.value)} type="password" id="confirmPassword" /> + onChange={(e) => setConfirmPassword(e.target.value)} onKeyDown={handleKeyPress} type="password" id="confirmPassword" />
{error && (