import { v4 } from 'uuid'; import { CardProps } from '../../util/propTypes'; import { CardData, PlayerCards, ResourceCost } from '../../util/types'; import { useCurrentPlayer } from '../../hooks/useCurrentPlayer'; import { buyCardActions } from '../Player/ActionMethods'; import { hasMaxReserved, reserveCard } from '../Player/ActionMethods/reserveCardActions'; const { buyCard, tooExpensive } = buyCardActions; export default function Card({ data, state, setState, reserved = false, collapsed = false }: CardProps) { const currentPlayer = useCurrentPlayer(state); if (!data || !currentPlayer) return
; const purchaseDisabled = (): boolean => { // TO DO: check whether a card belongs to the current player, // if card is tagged as reserved return tooExpensive(data, state); } return ({data.gemValue.toUpperCase()}
{data.resourceCost[key as keyof ResourceCost]}
) }) }{data.points} {data.points === 1 ? 'point' : 'points'}
: null }