source: frontend/src/App.jsx@ 8449b9c

Last change on this file since 8449b9c was 8449b9c, checked in by Andrej <asumanovski@…>, 2 months ago

Finance feature

  • Property mode set to 100644
File size: 3.1 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";
[708af9e]12import WeightTracking from "./pages/Dashboard/pages/Weight/WeightTracking.jsx";
13import NewWeightIntake from "./pages/Dashboard/pages/Weight/NewWeightIntake.jsx";
[8c01a1f]14import Finance from "./pages/Dashboard/pages/Finance/Finance.jsx";
[8449b9c]15import FinanceTracking from "./pages/Dashboard/pages/Finance/FinanceTracking.jsx";
16import NewIncome from "./pages/Dashboard/pages/Finance/NewIncome.jsx";
[8c01a1f]17import Investing from "./pages/Dashboard/pages/Investing/Investing.jsx";
18import InvestingTracking from "./pages/Dashboard/pages/Investing/InvestingTracking.jsx";
19import NewInvestment from "./pages/Dashboard/pages/Investing/NewInvestment.jsx";
20import Discipline from "./pages/Dashboard/pages/Discipline/Discipline.jsx";
[3ebe47c]21
22function RequireAuth({ children }) {
23 const token = localStorage.getItem("authToken");
24 if (!token) return <Navigate to="/login" replace />;
25 return children;
26}
[72053b5]27
28function App() {
[3ebe47c]29 return (
30 <div data-theme="forest" className="min-h-screen w-full">
31 <Routes>
32 <Route path="/" element={<LandingPage />} />
33 <Route path="/login" element={<Login />} />
34 <Route path="/register" element={<Register />} />
35 <Route
36 path="/dashboard"
37 element={
38 <RequireAuth>
[8c01a1f]39 <DashboardLayout />
[3ebe47c]40 </RequireAuth>
41 }
[8c01a1f]42 >
43 <Route index element={<Navigate to="control-center" replace />} />
44 <Route path="control-center" element={<ControlCenter />} />
45 <Route path="training" element={<Training />} />
46 <Route path="training/tracking" element={<TrainingTracking />} />
47 <Route
48 path="training/sessions/new"
49 element={<NewTrainingSession />}
50 />
51 <Route path="weight" element={<Weight />} />
[708af9e]52 <Route path="weight/tracking" element={<WeightTracking />} />
53 <Route path="weight/intakes/new" element={<NewWeightIntake />} />
[8c01a1f]54 <Route path="finance" element={<Finance />} />
[8449b9c]55 <Route path="finance/tracking" element={<FinanceTracking />} />
56 <Route path="finance/incomes/new" element={<NewIncome />} />
[8c01a1f]57 <Route path="investing" element={<Investing />} />
58 <Route path="investing/tracking" element={<InvestingTracking />} />
59 <Route path="investing/assets/new" element={<NewInvestment />} />
60 <Route path="discipline" element={<Discipline />} />
61 </Route>
[3ebe47c]62 <Route path="*" element={<Navigate to="/" replace />} />
63 </Routes>
64 </div>
65 );
[72053b5]66}
67
[44a42b8]68export default App;
Note: See TracBrowser for help on using the repository browser.