import { useState } from 'react'; import { Icon } from '../Icon'; import { Modal } from '../Modal'; import { CreateNominationForm } from './CreateNominationForm'; import { NominationCard } from './NominationCard'; import { CallToPlayActions } from '../../hooks/useCallToPlay'; import { Game, Nomination } from '../../lib/types'; interface Props { nominations: ReadonlyArray; games: ReadonlyArray; actorId: string | null; actions: CallToPlayActions; focusId: string | null; transportReady: boolean; error: string | null; getThumbnail: (gameId: string) => string | null | undefined; totalPeerCount: number; onLaunch: (game: Game) => void; onClose: () => void; } export const CallToPlayOverlay = ({ nominations, games, actorId, actions, focusId, transportReady, error, getThumbnail, totalPeerCount, onLaunch, onClose, }: Props) => { const [showCreate, setShowCreate] = useState(false); const gameById = new Map(games.map(game => [game.id, game])); const sorted = [...nominations].sort((left, right) => Number(left.state === 'started') - Number(right.state === 'started') || left.deadline - right.deadline ); return (

Call to Play

Rally the LAN around a game and a time — right now, or scheduled for later with an “I’m in” RSVP. The caller decides when it actually starts.

{!showCreate && ( )} {!transportReady && !error && (
Connecting Call to Play to the LAN…
)} {error &&
{error}
}
{showCreate && ( setShowCreate(false)} onCreate={(gameId, maxPlayers, duration, scheduledFor) => { actions.createNomination(gameId, maxPlayers, duration, scheduledFor); setShowCreate(false); }} /> )} {sorted.length === 0 && !showCreate && (
No active calls right now — be the one to start something.
)} {sorted.map(nomination => { const game = gameById.get(nomination.gameId); if (!game) return null; return ( ); })}
); };