import React, { useState } from "react"; import NavLink from "@/Element/Button/NavLink"; import useLogin from "@/Hooks/useLogin"; import Icon from "@/Icons/Icon"; import { ProfileLink } from "@/Element/User/ProfileLink"; import { NoteCreatorButton } from "@/Element/Event/Create/NoteCreatorButton"; import classNames from "classnames"; import { useUserProfile } from "@snort/system-react"; import Avatar from "@/Element/User/Avatar"; import { useIntl } from "react-intl"; type MenuItem = { label?: string; icon?: string; link?: string; nonLoggedIn?: boolean; el?: React.ReactNode; hideReadOnly?: boolean; }; const MENU_ITEMS: MenuItem[] = [ { link: "/", icon: "home" }, { link: "/messages", icon: "mail", hideReadOnly: true }, { el: (
), hideReadOnly: true, }, { link: "/search", icon: "search" }, ]; const Footer = () => { const { publicKey, readonly } = useLogin(s => ({ publicKey: s.publicKey, readonly: s.readonly, })); const profile = useUserProfile(publicKey); const { formatMessage } = useIntl(); const readOnlyIcon = readonly && ( ); return ( ); }; const FooterNavItem = ({ item, readonly }: { item: MenuItem; readonly: boolean }) => { const [isHovered, setIsHovered] = useState(false); if (readonly && item.hideReadOnly) { return null; } if (item.el) { return item.el; } return ( setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} className={({ isActive }) => classNames({ active: isActive || isHovered }, "flex flex-grow p-4 justify-center items-center cursor-pointer") }> ); }; export default Footer;