From b5e4caa44d3cf9be01c8f70c00b9fc8ec3f37e26 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 23:03:40 -0500 Subject: [PATCH] [ui-pvp] online duels render ui-duel's DuelBoard (placeholder kept only when the host sends no view) Co-Authored-By: Claude Opus 5.5 --- src/game/OnlinePlay.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/game/OnlinePlay.tsx b/src/game/OnlinePlay.tsx index bac1ca1..b459257 100644 --- a/src/game/OnlinePlay.tsx +++ b/src/game/OnlinePlay.tsx @@ -5,6 +5,8 @@ import { engineAction, resultView, uiActions, viewFromPlayerView } from './adapt import { toUICard } from './cards.ts'; import { GameCard as GameCardFace } from './GameCard.tsx'; import { MatchBoard } from './MatchBoard.tsx'; +import { DuelBoard } from './duel/DuelBoard.tsx'; +import type { DuelAction, LogEvent, PlayerView as DuelPlayerView } from './duel/contract.ts'; import { inviteUrl, online, pvp, type DuelSeat, type DuelStatus, type LobbySeat, type LobbyStatus, type OpenLobby } from './online.ts'; import type { GameMode, ResultView, UIAction } from './types.ts'; @@ -201,8 +203,18 @@ export function DuelOnlinePlay({ modeId, modeName, deck, entry, accountToken, on } catch { setCopied('Select the link above and copy it.'); } }; const opp = status?.players.find((_, i) => i !== seat?.seat)?.name ?? 'Opponent'; + const me = (seat ? status?.players[seat.seat]?.name : undefined) ?? 'You'; const eyebrow = `${modeName.toUpperCase()} ยท ${entry.kind === 'quick' ? 'QUICK MATCH' : entry.kind === 'private' ? 'PRIVATE LOBBY' : 'INVITE'}`; + if ((status?.phase === 'playing' || status?.phase === 'finished') && status.state && typeof status.state === 'object') { + // ui-duel's board (#58) on duel-core's PlayerView; it sends multi-step declarations through `act`, awaiting each. + const view = status.state as DuelPlayerView; + const events = (view as { log?: unknown }).log; + return act(a)} + opponentName={opp} playerName={me} error={error || undefined} + logEvents={Array.isArray(events) ? events as LogEvent[] : undefined} + onExit={() => void leave()} onRecap={status.phase === 'finished' && status.matchId ? () => onRecap(status.matchId!) : undefined} />; + } if (status?.phase === 'playing' || status?.phase === 'finished') { const won = status.outcome && status.outcome.winner !== null && status.outcome.winner === seat?.seat; return
-- 2.54.0