"use client"; import { Avatar, Dropdown, DropdownDivider, DropdownItem, } from "flowbite-react"; import { useUserStore } from "#/store/auth"; import Link from "next/link"; import { usePathname, useRouter } from "next/navigation"; const NavbarItems = [ { title: "Домашняя", icon: "mdi--home", href: "/", auth: false, }, { title: "Обзор", icon: "mdi--compass", href: "/discovery", auth: false, }, { title: "Поиск", icon: "mdi--search", href: "/search", auth: false, }, { title: "Закладки", icon: "mdi--bookmark-multiple", href: "/bookmarks", auth: true, }, { title: "Избранное", icon: "mdi--favorite", href: "/favorites", auth: true, }, { title: "Коллекции", icon: "mdi--collections-bookmark", href: "/collections", auth: true, }, { title: "История", icon: "mdi--history", href: "/history", auth: true, }, ]; export const NavBarPc = (props: { setIsSettingModalOpen: any }) => { const userStore = useUserStore(); const router = useRouter(); const pathname = usePathname(); return ( <>
{NavbarItems.map((item) => { if (item.auth && !userStore.isAuth) return; return ( {item.title} ); })}

{userStore.isAuth ? userStore.user.login : "Аноним"}

} > {userStore.isAuth ? router.push(`/profile/${userStore.user.id}`)} className="relative flex" > Профиль : ""} props.setIsSettingModalOpen(true)} className="relative flex" > Настройки {userStore.isAuth ? userStore.logout()} className="relative flex" > Выйти : router.push(`/login?redirect=${pathname}`)} className="relative flex" > Войти }
); };