Skip to content

Conversation

@GhadiSaab
Copy link

@GhadiSaab GhadiSaab commented Jan 29, 2026

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:

// 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:

  • I have added screenshots for all UI updates
  • I process any text displayed to the user through translateText() and I've added it to the en.json file
  • I have added relevant tests to the test directory
  • 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

@CLAassistant
Copy link

CLAassistant commented Jan 29, 2026

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 29, 2026

Walkthrough

The Win modal's button label logic was changed: it now shows "Keep" only when the current player is alive; otherwise it shows "Spectate" (e.g., dead players will see "Spectate" even if their team won). No other UI structure or exported signatures were changed.

Changes

Cohort / File(s) Summary
Win Modal Logic
src/client/graphics/layers/WinModal.ts
One-line button-label change: label now depends on this.game.myPlayer()?.isAlive() (show "Keep" when alive, otherwise "Spectate"). No signature or structural changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

The match has closed, the banners set,
A watcher stayed, no grudges kept.
The modal speaks what eyes have seen,
"Spectate" for those who lost the scene. 👻🎮

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: fixing the win modal to show 'Spectate' instead of 'Keep Playing' when a player is dead.
Description check ✅ Passed The description is detailed and directly related to the changeset, explaining the problem, solution, behavior after fix, and testing performed.
Linked Issues check ✅ Passed The PR successfully addresses issue #3058 by updating WinModal.ts to check both team victory and player alive status when choosing button text, meeting the objective to show 'Spectate' for dead players even when their team wins.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the win modal button text logic as required by issue #3058, with no out-of-scope modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 29, 2026
@VariableVince VariableVince added the Bugfix Fixes a bug label Jan 29, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 30, 2026
evanpelle
evanpelle previously approved these changes Jan 31, 2026
@github-project-automation github-project-automation bot moved this from Triage to Final Review in OpenFront Release Management Jan 31, 2026
@ryanbarlow97 ryanbarlow97 added the UI/UX UI/UX changes including assets, menus, QoL, etc. label Jan 31, 2026
@ryanbarlow97 ryanbarlow97 added this to the v30 milestone Jan 31, 2026
@ryanbarlow97
Copy link
Contributor

@GhadiSaab also please update your description with the template/checkboxes

@GhadiSaab
Copy link
Author

@GhadiSaab also please update your description with the template/checkboxes

i have made the changes

@VariableVince
Copy link
Contributor

@GhadiSaab also please update your description with the template/checkboxes

i have made the changes

Thanks. If you want a re-review you can click the button to the right of evanpelle's name under Reviewers. I'll also let him know in the discord.

@GhadiSaab GhadiSaab dismissed stale reviews from evanpelle and coderabbitai[bot] via 3100558 February 4, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugfix Fixes a bug UI/UX UI/UX changes including assets, menus, QoL, etc.

Projects

Status: Final Review

Development

Successfully merging this pull request may close these issues.

Bug: "Keep Playing" instead of "Spectate" on second win modal in Teams

5 participants