import { Brush2, DocumentText, Home2, Logout } from "iconsax-react"; import { type FC, useEffect } from "react"; import { useTranslation } from "react-i18next"; import { useLocation } from "react-router-dom"; import LogoSmall from "../assets/images/logo-small.svg"; import LogoImage from "../assets/images/logo.svg"; import { Paths } from "../config/Paths"; import { clx } from "../helpers/utils"; import BuyCatalog from "./components/BuyCatalog"; import SideBarItem from "./SideBarItem"; import { useSharedStore } from "./store/sharedStore"; const SideBar: FC = () => { const { t } = useTranslation("global"); const { openSidebar, setOpenSidebar, hasSubMenu, setSubMenuName, setSubtMenu, subMenuName } = useSharedStore(); const location = useLocation(); const isActive = (path: string) => { const pathname = location.pathname; if (path === "/") return pathname === "/"; return pathname === path || pathname.startsWith(path + "/"); }; useEffect(() => { const split = location.pathname.split("/"); if (split[1] === "dashboard" || split[1] === "products") { setSubMenuName(split[1]); setSubtMenu(true); } else { setSubMenuName(""); setSubtMenu(false); } }, [location.pathname, setSubMenuName, setSubtMenu]); const iconSizeSideBar = 20; return ( <> {openSidebar &&