Make the end timer warnings more visible - #4868
Conversation
Add a centered one-minute warning, flash the timer below 30 seconds, and flash the full sidebar below 10 seconds. Resolves openfrontio#4290
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe game sidebar warns during the final minute, flashes the timer during the final 30 seconds, and flashes the sidebar during the final 10 seconds. The warning supports dismissal, reduced motion, accessibility, localization, and tests. ChangesEnd-game timer warning
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant GameTimer
participant GameRightSidebar
participant WarningOverlay
GameTimer->>GameRightSidebar: timer update
GameRightSidebar->>WarningOverlay: show warning at 60 seconds
GameRightSidebar->>WarningOverlay: dismiss after 4 seconds
GameRightSidebar->>WarningOverlay: apply timer flashing at 30 seconds
GameRightSidebar->>WarningOverlay: apply sidebar flashing at 10 seconds
Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/client/hud/layers/GameRightSidebar.ts`:
- Around line 139-142: Update GameRightSidebar cleanup at
src/client/hud/layers/GameRightSidebar.ts lines 139-142 to call
dismissOneMinuteWarning(), ensuring disconnection clears both the timeout and
visible warning state. At lines 185-189, when timer reaches zero, call
dismissOneMinuteWarning() instead of maybeShowOneMinuteWarning(). Add regression
tests covering disconnect/reconnect during an active warning and reaching zero
before winner handling.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 8d93312e-4aa4-4f46-8cd0-dfa53928cf55
📒 Files selected for processing (3)
resources/lang/en.jsonsrc/client/hud/layers/GameRightSidebar.tstests/GameRightSidebar.test.ts
Add approved & assigned issue number here:
Resolves #4290
Description:
Timed games previously only changed the small top-right timer to red during the final minute. That is easy to miss while the player is focused on the map, especially during the part of a match where attention is most contested.
This PR adds the progressive warning requested in #4290. At 1:00, the existing red timer is joined by a translated center-screen alert for four seconds. At 0:30, the timer itself alternates between red and white. At 0:10, the entire top-right control bar alternates between its normal dark background and red.
What's here
src/client/hud/layers/GameRightSidebar.ts— threshold detection, the one-shot center warning, timer/sidebar animations, terminal-state cleanup, and reduced-motion behavior.resources/lang/en.json— the newgame_timer.one_minute_remainingstring. No other language files; those are managed through Crowdin.tests/GameRightSidebar.test.ts— focused coverage for the 60-, 30-, and 10-second thresholds, alert dismissal, lifecycle cleanup, spawn countdowns, and untimed games.Why the warning escalates
The three stages deliberately increase the amount of screen space involved as time becomes more urgent:
The one-minute alert is shown once per initialized game and can finish through either its CSS animation or its four-second timeout. It is cleared when the game ends, the timer reaches zero, or the sidebar disconnects, so stale warning state cannot survive a terminal transition or reconnect.
Scope, accessibility, and localization
These effects apply only to an active configured game-end countdown. The spawn countdown and the elapsed clock in untimed games keep their existing appearance. Warning styles also stop after a winner is declared or the timer reaches zero.
The center message uses
translateText("game_timer.one_minute_remaining"),role="alert", andaria-live="assertive". Underprefers-reduced-motion: reduce, the repeating animations are replaced with static high-contrast states rather than flashing.Screenshots:
1:00 — centered one-minute warning
0:30 and 0:10 — timer and full-sidebar warning animation
Screencast.from.2026-08-05.00-04-41.webm
Please complete the following:
Verification
npx vitest run tests/GameRightSidebar.test.ts— focused timer-warning tests passing.npm test— complete client/core and server suites passing.npm run lint— Oxlint and ESLint clean.npx tsc --noEmit— TypeScript clean.git diff --checkclean.EnJsonSortedandTranslationSystemchecks green.Known and deliberate
Note on the PR gate
The linked issue is approved and assigned. The separate
Has Milestonecheck is expected to remain red until an OpenFront reviewer assigns the PR's milestone; contributors do not have permission to do that themselves.Discord: Kronbii