Update client UI with latest changes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Aaron D. Lee
2026-01-24 19:29:08 -05:00
parent d18cea2104
commit ac84a76c3d
3 changed files with 83 additions and 25 deletions

View File

@@ -138,7 +138,9 @@ class GolfGame {
// Game elements
this.currentRoundSpan = document.getElementById('current-round');
this.totalRoundsSpan = document.getElementById('total-rounds');
this.deckCountSpan = document.getElementById('deck-count');
this.turnInfo = document.getElementById('turn-info');
this.leaderInfo = document.getElementById('leader-info');
this.yourScore = document.getElementById('your-score');
this.muteBtn = document.getElementById('mute-btn');
this.opponentsRow = document.getElementById('opponents-row');
this.deck = document.getElementById('deck');
@@ -762,7 +764,33 @@ class GolfGame {
// Update header
this.currentRoundSpan.textContent = this.gameState.current_round;
this.totalRoundsSpan.textContent = this.gameState.total_rounds;
this.deckCountSpan.textContent = this.gameState.deck_remaining;
// Update turn info
const currentPlayer = this.gameState.players.find(p => p.id === this.gameState.current_player_id);
if (currentPlayer) {
if (currentPlayer.id === this.playerId) {
this.turnInfo.textContent = "Your turn!";
this.turnInfo.style.color = "#f4a460";
} else {
this.turnInfo.textContent = `${currentPlayer.name}'s turn`;
this.turnInfo.style.color = "#fff";
}
}
// Update leader info (by total score)
const sortedByTotal = [...this.gameState.players].sort((a, b) => a.total_score - b.total_score);
const leader = sortedByTotal[0];
if (leader && this.gameState.current_round > 1) {
this.leaderInfo.textContent = `Leader: ${leader.name} (${leader.total_score})`;
} else {
this.leaderInfo.textContent = "";
}
// Update your score
const me = this.gameState.players.find(p => p.id === this.playerId);
if (me) {
this.yourScore.textContent = me.round_score ?? 0;
}
// Update discard pile
if (this.gameState.discard_top) {