'use client'; import { CircleX } from 'lucide-react'; import TarokkaDeck from '@/lib/TarokkaDeck'; import getURL from '@/tools/getURL'; import { Deck, Settings, TarokkaGameCard } from '@/types'; const tarokkaDeck = new TarokkaDeck(); type CardSelectProps = { closeAction: () => void; selectAction: (cardID: string) => void; hand: TarokkaGameCard[]; settings: Settings; show: Deck | null; className?: string; }; export default function CardSelect({ closeAction, selectAction, hand, settings, show, className = '', }: CardSelectProps) { const handIDs = hand.map(({ id }) => id); const handleClose = (event: React.MouseEvent) => { if (event.target === event.currentTarget) { closeAction(); } }; if (!show) return null; const cards = show === 'high' ? tarokkaDeck.getHigh() : tarokkaDeck.getLow(); return (
{cards .filter(({ id }) => !handIDs.includes(id)) .map((card) => (
selectAction(card.id)} > {card.aria}
))}
); }