import { memo, PropsWithChildren, useRef } from 'react'; import { createPortal } from 'react-dom'; import { Link, useLocation } from 'react-router-dom'; import { Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerHeader, DrawerOverlay, useDisclosure, } from '@chakra-ui/react'; import { useFullscreen } from '@mantine/hooks'; import { IoArrowUp } from '@react-icons/all-files/io5/IoArrowUp'; import { IoContract } from '@react-icons/all-files/io5/IoContract'; import { IoExpand } from '@react-icons/all-files/io5/IoExpand'; import { IoLockClosedOutline } from '@react-icons/all-files/io5/IoLockClosedOutline'; import { IoSwapVertical } from '@react-icons/all-files/io5/IoSwapVertical'; import { navigatorConstants } from '../../../viewerConfig'; import useClickOutside from '../../hooks/useClickOutside'; import useElectronEvent from '../../hooks/useElectronEvent'; import { useClientStore } from '../../stores/clientStore'; import { useViewOptionsStore } from '../../stores/viewOptions'; import { isKeyEnter } from '../../utils/keyEvent'; import { handleLinks } from '../../utils/linkUtils'; import { cx } from '../../utils/styleUtils'; import { RenameClientModal } from '../client-modal/RenameClientModal'; import style from './NavigationMenu.module.scss'; interface NavigationMenuProps { isOpen: boolean; onClose: () => void; } function NavigationMenu(props: NavigationMenuProps) { const { isOpen, onClose } = props; const id = useClientStore((store) => store.id); const name = useClientStore((store) => store.name); const { isOpen: isOpenRename, onOpen: onRenameOpen, onClose: onCloseRename } = useDisclosure(); const { fullscreen, toggle } = useFullscreen(); const { toggleMirror } = useViewOptionsStore(); const location = useLocation(); const menuRef = useRef(null); useClickOutside(menuRef, () => onClose); return createPortal( , document.body, ); } interface ClientLinkProps { current: boolean; to: string; } function ClientLink(props: PropsWithChildren) { const { current, to, children } = props; const { isElectron } = useElectronEvent(); const classes = cx([style.link, current && style.current]); if (isElectron) { return ( ); } return ( {children} ); } export default memo(NavigationMenu);