Fix bug where title box always indicated that the game was ongoing

This commit is contained in:
sepia 2025-07-20 17:44:14 -05:00
parent d3800345e5
commit 2aa8ee78a9
1 changed files with 6 additions and 0 deletions

View File

@ -203,24 +203,30 @@ export class WebSocketHandler {
switch (game.status) { switch (game.status) {
case 'waiting': { case 'waiting': {
message = "Waiting for players..."; message = "Waiting for players...";
break;
} }
case 'playing': { case 'playing': {
const blackTag = game.players.black ? this.playerTag(gameId, game.players.black) : 'Unknown'; const blackTag = game.players.black ? this.playerTag(gameId, game.players.black) : 'Unknown';
const whiteTag = game.players.white ? this.playerTag(gameId, game.players.white) : 'Unknown'; const whiteTag = game.players.white ? this.playerTag(gameId, game.players.white) : 'Unknown';
message = `${blackTag} vs ${whiteTag}`; message = `${blackTag} vs ${whiteTag}`;
break;
} }
case 'finished': { case 'finished': {
switch (game.winner) { switch (game.winner) {
case 'draw': { case 'draw': {
message = "Game ended in draw."; message = "Game ended in draw.";
break;
} }
case 'black': { case 'black': {
message = `${game.players.black} wins!`; message = `${game.players.black} wins!`;
break;
} }
case 'white': { case 'white': {
message = `${game.players.white} wins!`; message = `${game.players.white} wins!`;
break;
} }
} }
break;
} }
} }