"use client"; import Link from "next/link"; import { useEffect, useState } from "react"; import toast from "react-hot-toast"; import BoldIcon from "@/components/ui/BoldIcon"; import { cn } from "@/lib/utils"; const tabs = [ { href: "/", icon: "home-2", label: "خانه" }, { href: "/academy", icon: "teacher", label: "آموزشگاه" }, { href: "/new-post", icon: "add-square", label: "پست ها" }, { href: "/billboards", icon: "flash-circle", label: "بیلبورد" }, { href: "/settings", icon: "setting", label: "تنظیمات" }, ] as const; type TabNavigationProps = { currentPage: string; }; export default function TabNavigation({ currentPage }: TabNavigationProps) { const [createTab, setCreateTab] = useState("/new-post"); const [userTypeS, setUserTypeS] = useState(null); const [mounted, setMounted] = useState(false); const [isDark, setIsDark] = useState(false); useEffect(() => { setMounted(true); if (typeof window !== "undefined") { const userType = localStorage.getItem("usertype"); setUserTypeS(userType); setCreateTab( userType === "user" ? "/new-post" : userType === "employer" ? "/new-project" : "/new-post" ); } }, []); useEffect(() => { if (typeof window === "undefined") return; const checkTheme = () => { const theme = localStorage.getItem("theme"); const isDarkMode = theme === "dark" || (theme === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches); setIsDark(isDarkMode); }; checkTheme(); window.addEventListener("storage", checkTheme); return () => window.removeEventListener("storage", checkTheme); }, []); if (!mounted) return null; return ( ); }