Account Modal - Games Tab#4473
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:
WalkthroughAdds public player game history with new API schemas and fetch logic, a reusable date helper, a paginated history view, and AccountModal integration. Clan game history now reuses the shared date helpers. Translations and schema tests were updated. ChangesPublic player game history
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
Replace the account modal's recent-games list (GameList) with a paginated PlayerGameHistoryView that accumulates results and preserves its list + cursor across tab switches via a gameHistoryCache. Game history entries now include the player's username and clan tag. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/client/components/baseComponents/stats/PlayerGameHistoryView.ts (1)
215-228: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winUnhandled rejection risk in
showRanking.
gameInfoModal.loadGame(gameId)is called withvoidand no.catch/try-catch, thenopen()runs regardless. If the load fails, the modal opens with no data and no user-facing error, and the rejection is unhandled.🛡️ Proposed fix
- void gameInfoModal.loadGame(gameId); - gameInfoModal.open(); + gameInfoModal + .loadGame(gameId) + .catch((err) => console.warn("Failed to load game for ranking", err)); + gameInfoModal.open();🤖 Prompt for 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. In `@src/client/components/baseComponents/stats/PlayerGameHistoryView.ts` around lines 215 - 228, The showRanking flow in PlayerGameHistoryView opens GameInfoModal even if loadGame(gameId) fails, and the rejected promise is currently ignored. Update showRanking to handle the loadGame promise explicitly (using await with try/catch or a .catch chain), and only call gameInfoModal.open() after a successful load. Use the GameInfoModal and showRanking symbols to keep the fix scoped, and surface/log an error when loading fails instead of leaving an unhandled rejection.
🧹 Nitpick comments (1)
src/client/components/baseComponents/stats/GameTypeLabels.ts (1)
19-57: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider adding unit tests for
isFfa/formatGameType.Both are pure, side-effect-free functions with several branches (ranked, FFA fallback, HvN, Duos/Trios/Quads, numeric teams, default) — cheap to cover exhaustively and would lock in the subtle legacy-
nullvsundefineddistinction called out in the comments.🤖 Prompt for 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. In `@src/client/components/baseComponents/stats/GameTypeLabels.ts` around lines 19 - 57, Add unit tests for the pure helpers isFfa and formatGameType to cover every branch: rankedType, explicit FFA, legacy FFA fallback when mode is undefined and playerTeams is null/undefined, Humans Vs Nations, Duos/Trios/Quads, numeric team counts, and the default team label. Use the existing GameTypeLabels symbols so the tests lock in the null-vs-undefined behavior and verify the returned translation keys/arguments.
🤖 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 `@docs/API.md`:
- Around line 130-132: Add a language hint to the fenced endpoint block in the
API docs so MD040 stops flagging it; update the Markdown fence around the GET
endpoint example to use a text-style label, matching the other annotated fences
in this section. Locate the affected fenced block in the API documentation and
adjust only the fence tag, leaving the endpoint content unchanged.
---
Outside diff comments:
In `@src/client/components/baseComponents/stats/PlayerGameHistoryView.ts`:
- Around line 215-228: The showRanking flow in PlayerGameHistoryView opens
GameInfoModal even if loadGame(gameId) fails, and the rejected promise is
currently ignored. Update showRanking to handle the loadGame promise explicitly
(using await with try/catch or a .catch chain), and only call
gameInfoModal.open() after a successful load. Use the GameInfoModal and
showRanking symbols to keep the fix scoped, and surface/log an error when
loading fails instead of leaving an unhandled rejection.
---
Nitpick comments:
In `@src/client/components/baseComponents/stats/GameTypeLabels.ts`:
- Around line 19-57: Add unit tests for the pure helpers isFfa and
formatGameType to cover every branch: rankedType, explicit FFA, legacy FFA
fallback when mode is undefined and playerTeams is null/undefined, Humans Vs
Nations, Duos/Trios/Quads, numeric team counts, and the default team label. Use
the existing GameTypeLabels symbols so the tests lock in the null-vs-undefined
behavior and verify the returned translation keys/arguments.
🪄 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: 501e6b0d-8910-4430-aecb-1142e285ef78
📒 Files selected for processing (5)
docs/API.mdsrc/client/components/baseComponents/stats/GameTypeLabels.tssrc/client/components/baseComponents/stats/PlayerGameHistoryView.tssrc/client/components/clan/ClanGameHistoryView.tssrc/core/ApiSchemas.ts
💤 Files with no reviewable changes (1)
- src/core/ApiSchemas.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/client/components/clan/ClanGameHistoryView.ts
Continuation of openfrontio/infra#386, adds play games sessions <img width="971" height="771" alt="image" src="https://github.com/user-attachments/assets/42c6bcbb-d690-4cd1-b859-3299a03f4350" /> - [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 regression is found: w.o.n --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Description:
Continuation of https://github.com/openfrontio/infra/pull/386, adds play games sessions
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
w.o.n