source: frontend/src/App.jsx@ a8381b1

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

Custom tracking category feature complete

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