import Menu from '@mui/material/Menu'; import MenuItem from '@mui/material/MenuItem'; import Divider from '@mui/material/Divider'; import Check from '@mui/icons-material/Check'; import { App } from '@app/types'; import { useZoneContextMenu } from './useZoneContextMenu'; import './ZoneContextMenu.css'; export interface ZoneContextMenuProps { isOpen: boolean; anchorPosition: { top: number; left: number } | null; gameId: number; playerId: number | null; zoneName: string | null; onClose: () => void; onRequestDrawN: () => void; onRequestDumpN: () => void; onRequestRevealTopN: () => void; onRequestRevealZone: () => void; } function ZoneContextMenu(props: ZoneContextMenuProps) { const { isOpen, anchorPosition, zoneName, onClose, onRequestDrawN, onRequestDumpN, onRequestRevealTopN, onRequestRevealZone, } = props; const { ready, alwaysReveal, alwaysLook, handleDrawOne, handleShuffle, handleRevealTop, handleToggleAlwaysReveal, handleToggleAlwaysLook, runAndClose, } = useZoneContextMenu(props); if (!ready) { return null; } const menuItems: React.ReactNode[] = []; if (zoneName === App.ZoneName.DECK) { menuItems.push( Draw a card, Draw N cards…, Shuffle, Dump top N…, , Reveal top card to all , Reveal top N to… , , {alwaysReveal ? : null} Always reveal top card , {alwaysLook ? : null} Always look at top card , ); } else if (zoneName === App.ZoneName.GRAVE) { menuItems.push( Reveal graveyard to… , ); } else if (zoneName === App.ZoneName.EXILE) { menuItems.push( Reveal exile to… , ); } else { return null; } return ( {menuItems} ); } export default ZoneContextMenu;