From 89560a61bc6e41d86acaea596762eda2da38fe50 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Mon, 9 Sep 2024 19:29:42 +0300 Subject: refactor: upload run form, lots of random shit --- frontend/src/App.tsx | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'frontend/src/App.tsx') diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index d45cd97..095cbbe 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -10,6 +10,10 @@ import Games from './pages/Games'; import Maps from './pages/Maps'; import User from './pages/User'; import Homepage from './pages/Homepage'; +import UploadRunDialog from './components/UploadRunDialog'; +import About from './pages/About'; +import { Game } from './types/Game'; +import { API } from './api/Api'; import Maplist from './pages/Maplist'; import Rankings from './pages/Rankings'; @@ -18,22 +22,44 @@ const App: React.FC = () => { const [profile, setProfile] = React.useState(undefined); const [isModerator, setIsModerator] = React.useState(true); + const [games, setGames] = React.useState([]); + + const [uploadRunDialog, setUploadRunDialog] = React.useState(false); + const [uploadRunDialogMapID, setUploadRunDialogMapID] = React.useState(undefined); + // React.useEffect(() => { // if (token) { // setIsModerator(JSON.parse(atob(token.split(".")[1])).mod) // } // }, [token]); + const _fetch_games = async () => { + const games = await API.get_games(); + setGames(games); + }; + + React.useEffect(() => { + _fetch_games(); + }, []); + + if (!games) { + return ( + <> + ) + }; + return ( <> - + setUploadRunDialog(false)} mapID={uploadRunDialogMapID} games={games} /> + setUploadRunDialog(true)} /> } /> } /> } /> - } /> - } /> - }> + } /> + }> + {setUploadRunDialog(true);setUploadRunDialogMapID(mapID)}} />}/> + } /> }> -- cgit v1.2.3