import { Center, Flex, Image, rem, Stack, Tooltip, UnstyledButton, useMantineColorScheme } from "@mantine/core"; import { IconArrowLeft, IconBarcode, IconBox, IconBuildingWarehouse, IconCash, IconChartDots, IconDashboard, IconFileBarcode, IconHome2, IconLogout, IconMan, IconMoon, IconShoppingCart, IconSun, } from "@tabler/icons-react"; import classes from "./Navbar.module.css"; import { useAppDispatch } from "../../redux/store.ts"; import { logout } from "../../features/authSlice.ts"; import { useNavigate, useRouterState } from "@tanstack/react-router"; import { setHideNavbar } from "../../features/uiSlice.ts"; interface NavbarLinkProps { icon: typeof IconHome2; label?: string; active?: boolean; href: string; onClick?(navlink: NavbarLinkProps): void; index: number; } function NavbarLink(props: NavbarLinkProps) { const { icon: Icon, label, active, onClick } = props; return ( onClick && onClick(props)} className={classes.link} data-active={active || undefined}> ); } const mockdata = [ { icon: IconCash, label: "Сделки", href: "/leads", }, // { // icon: IconTable, // label: 'Таблица сделок', // href: '/deals' // }, { icon: IconMan, label: "Клиенты", href: "/clients", }, { icon: IconBox, label: "Услуги", href: "/services", }, { icon: IconBarcode, label: "Товары", href: "/products", }, { icon: IconFileBarcode, label: "Штрихкоды", href: "/barcode", }, { icon: IconBuildingWarehouse, label: "Склады отгрузки", href: "/shipping_warehouses", }, { icon: IconShoppingCart, label: "Маркетплейсы", href: "/marketplaces", }, { icon: IconChartDots, label: "Статистика", href: "/statistics", } ]; export function Navbar() { const dispatch = useAppDispatch(); const navigate = useNavigate(); const router = useRouterState(); const { colorScheme, toggleColorScheme } = useMantineColorScheme({ keepTransitions: true, }); const onLogoutClick = () => { dispatch(logout()); navigate({ to: "/login" }); }; const onNavlinkClick = (props: NavbarLinkProps) => { navigate({ to: props.href }); }; const links = mockdata.map((link, index) => ( )); return ( ); }