Issue #3930 add a dynamic html title#3980
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughAdds localized strings, a small exported ChangesDynamic Page Title with Lobby Countdown
Sequence DiagramsequenceDiagram
participant EventBus as LobbyInfoEvent
participant MainClient
participant TimeUtils as TimeUtilities
participant Translator as translateText
participant TitleMgr as setTitle
participant Browser
EventBus->>MainClient: LobbyInfoEvent (lobby.startsAt, serverTime)
MainClient->>TimeUtils: calculateServerTimeOffset(serverTime)
TimeUtils-->>MainClient: offsetMs
MainClient->>TimeUtils: getSecondsUntilServerTimestamp(startsAt, offsetMs)
TimeUtils-->>MainClient: secondsRemaining
loop every 1 second while secondsRemaining > 0
MainClient->>TimeUtils: renderDuration(secondsRemaining)
TimeUtils-->>MainClient: renderedTime
MainClient->>Translator: translateText("main.title_starting", { time: renderedTime })
Translator-->>MainClient: localizedTitle
MainClient->>TitleMgr: setTitle(localizedTitle)
TitleMgr->>Browser: document.title = localizedTitle
MainClient->>TimeUtils: getSecondsUntilServerTimestamp(...)
end
MainClient->>Translator: translateText("main.title_game_in_progress")
Translator-->>MainClient: localizedInProgress
MainClient->>TitleMgr: setTitle(localizedInProgress)
TitleMgr->>Browser: document.title = localizedInProgress
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ 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. 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/Main.ts`:
- Around line 863-893: The onLobbyInfo handler starts a new updateTitle loop
each event causing stacked setTimeouts; fix by tracking and clearing a single
timer ID (e.g., this.lobbyTitleTimer) before starting updateTitle, store the
timeout id returned from setTimeout into that field, and call
clearTimeout(this.lobbyTitleTimer) when a new LobbyInfoEvent arrives or when the
lobbyHandle changes (and also clear it when countdown finishes) so only one
countdown loop runs; update references in onLobbyInfo, updateTitle, and where
this.lobbyHandle/newLobbyHandle are used to manage the single timer lifecycle.
🪄 Autofix (Beta)
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
Run ID: bd9ce43a-3944-4fd2-a57f-b2cd429e1523
📒 Files selected for processing (5)
resources/lang/en.jsonresources/lang/es.jsonsrc/client/Main.tssrc/client/PageTitleManager.tstests/client/PageTitleManager.test.ts
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/Main.ts`:
- Around line 889-892: The Prettier failure is caused by a missing statement
terminator after the setTitle call in the countdown title block; update the code
in the block that calls setTitle(translateText("main.title_starting", { time:
renderDuration(seconds) })) to add the missing semicolon, leaving the rest
(assignment to lobbyTitleTimer and setTimeout(updateTitle, 1000)) unchanged so
functions/identifiers setTitle, translateText, renderDuration, lobbyTitleTimer
and updateTitle remain intact.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Resolves #3930
Description:
This PR introduces a dynamic title helper that is used to communicate different game states between looking for a game, and playing a game.
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
No discord please create an issue and assign to me or reach me on linkedin
Title States
Base




In Lobby Countdown
After Countdown
In Game