Skip to content

Account Modal - Games Tab#4473

Merged
evanpelle merged 2 commits into
mainfrom
playergames
Jul 1, 2026
Merged

Account Modal - Games Tab#4473
evanpelle merged 2 commits into
mainfrom
playergames

Conversation

@ryanbarlow97

@ryanbarlow97 ryanbarlow97 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Description:

Continuation of https://github.com/openfrontio/infra/pull/386, adds play games sessions

image

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

Please put your Discord username so you can be contacted if a bug or regression is found:

w.o.n

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds 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.

Changes

Public player game history

Layer / File(s) Summary
Public player games API schema and fetch function
src/core/ApiSchemas.ts, src/client/Api.ts, tests/ApiSchemas.test.ts, docs/API.md
Adds public game filters, result and response schemas, removes legacy player profile game data, adds the public fetch helper, updates API docs, and expands schema tests.
Shared day-grouping and date formatting utilities
src/client/components/baseComponents/stats/GameHistoryDates.ts
Adds shared grouping and localized date/time helpers for game history views.
PlayerGameHistoryView component
src/client/components/baseComponents/stats/PlayerGameHistoryView.ts, src/client/components/baseComponents/stats/GameList.ts, resources/lang/en.json
Adds the new paginated game history component, cache shape, row actions, removes the old game list element, and updates the related game-history labels.
AccountModal games tab integration
src/client/AccountModal.ts
Switches the modal Games tab to cached PlayerGameHistoryView rendering and updates reset/load handling.
ClanGameHistoryView reuse of shared utilities
src/client/components/clan/ClanGameHistoryView.ts
Replaces local date and grouping helpers with the shared utility module and updates grouped rendering.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

Suggested labels: Feature, Backend, Translation

Suggested reviewers: evanpelle, Celant

Poem

A new game trail now winds through time,
With filters, cache, and tabs in rhyme.
The clan view shares the same old sky,
And replay buttons wink nearby.
🎮✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title matches a real part of the change set: the Account Modal Games tab was rebuilt around new game history UI.
Description check ✅ Passed The description matches the UI and game-history changes in this pull request.

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.

@ryanbarlow97 ryanbarlow97 added the UI/UX UI/UX changes including assets, menus, QoL, etc. label Jul 1, 2026
@ryanbarlow97 ryanbarlow97 added this to the v33 milestone Jul 1, 2026

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

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>
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 1, 2026
@ryanbarlow97 ryanbarlow97 marked this pull request as draft July 1, 2026 16:14

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Unhandled rejection risk in showRanking.

gameInfoModal.loadGame(gameId) is called with void and no .catch/try-catch, then open() 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 win

Consider 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-null vs undefined distinction 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

📥 Commits

Reviewing files that changed from the base of the PR and between 9b4d2fe and 2032fd5.

📒 Files selected for processing (5)
  • docs/API.md
  • src/client/components/baseComponents/stats/GameTypeLabels.ts
  • src/client/components/baseComponents/stats/PlayerGameHistoryView.ts
  • src/client/components/clan/ClanGameHistoryView.ts
  • src/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

Comment thread docs/API.md
@ryanbarlow97 ryanbarlow97 changed the title Playergames Account Modal - Games Tab Jul 1, 2026
@github-project-automation github-project-automation Bot moved this from Development to Final Review in OpenFront Release Management Jul 1, 2026
@evanpelle evanpelle merged commit 1d5a6ae into main Jul 1, 2026
20 checks passed
@evanpelle evanpelle deleted the playergames branch July 1, 2026 21:12
@github-project-automation github-project-automation Bot moved this from Final Review to Complete in OpenFront Release Management Jul 1, 2026
evanpelle pushed a commit that referenced this pull request Jul 1, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

UI/UX UI/UX changes including assets, menus, QoL, etc.

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

3 participants