'use client'; import { useState } from 'react'; import ToolTip from '@/components/ToolTip'; import StackTheDeck from '@/components/StackTheDeck'; import tarokkaCards from '@/constants/tarokkaCards'; import getCardInfo from '@/tools/getCardInfo'; import getURL from '@/tools/getURL'; import { Layout, Settings, TarokkaGameCard } from '@/types'; const cardBack = tarokkaCards.find((card) => card.back)!; type CardProps = { dm: boolean; card: TarokkaGameCard; position: Layout; settings: Settings; flipAction: () => void; }; export default function Card({ dm, card, position, settings, flipAction }: CardProps) { const [tooltip, setTooltip] = useState(null); const { aria, flipped } = card; const handleClick = () => { if (dm) { flipAction(); } }; const getTooltip = () => { const text = getCardInfo(card, position, dm, settings); return text.length ? ( <> {text.map((t, i) => (

{t}

{i < text.length - 1 &&
}
))} ) : null; }; return (
{dm && ( <> {aria} )} Card Back {dm && !flipped && ( console.log('Redo')} onPick={() => console.log('Pick')} onHover={setTooltip} /> )}
{aria}
); }