import { LogoHeader } from "./LogoHeader"; import { NavLink, useNavigate } from "react-router-dom"; import Icon from "@/Icons/Icon"; import { ProfileLink } from "../../Element/User/ProfileLink"; import Avatar from "../../Element/User/Avatar"; import useLogin from "../../Hooks/useLogin"; import { useUserProfile } from "@snort/system-react"; import { NoteCreatorButton } from "../../Element/Event/NoteCreatorButton"; import { FormattedMessage } from "react-intl"; const MENU_ITEMS = [ { label: "Home", icon: "home", link: "/", nonLoggedIn: true, }, { label: "Search", icon: "search", link: "/search", }, { label: "Notifications", icon: "bell-02", link: "/notifications", }, { label: "Messages", icon: "mail", link: "/messages", }, { label: "Deck", icon: "deck", link: "/deck", }, { label: "Settings", icon: "settings", link: "/settings", }, ]; const getNavLinkClass = (isActive: boolean) => { return isActive ? "xl:ml-1 py-4 hover:no-underline flex flex-row items-center text-nostr-purple" : "xl:ml-1 py-4 hover:no-underline hover:text-nostr-purple flex flex-row items-center"; }; export default function NavSidebar() { const { publicKey } = useLogin(s => ({ publicKey: s.publicKey, latestNotification: s.latestNotification, readNotifications: s.readNotifications, readonly: s.readonly, })); const profile = useUserProfile(publicKey); const navigate = useNavigate(); return (
{MENU_ITEMS.map(item => { if (!item.nonLoggedIn && !publicKey) { return ""; } return ( getNavLinkClass(isActive)}> {item.label} ); })} {publicKey ? (
) : (
)}
{publicKey ? ( <>
{profile?.name}
) : ( "" )}
); }