"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import styles from "../styles/navigation.module.css"; import Cookies from "js-cookie"; import { useEffect, useState } from "react"; import { useUser } from "./UserContext"; import TabsNav from "./TabsNav"; import { useRouter } from "next/navigation"; interface NavItem { id: string; label: string; href: string; } const navItems: NavItem[] = [ { id: "home", label: "Дашборд", href: "/" }, { id: "stat", label: "Статистика", href: "/stat" }, { id: "billing", label: "Финансы", href: "/billing" }, { id: "category", label: "Категории товаров", href: "/category" }, ]; const Navigation: React.FC = () => { const pathname = usePathname(); const [login, setLogin] = useState(""); const { firstName, surname } = useUser(); const router = useRouter(); useEffect(() => { if (typeof document !== "undefined") { const userLogin = Cookies.get('user_login'); if (userLogin) setLogin(userLogin); } }, []); const handleNavigationChange = (tabId: string) => { if (tabId === "home") { router.push("/"); } else if (tabId === "stat") { router.push("/stat"); } else if (tabId === "billing") { router.push("/billing"); } }; if (pathname === "/auth") return null; return ( ); }; export default Navigation;