aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/App.tsx
diff options
context:
space:
mode:
authorArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2024-09-03 00:08:53 +0300
committerArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2024-09-03 00:08:53 +0300
commita65d6d9127c3fa7f6a8ecaec5d1ffd1f47c2bc98 (patch)
treeedf8630e9d6426124dd49854af0cb703ebc5b710 /frontend/src/App.tsx
parentfix: revert to static homepage (#195) (diff)
downloadlphub-a65d6d9127c3fa7f6a8ecaec5d1ffd1f47c2bc98.tar.gz
lphub-a65d6d9127c3fa7f6a8ecaec5d1ffd1f47c2bc98.tar.bz2
lphub-a65d6d9127c3fa7f6a8ecaec5d1ffd1f47c2bc98.zip
refactor: port to typescript
Diffstat (limited to 'frontend/src/App.tsx')
-rw-r--r--frontend/src/App.tsx40
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 @@
1import React from 'react';
2import { Routes, Route } from "react-router-dom";
3
4import { UserProfile } from './types/Profile';
5import Sidebar from './components/Sidebar';
6import "./App.css";
7
8import Profile from './pages/Profile';
9import Games from './pages/Games';
10import Maps from './pages/Maps';
11import User from './pages/User';
12
13
14const 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
40export default App;