From 4b3ab9eb5e6251989adee5ab01caef122fd5c2a8 Mon Sep 17 00:00:00 2001 From: Liliana Date: Sun, 28 Apr 2024 10:54:07 +0200 Subject: [PATCH] help test --- webapp/src/components/game/Game.js | 120 ----------------------------- webapp/src/help/Help.test.js | 40 ++++++++++ 2 files changed, 40 insertions(+), 120 deletions(-) delete mode 100644 webapp/src/components/game/Game.js create mode 100644 webapp/src/help/Help.test.js diff --git a/webapp/src/components/game/Game.js b/webapp/src/components/game/Game.js deleted file mode 100644 index 5516fe74..00000000 --- a/webapp/src/components/game/Game.js +++ /dev/null @@ -1,120 +0,0 @@ -import React, { useEffect, useState } from 'react'; -import { Container, Typography, Box, LinearProgress} from '@mui/material'; -import './FirstGame.css'; -import 'react-circular-progressbar/dist/styles.css'; -import axios from 'axios'; -import { useLocation, useNavigate } from 'react-router-dom'; -import Button from '../Button'; -import GoBackButton from '../GoBackButton'; -import { Footer } from '../footer/Footer'; -import { Nav } from '../nav/Nav'; -import {shuffleArray} from '../Util' - -var questions = []; -var points = 0; -var load = true; - -const Game = () => { - - const [remTime, setRemTime] = useState(0); - - - useEffect(() => { - const time = setInterval(() => { - setRemTime((progress) => { - if(progress === 100){ - newQuestion(); - return 0; - } - const diff = 4; - return load? Math.min(progress + diff, 100) : progress; - }); - }, 400); - - return () => { - clearInterval(time); - }; - }); - - - const esperar = (ms) => { - return new Promise(resolve => setTimeout(resolve, ms)); - }; - - const getQuestions = async () => { - - }; - - const gameStore = async () => { - try { - var username = localStorage.getItem("username") - console.log(username) - console.log(questions) - const response = await axios.post(`${apiEndpoint}/storeGame`, { id, username, points, questions}); - questions = [] - points = 0 - console.log(response) - } catch (error) { - console.error(error) - } - }; - - const newQuestion = async () => { - - }; - - const checkAnswer = async (option) => { - - }; - - - return ( - <> -