blob: d75636fc0198d1090c6829d85e393352becf6f08 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
import React from 'react';
import { BrowserRouter, Routes, Route} from "react-router-dom";
import Sidebar from "./components/sidebar.js"
import Main from "./components/main.js"
import "./App.css";
import Summary from "./components/pages/summary.js"
import About from './components/pages/about.js';
export default function App() {
const [token, setToken] = React.useState(null);
const [mod,setMod] = React.useState(false)
React.useEffect(()=>{
if(token!==null){
setMod(JSON.parse(atob(token.split(".")[1])).mod)
}
},[token])
return (
<>
<BrowserRouter>
<Sidebar token={token} setToken={setToken}/>
<Routes>
<Route index element={<Main text="Homepage"/>}></Route>
<Route path="/news" element={<Main text="News"/>}></Route>
<Route path="/records" element={<Main text="Records"/>}></Route>
<Route path="/leaderboards" element={<Main text="Leaderboards"/>}></Route>
<Route path="/discussions" element={<Main text="Discussion"/>}></Route>
<Route path="/scorelog" element={<Main text="Score logs"/>}></Route>
<Route path="/profile" element={<Main text="Profile"/>}></Route>
<Route path="/rules" element={<Main text="Rules"/>}></Route>
<Route path="/about" element={<About/>}></Route>
<Route path="/maps/*" element={<Summary token={token} mod={mod}/>}></Route>
<Route path="*" element={<Main text="404 Page not found"/>}></Route>
</Routes>
</BrowserRouter>
</>
)
}
|