From a65d6d9127c3fa7f6a8ecaec5d1ffd1f47c2bc98 Mon Sep 17 00:00:00 2001
From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>
Date: Tue, 3 Sep 2024 00:08:53 +0300
Subject: refactor: port to typescript

---
 frontend/src/App.tsx | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 frontend/src/App.tsx

(limited to 'frontend/src/App.tsx')

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 @@
+import React from 'react';
+import { Routes, Route } from "react-router-dom";
+
+import { UserProfile } from './types/Profile';
+import Sidebar from './components/Sidebar';
+import "./App.css";
+
+import Profile from './pages/Profile';
+import Games from './pages/Games';
+import Maps from './pages/Maps';
+import User from './pages/User';
+
+
+const App: React.FC = () => {
+  const [token, setToken] = React.useState<string | undefined>(undefined);
+  const [profile, setProfile] = React.useState<UserProfile | undefined>(undefined);
+  const [isModerator, setIsModerator] = React.useState<boolean>(true);
+
+  // React.useEffect(() => {
+  //   if (token) {
+  //     setIsModerator(JSON.parse(atob(token.split(".")[1])).mod)
+  //   }
+  // }, [token]);
+
+  return (
+    <>
+      <Sidebar setToken={setToken} profile={profile} setProfile={setProfile} />
+      <Routes>
+        <Route path="/" element={<div>yo</div>} />
+        <Route path="/profile" element={<Profile profile={profile!} />} />
+        <Route path="/users/*" element={<User />} />
+        <Route path="/games" element={<Games />} />
+        <Route path="/maps/*" element={<Maps isModerator={isModerator} />} />
+        <Route path="*" element={"404"} />
+      </Routes>
+    </>
+  );
+};
+
+export default App;
-- 
cgit v1.2.3

