diff options
Diffstat (limited to 'frontend/src/App.tsx')
| -rw-r--r-- | frontend/src/App.tsx | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx new file mode 100644 index 0000000..555ce4c --- /dev/null +++ b/frontend/src/App.tsx | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | import React from 'react'; | ||
| 2 | import { Routes, Route } from "react-router-dom"; | ||
| 3 | |||
| 4 | import { UserProfile } from './types/Profile'; | ||
| 5 | import Sidebar from './components/Sidebar'; | ||
| 6 | import "./App.css"; | ||
| 7 | |||
| 8 | import Profile from './pages/Profile'; | ||
| 9 | import Games from './pages/Games'; | ||
| 10 | import Maps from './pages/Maps'; | ||
| 11 | import User from './pages/User'; | ||
| 12 | |||
| 13 | |||
| 14 | const App: React.FC = () => { | ||
| 15 | const [token, setToken] = React.useState<string | undefined>(undefined); | ||
| 16 | const [profile, setProfile] = React.useState<UserProfile | undefined>(undefined); | ||
| 17 | const [isModerator, setIsModerator] = React.useState<boolean>(true); | ||
| 18 | |||
| 19 | // React.useEffect(() => { | ||
| 20 | // if (token) { | ||
| 21 | // setIsModerator(JSON.parse(atob(token.split(".")[1])).mod) | ||
| 22 | // } | ||
| 23 | // }, [token]); | ||
| 24 | |||
| 25 | return ( | ||
| 26 | <> | ||
| 27 | <Sidebar setToken={setToken} profile={profile} setProfile={setProfile} /> | ||
| 28 | <Routes> | ||
| 29 | <Route path="/" element={<div>yo</div>} /> | ||
| 30 | <Route path="/profile" element={<Profile profile={profile!} />} /> | ||
| 31 | <Route path="/users/*" element={<User />} /> | ||
| 32 | <Route path="/games" element={<Games />} /> | ||
| 33 | <Route path="/maps/*" element={<Maps isModerator={isModerator} />} /> | ||
| 34 | <Route path="*" element={"404"} /> | ||
| 35 | </Routes> | ||
| 36 | </> | ||
| 37 | ); | ||
| 38 | }; | ||
| 39 | |||
| 40 | export default App; | ||