Skip to content

Conversation

@VariableVince
Copy link
Contributor

@VariableVince VariableVince commented Oct 31, 2025

Description:

Closes #2185. Made own team name bold in Team Stats. In Show Unit and Show Control. This follows #2221 which made team mate names bold in the Leaderboard.

Also fixed column names allignment. They sat in different vertical positions before.

BEFORE

image image

AFTER

image 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
  • 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:

tryout33

@VariableVince VariableVince requested a review from a team as a code owner October 31, 2025 01:58
@CLAassistant
Copy link

CLAassistant commented Oct 31, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ evanpelle
❌ VariableVince
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 31, 2025

Walkthrough

Adds an isMyTeam flag to team entries, lazily caches the local player's team in TeamStats, and conditionally applies bold styling to the player's own team rows during rendering.

Changes

Cohort / File(s) Summary
Team leaderboard rendering
src/client/graphics/layers/TeamStats.ts
Add isMyTeam: boolean to team entries; introduce private `_myTeam: Team

Sequence Diagram(s)

sequenceDiagram
  participant UI as TeamStats UI
  participant Model as Game Model
  participant Renderer as DOM Renderer

  Note over UI,Model: Update cycle
  UI->>Model: request current player & teams
  Model-->>UI: return player, teams
  UI->>UI: set _myTeam if null (lazy init)
  UI->>UI: map teams -> TeamEntry including isMyTeam = team === _myTeam
  UI->>Renderer: render rows (apply font-bold if isMyTeam)
  Renderer-->>UI: render complete
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Single-file change with consistent pattern: data flagging and conditional rendering.
  • Pay attention to: updateTeamStats() lazy init logic, equality used to detect _myTeam, and both rendering branches (unit vs non-unit) for the conditional class.

Suggested reviewers

  • evanpelle

Poem

A row turns bold where your banner flies,
Team colors gleam before your eyes,
A tiny flag, a hero's claim,
Leaderboard cheer — your team's in frame! 🏅

Pre-merge checks

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Out of Scope Changes Check ❓ Inconclusive The pull request includes changes beyond the scope of the linked issue #2185. While the issue only specifies highlighting the own team in bold, the changeset also includes header alignment fixes with responsive padding adjustments (md:py-2.5). However, both changes are explicitly documented in the PR title ("fix headers allignment") and description ("Also fixed column names allignment"), suggesting they were intentional modifications rather than accidental scope creep. The header fix addresses a related UI presentation issue that appears to have been discovered during the same work, similar to the approach mentioned in PR #2221.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues Check ✅ Passed The code changes successfully implement the primary requirement from issue #2185 to highlight the own team in bold in the team leaderboard. The implementation adds an isMyTeam boolean field to TeamEntry entries, computes it by comparing the team string to the current player's team, and applies bold styling (font-bold class) to team rows where isMyTeam is true for both unit-enabled and non-unit views. This directly addresses the requirement to make the user's own team more easily identifiable by displaying it in bold, mirroring the single-player leaderboard behavior.
Title Check ✅ Passed The title "Team leaderboard: own team bold + fix headers allignment" accurately describes the two main changes in the changeset: adding bold styling to the user's own team in the team leaderboard and fixing the vertical alignment of column headers. The title is concise, specific, and provides clear context about what part of the application is being modified, making it easy for teammates to understand the primary purpose of the changeset when scanning history.
Description Check ✅ Passed The description is directly related to the changeset and provides relevant context about the changes made. It explains that the own team name is now bolded in Team Stats (covering both Show Unit and Show Control views), references the related issue #2185 and similar prior work in PR #2221, mentions the header alignment fix, and includes before/after screenshots demonstrating the visual improvements. The description clearly communicates what was changed and why, making it well-suited to understanding the pull request's intent.

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.

@VariableVince VariableVince marked this pull request as draft October 31, 2025 02:04
coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 31, 2025
@VariableVince VariableVince marked this pull request as ready for review October 31, 2025 02:23
@VariableVince VariableVince changed the title Own team name bold in Team Leaderboard Team leaderboard: own team bold + fix headers allignment Oct 31, 2025
const grouped: Record<Team, PlayerView[]> = {};

if (this._myTeam === null) {
const myPlayer = this.game.myPlayer();
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to check the team for each ticks, maybe move it in the init method

Copy link
Contributor Author

@VariableVince VariableVince Oct 31, 2025

Choose a reason for hiding this comment

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

In the init is too early sadly, team is still null at that point.

I did put it in updateTeamStats(), which is called every 10 ticks from tick(). And it has a null check so the fetch and assignment happens only once. But the null check every 10 ticks seems unavoidable

Copy link
Collaborator

@evanpelle evanpelle left a comment

Choose a reason for hiding this comment

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

thanks!

@evanpelle evanpelle added this to the v27 milestone Nov 5, 2025
@evanpelle evanpelle merged commit 6fe81cb into main Nov 5, 2025
12 of 14 checks passed
@evanpelle evanpelle deleted the team-name-bold branch November 5, 2025 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Highlight the own Team in Bold in the Leaderboard in Team Games

5 participants