diff --git a/webapp/src/App.css b/webapp/src/App.css index 50b63a3..f09c515 100644 --- a/webapp/src/App.css +++ b/webapp/src/App.css @@ -16,3 +16,7 @@ .App-link { color: #61dafb; } + +.Container { + margin-top: 25px; +} \ No newline at end of file diff --git a/webapp/src/App.js b/webapp/src/App.js index 9fac52a..f796e62 100644 --- a/webapp/src/App.js +++ b/webapp/src/App.js @@ -1,47 +1,31 @@ import './App.css'; -import React, { useState, useEffect, useCallback } from 'react'; +import React from 'react' import { BrowserRouter, Routes, Route, -} from "react-router-dom"; +} from "react-router-dom" -import Header from "./Header" -import Leaderboard from "./Leaderboard"; -import GameProposal from "./GameProposal"; +import Header from "./components/Header" +import Leaderboard from "./components/Leaderboard" +import GameProposal from "./components/GameProposal" +import DataPolling from './components/DataPolling'; + +//import { UserProvider } from "../contexts/UserProvider" +//import { GameProposalProvider } from './context/GameProposal'; function App() { - const [games, setGames] = useState(null); - const [polling, setPolling] = useState(false); - - const pollGames = useCallback(() => { - if (polling) - return; - - setPolling(true); - fetch('/api/gamestate') - .then(response => response.json()) - .then(data => { - setGames(data); - setPolling(false); - }) - .catch(err => console.log(err.message)); - }, [polling]); - - useEffect(() => { - const timer = setInterval(pollGames(), 35 * 1000); // <<-- poll new gamestates every 35 sec - return clearInterval(timer); - }, [pollGames]) return
-