source: frontend/src/App.jsx@ 89156c1

Last change on this file since 89156c1 was 8c01a1f, checked in by Andrej <asumanovski@…>, 5 months ago

Made investing tab and adding assets, starting training tracking and adding training sessions

  • Property mode set to 100644
File size: 2.5 KB
RevLine 
[3ebe47c]1import { Navigate, Route, Routes } from "react-router-dom";
2
[793ce2c]3import LandingPage from "./pages/LandingPage/LandingPage.jsx";
[3ebe47c]4import Login from "./pages/Login/Login.jsx";
5import Register from "./pages/Register/Register.jsx";
[8c01a1f]6import DashboardLayout from "./pages/Dashboard/DashboardLayout.jsx";
7import ControlCenter from "./pages/Dashboard/pages/ControlCenter/ControlCenter.jsx";
8import Training from "./pages/Dashboard/pages/Training/Training.jsx";
9import TrainingTracking from "./pages/Dashboard/pages/Training/TrainingTracking.jsx";
10import NewTrainingSession from "./pages/Dashboard/pages/Training/NewTrainingSession.jsx";
11import Weight from "./pages/Dashboard/pages/Weight/Weight.jsx";
12import Finance from "./pages/Dashboard/pages/Finance/Finance.jsx";
13import Investing from "./pages/Dashboard/pages/Investing/Investing.jsx";
14import InvestingTracking from "./pages/Dashboard/pages/Investing/InvestingTracking.jsx";
15import NewInvestment from "./pages/Dashboard/pages/Investing/NewInvestment.jsx";
16import Discipline from "./pages/Dashboard/pages/Discipline/Discipline.jsx";
[3ebe47c]17
18function RequireAuth({ children }) {
19 const token = localStorage.getItem("authToken");
20 if (!token) return <Navigate to="/login" replace />;
21 return children;
22}
[72053b5]23
24function App() {
[3ebe47c]25 return (
26 <div data-theme="forest" className="min-h-screen w-full">
27 <Routes>
28 <Route path="/" element={<LandingPage />} />
29 <Route path="/login" element={<Login />} />
30 <Route path="/register" element={<Register />} />
31 <Route
32 path="/dashboard"
33 element={
34 <RequireAuth>
[8c01a1f]35 <DashboardLayout />
[3ebe47c]36 </RequireAuth>
37 }
[8c01a1f]38 >
39 <Route index element={<Navigate to="control-center" replace />} />
40 <Route path="control-center" element={<ControlCenter />} />
41 <Route path="training" element={<Training />} />
42 <Route path="training/tracking" element={<TrainingTracking />} />
43 <Route
44 path="training/sessions/new"
45 element={<NewTrainingSession />}
46 />
47 <Route path="weight" element={<Weight />} />
48 <Route path="finance" element={<Finance />} />
49 <Route path="investing" element={<Investing />} />
50 <Route path="investing/tracking" element={<InvestingTracking />} />
51 <Route path="investing/assets/new" element={<NewInvestment />} />
52 <Route path="discipline" element={<Discipline />} />
53 </Route>
[3ebe47c]54 <Route path="*" element={<Navigate to="/" replace />} />
55 </Routes>
56 </div>
57 );
[72053b5]58}
59
[44a42b8]60export default App;
Note: See TracBrowser for help on using the repository browser.