source: frontend/src/pages/Dashboard/components/DashboardSidebar.jsx@ 8c01a1f

Last change on this file since 8c01a1f 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: 3.1 KB
Line 
1import React from "react";
2import { NavLink, useLocation } from "react-router-dom";
3
4import {
5 Button,
6 Sidebar,
7 SidebarContent,
8 SidebarHeader,
9 SidebarMenu,
10 SidebarMenuButton,
11 SidebarMenuItem,
12} from "@relume_io/relume-ui";
13
14import {
15 MdTune,
16 MdFitnessCenter,
17 MdMonitorWeight,
18 MdAccountBalanceWallet,
19 MdTrendingUp,
20 MdChecklist,
21 MdAdd,
22} from "react-icons/md";
23
24import logo from "../../../assets/logo.png";
25
26const navItems = [
27 { title: "Control Center", to: "/dashboard/control-center", icon: MdTune },
28 { title: "Training", to: "/dashboard/training", icon: MdFitnessCenter },
29 { title: "Weight", to: "/dashboard/weight", icon: MdMonitorWeight },
30 { title: "Finance", to: "/dashboard/finance", icon: MdAccountBalanceWallet },
31 { title: "Investing", to: "/dashboard/investing", icon: MdTrendingUp },
32 { title: "Discipline", to: "/dashboard/discipline", icon: MdChecklist },
33];
34
35const DashboardSidebar = () => {
36 const location = useLocation();
37
38 return (
39 <Sidebar
40 className="py-6"
41 closeButtonClassName="fixed top-4 right-4"
42 collapsible="none"
43 >
44 <SidebarHeader className="hidden lg:block">
45 <NavLink to="/" className="flex items-center gap-3 px-2">
46 <img src={logo} alt="Trekr" className="h-10 w-auto rounded-2xl" />
47 </NavLink>
48 </SidebarHeader>
49
50 <SidebarContent className="mt-6">
51 <SidebarMenu>
52 {navItems.map((item) => (
53 <SidebarMenuItem key={item.title}>
54 {(() => {
55 const isActive =
56 location.pathname === item.to ||
57 location.pathname.startsWith(`${item.to}/`);
58
59 return (
60 <SidebarMenuButton
61 asChild
62 isActive={isActive}
63 className={
64 isActive
65 ? "!bg-green-400 !text-black hover:!bg-green-400 active:!bg-green-400"
66 : ""
67 }
68 >
69 <NavLink
70 to={item.to}
71 className="flex w-full items-center gap-3"
72 >
73 <item.icon
74 className={
75 isActive
76 ? "size-6 shrink-0 text-black"
77 : "size-6 shrink-0"
78 }
79 />
80 <span className={isActive ? "text-black" : ""}>
81 {item.title}
82 </span>
83 </NavLink>
84 </SidebarMenuButton>
85 );
86 })()}
87 </SidebarMenuItem>
88 ))}
89 </SidebarMenu>
90
91 <div className="mt-6 px-2">
92 <Button
93 variant="secondary"
94 className="w-full justify-start gap-2 !bg-green-400 !text-black hover:!bg-green-500"
95 type="button"
96 >
97 <MdAdd className="size-5" />
98 <span>Add Custom</span>
99 </Button>
100 </div>
101 </SidebarContent>
102 </Sidebar>
103 );
104};
105
106export default DashboardSidebar;
Note: See TracBrowser for help on using the repository browser.