import type { PlayerInfo, StashData } from '../types'; import CardView from './CardView'; import { displayName } from '../lib/names'; interface Props { stash: StashData | null; players: PlayerInfo[]; myOrder: number; } const ROTATIONS = [-3, 2, -1, 1]; // Entry direction by seat offset from me: 0=me(bottom) 1=left 2=top 3=right. const FLY_BY_OFFSET = ['fly-bottom', 'fly-left', 'fly-top', 'fly-right']; export default function Trick({ stash, players, myOrder }: Props) { // Seat order, starting from whoever led the trick. const playOrder = stash ? [0, 1, 2, 3].map((i) => (stash.first_player + i) % 4) : []; const nameFor = (order: number) => displayName(players.find((p) => p.order === order)?.name); const overlap = -16; const slotH = 80; if (!stash) { return
; } return (
{playOrder.map((order, i) => { const card = stash.cards[String(order)]; // Only render cards that have actually been played — no placeholder slot // for players still to play this trick. if (!card) return null; const offset = (order - myOrder + 4) % 4; return (
{nameFor(order)} {/* Outer: flies in from the player's direction. Inner: static rotation. */}
); })}
); }