diff --git a/connect4-ui/app/spectate/page.tsx b/connect4-ui/app/spectate/page.tsx index 6199cc2..1ed0f57 100644 --- a/connect4-ui/app/spectate/page.tsx +++ b/connect4-ui/app/spectate/page.tsx @@ -331,7 +331,6 @@ export default function SpectatePage() { send(cmd.getData("TOURNAMENT_DATA")); } } else if (msg.key === "TOURNAMENT_DATA" && msg.value) { - resetLiveGames(); setKnockoutRawData(msg.value); } break; @@ -677,7 +676,7 @@ function BracketPlayerRow({ isActive, }: { name: string | null; - playerColor: 1 | 2; + playerColor: 1 | 2 | null; isActive: boolean; }) { const isRed = playerColor === 1; @@ -692,7 +691,7 @@ function BracketPlayerRow({ : "border-gray-700 bg-gray-900 text-gray-400" }`} > - {name && ( + {name && playerColor !== null && (
@@ -856,20 +857,17 @@ function buildKnockoutBracket( const nextRound = displayRounds[roundIndex + 1]; const nextRoundPlayer = nextRound?.players[matchIndex] ?? null; const liveMatch = findLiveMatch(liveGameEntries, player1, player2); - const isProjectedRound = Boolean(round.projected); - const hasKnownPlayers = Boolean(player1 && player2); const hasAdvancedPastRound = roundIndex < rounds.length - 1 && !displayRounds[roundIndex + 1]?.projected; - const inferredCompletedRealMatch = - !isProjectedRound && hasKnownPlayers && !liveMatch; + const hasExplicitResult = Boolean(liveMatch?.result); const winner = nextRoundPlayer && (nextRoundPlayer === player1 || nextRoundPlayer === player2) ? nextRoundPlayer : resolveLiveWinner(liveMatch, tournamentWinner, player1, player2); const status = - winner || hasAdvancedPastRound || inferredCompletedRealMatch + hasExplicitResult || winner || hasAdvancedPastRound ? "completed" : liveMatch ? "live"