From 920ae190fd1bf85a0fe4f46cb9bb76124b34b778 Mon Sep 17 00:00:00 2001 From: ghadi saab Date: Fri, 6 Feb 2026 18:43:33 +0100 Subject: [PATCH] fix: show Spectate instead of Keep Playing on win modal when dead Closes #3058 (#3062) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description: This PR resolves issue #3058 where the "win modal" incorrectly displayed a **"Keep Playing"** button instead of **"Spectate"** when a player's team won but the player themselves was already dead. ### The Problem In WinModal.ts, the button text logic only checked `this.isWin` (whether the team won) but didn't verify if the player was still alive. This caused dead players on winning teams to see "Keep Playing" instead of "Spectate". ### The Solution Updated the button rendering logic in `src/client/graphics/layers/WinModal.ts:82` to check both the win condition AND the player's alive status: ```typescript // Before ${this.isWin ? translateText("win_modal.keep") : translateText("win_modal.spectate")} // After ${this.isWin && this.game.myPlayer()?.isAlive() ? translateText("win_modal.keep") : translateText("win_modal.spectate")} ``` This approach maintains clean separation of concerns: - this.isWin continues to represent whether the player's team won (true/false) - The button text logic now checks both team victory and player alive status - This ensures the correct button appears based on the player's actual state Behavior After Fix - Alive players on the winning team → "Keep Playing" - Dead players on the winning team → "Spectate" - Any player on the losing team → "Spectate" Testing Performed 1. Code Audit: Verified myPlayer().isAlive() correctly reflects the eliminated state in Teams mode. 2. Build Verification: Ran npm run build and npm run build-prod to ensure no regressions in the UI layer. 3. Type Safety: Ran tsc --noEmit to confirm the fix is fully compliant with the project's TypeScript strictness. --- Closes #3058 ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: ghadi8097 --------- Co-authored-by: iamlewis --- src/client/graphics/layers/WinModal.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/graphics/layers/WinModal.ts b/src/client/graphics/layers/WinModal.ts index 3a1942ed6..a6334379b 100644 --- a/src/client/graphics/layers/WinModal.ts +++ b/src/client/graphics/layers/WinModal.ts @@ -79,7 +79,7 @@ export class WinModal extends LitElement implements Layer { @click=${this.hide} class="flex-1 px-3 py-3 text-base cursor-pointer bg-blue-500/60 text-white border-0 rounded-sm transition-all duration-200 hover:bg-blue-500/80 hover:-translate-y-px active:translate-y-px" > - ${this.isWin + ${this.game.myPlayer()?.isAlive() ? translateText("win_modal.keep") : translateText("win_modal.spectate")}