fix: show actual bot names on watch page instead of Black/White fallbacks
The gameState stream event does not carry player names, so snapshot.white/black
were always undefined and the UI fell back to the literal strings "Black" and
"White". Fix by fetching the full game object (GET /api/tournament/{id}/game/{gameId})
on page load, which includes BotRef with real names, and storing them in
dedicated whiteName/blackName fields.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
<header class="watch-head">
|
||||
<a class="back-link" routerLink="/tournaments">← Tournaments</a>
|
||||
<div class="watch-title">
|
||||
@if (snapshot?.white && snapshot?.black) {
|
||||
<span class="player">{{ snapshot!.white!.name }}</span>
|
||||
@if (whiteName && blackName) {
|
||||
<span class="player">{{ whiteName }}</span>
|
||||
<span class="vs">vs</span>
|
||||
<span class="player">{{ snapshot!.black!.name }}</span>
|
||||
<span class="player">{{ blackName }}</span>
|
||||
@if (snapshot?.round) {
|
||||
<span class="round-tag">Round {{ snapshot!.round }}</span>
|
||||
}
|
||||
@@ -24,12 +24,12 @@
|
||||
<div class="watch-layout">
|
||||
<div class="board-wrap">
|
||||
<div class="clock clock-top" [class.active]="status === 'ongoing' && turn === 'black'">
|
||||
<span class="clock-label">{{ snapshot?.black?.name ?? 'Black' }}</span>
|
||||
<span class="clock-label">{{ blackName ?? 'Black' }}</span>
|
||||
<span class="clock-time">{{ formatTime(clock?.blackTime) }}</span>
|
||||
</div>
|
||||
<app-chess-board [fen]="fen"></app-chess-board>
|
||||
<div class="clock clock-bot" [class.active]="status === 'ongoing' && turn === 'white'">
|
||||
<span class="clock-label">{{ snapshot?.white?.name ?? 'White' }}</span>
|
||||
<span class="clock-label">{{ whiteName ?? 'White' }}</span>
|
||||
<span class="clock-time">{{ formatTime(clock?.whiteTime) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user