2024-02-28 00:39:05 +03:00
|
|
|
import Logo from "../Logo";
|
|
|
|
|
import NavItem from "./NavItem";
|
2024-03-05 02:18:30 +03:00
|
|
|
import { CameraGroupSelector } from "../filter/CameraGroupSelector";
|
|
|
|
|
import { useLocation } from "react-router-dom";
|
2024-04-19 14:34:07 +03:00
|
|
|
import GeneralSettings from "../menu/GeneralSettings";
|
|
|
|
|
import AccountSettings from "../menu/AccountSettings";
|
2024-04-11 23:54:09 +03:00
|
|
|
import useNavigation from "@/hooks/use-navigation";
|
2024-02-28 00:39:05 +03:00
|
|
|
|
|
|
|
|
function Sidebar() {
|
2024-03-05 02:18:30 +03:00
|
|
|
const location = useLocation();
|
|
|
|
|
|
2024-04-11 23:54:09 +03:00
|
|
|
const navbarLinks = useNavigation();
|
|
|
|
|
|
2024-02-28 00:39:05 +03:00
|
|
|
return (
|
2024-05-14 18:06:44 +03:00
|
|
|
<aside className="left-o scrollbar-hidden absolute inset-y-0 z-10 flex w-[52px] flex-col justify-between overflow-y-auto border-r border-secondary-highlight bg-background_alt py-4">
|
2024-02-28 00:39:05 +03:00
|
|
|
<span tabIndex={0} className="sr-only" />
|
2024-05-14 18:06:44 +03:00
|
|
|
<div className="flex w-full flex-col items-center gap-0">
|
|
|
|
|
<Logo className="mb-6 h-8 w-8" />
|
2024-03-06 03:39:37 +03:00
|
|
|
{navbarLinks.map((item) => {
|
|
|
|
|
const showCameraGroups =
|
|
|
|
|
item.id == 1 && item.url == location.pathname;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div key={item.id}>
|
|
|
|
|
<NavItem
|
|
|
|
|
className={`mx-[10px] ${showCameraGroups ? "mb-2" : "mb-4"}`}
|
2024-04-11 23:54:09 +03:00
|
|
|
item={item}
|
2024-03-06 03:39:37 +03:00
|
|
|
Icon={item.icon}
|
|
|
|
|
/>
|
|
|
|
|
{showCameraGroups && <CameraGroupSelector className="mb-4" />}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
})}
|
2024-02-28 00:39:05 +03:00
|
|
|
</div>
|
2024-05-14 18:06:44 +03:00
|
|
|
<div className="mb-8 flex flex-col items-center gap-4">
|
2024-04-01 18:31:31 +03:00
|
|
|
<GeneralSettings />
|
|
|
|
|
<AccountSettings />
|
|
|
|
|
</div>
|
2024-02-28 00:39:05 +03:00
|
|
|
</aside>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Sidebar;
|