Skip to content

feat: #101 Add player count to roster#103

Merged
ianpaschal merged 2 commits intodevelopfrom
feat-101-add-player-count-to-roster
Jun 30, 2025
Merged

feat: #101 Add player count to roster#103
ianpaschal merged 2 commits intodevelopfrom
feat-101-add-player-count-to-roster

Conversation

@ianpaschal
Copy link
Owner

@ianpaschal ianpaschal commented Jun 30, 2025

#101

Summary by CodeRabbit

  • New Features

    • Added a player count indicator to the tournament roster, showing active players versus total allowed for each competitor when team mode is enabled.
  • Improvements

    • Updated roster header layout to use CSS grid for better structure.
    • Enhanced styling and alignment of roster identity, player count, and action sections.
    • Improved action buttons styling to prevent shrinking and maintain layout consistency.

@vercel
Copy link

vercel bot commented Jun 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
combat-command ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 30, 2025 2:44pm

@coderabbitai
Copy link

coderabbitai bot commented Jun 30, 2025

Walkthrough

A new PlayerCount component and its styles were added to the Tournament Roster feature. The roster header and competitor row layouts were refactored for improved structure, switching from flexbox to CSS grid. Components were updated to accept additional class names for styling flexibility, and the new player count indicator is conditionally rendered.

Changes

File(s) Change Summary
.../TournamentRoster/TournamentRoster.module.scss Refactored .TournamentRoster_Header from flexbox to CSS grid; added grid area classes for header columns.
.../TournamentRoster/TournamentRoster.tsx Integrated new PlayerCount component; updated hooks and class names; conditionally renders PlayerCount.
.../CompetitorActions/CompetitorActions.module.scss Replaced margin-left: auto; with flex-shrink: 0; in .CompetitorActions.
.../CompetitorActions/CompetitorActions.tsx Added optional className prop; supports external styling via clsx utility.
.../PlayerCount/PlayerCount.module.scss New SCSS module for PlayerCount; defines flex row, muted text, and icon sizing.
.../PlayerCount/PlayerCount.tsx New PlayerCount React component; displays active/total player count with icon and conditional styling.
.../PlayerCount/index.ts New barrel file to re-export PlayerCount and its props type.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TournamentRoster
    participant useTournament
    participant PlayerCount
    participant IdentityBadge
    participant CompetitorActions

    User->>TournamentRoster: Render TournamentRoster
    TournamentRoster->>useTournament: Fetch useTeams, competitorSize
    TournamentRoster->>IdentityBadge: Render with competitor info
    alt useTeams is true
        TournamentRoster->>PlayerCount: Render with competitor, competitorSize
    end
    TournamentRoster->>CompetitorActions: Render with competitor info
Loading

Poem

In grids and rows, the roster grows,
A player count now proudly shows.
With icons neat and styles anew,
Competitors line up in tidy view.
The rabbit hops with CSS delight—
New features shining, code just right!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-06-30T14_45_52_109Z-debug-0.log


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9c5b7fe and 0296bc0.

📒 Files selected for processing (1)
  • src/components/TournamentRoster/components/PlayerCount/PlayerCount.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/TournamentRoster/components/PlayerCount/PlayerCount.tsx
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/components/TournamentRoster/TournamentRoster.module.scss (1)

11-15: Consider using an auto-sized row rather than a fixed 2.5rem.

A hard-coded height can break when:

• Font scaling / user zoom increases text size.
• Badges, icons, or translated text exceed the fixed value.

Replacing grid-template-rows: 2.5rem; with grid-auto-rows: minmax(2.5rem, auto); (or simply letting the row size implicitly) keeps the original intent while preventing clipping.

-    grid-template-rows: 2.5rem;
+    /* Maintain a minimum height but allow growth when needed */
+    grid-auto-rows: minmax(2.5rem, auto);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 62d1e95 and 9c5b7fe.

📒 Files selected for processing (7)
  • src/components/TournamentRoster/TournamentRoster.module.scss (1 hunks)
  • src/components/TournamentRoster/TournamentRoster.tsx (2 hunks)
  • src/components/TournamentRoster/components/CompetitorActions/CompetitorActions.module.scss (1 hunks)
  • src/components/TournamentRoster/components/CompetitorActions/CompetitorActions.tsx (3 hunks)
  • src/components/TournamentRoster/components/PlayerCount/PlayerCount.module.scss (1 hunks)
  • src/components/TournamentRoster/components/PlayerCount/PlayerCount.tsx (1 hunks)
  • src/components/TournamentRoster/components/PlayerCount/index.ts (1 hunks)
🔇 Additional comments (11)
src/components/TournamentRoster/components/CompetitorActions/CompetitorActions.module.scss (1)

12-12: Grid layout positioning verified and approved

We’ve confirmed that the parent container in TournamentRoster.module.scss uses CSS grid with

grid-template-areas: "Identity PlayerCount Actions";
grid-template-columns: 1fr auto auto;

so the Actions cell is explicitly placed in the third column. Updating
CompetitorActions.module.scss (line 12) from margin-left: auto; to flex-shrink: 0; correctly prevents unwanted shrinkage in that grid cell. No further changes needed.

  • Verified grid setup in TournamentRoster.module.scss
  • Confirmed flex-shrink: 0 is appropriate in CompetitorActions.module.scss
src/components/TournamentRoster/components/PlayerCount/index.ts (1)

1-2: Clean barrel export implementation.

The export pattern follows React/TypeScript conventions and provides a clean interface for consuming the PlayerCount component.

src/components/TournamentRoster/components/CompetitorActions/CompetitorActions.tsx (3)

2-2: Good addition of clsx for class name handling.

The clsx import supports the enhanced className functionality being added to the component.


24-24: Well-implemented className prop enhancement.

The optional className prop follows React conventions and allows external styling flexibility.

Also applies to: 29-29


100-100: Proper use of clsx for combining class names.

The clsx utility correctly combines the internal component styles with any external className prop, maintaining styling flexibility without breaking internal styles.

src/components/TournamentRoster/components/PlayerCount/PlayerCount.module.scss (2)

1-2: Proper use of project style modules.

The imports correctly reference the project's style system for consistent styling.


4-12: Well-structured component styling.

The flex row layout with gap is appropriate for icon-text display, muted styling fits the UI context, and fixed SVG dimensions prevent layout issues.

src/components/TournamentRoster/TournamentRoster.tsx (3)

7-7: Proper component import.

The PlayerCount import follows the project's import conventions.


18-18: Correctly extended useTournament hook.

Adding competitorSize extraction aligns with the PlayerCount component's requirements.


26-30: Well-implemented PlayerCount integration.

The conditional rendering based on useTeams is logical, and the component positioning between IdentityBadge and CompetitorActions makes sense for the UI flow.

However, the AI summary mentions grid layout changes in TournamentRoster.module.scss with grid areas like TournamentRoster_Identity, TournamentRoster_PlayerCount, and TournamentRoster_Actions, but this file wasn't provided for review. The className props being passed suggest these grid areas should exist.

Verify the grid layout implementation:

#!/bin/bash
# Description: Check for grid layout styles in TournamentRoster.module.scss
# Expected: CSS grid areas defined for Identity, PlayerCount, and Actions

fd "TournamentRoster.module.scss" --exec cat {}

Likely an incorrect or invalid review comment.

src/components/TournamentRoster/TournamentRoster.module.scss (1)

20-30: BEM block naming is clear – 👍

The grid-area assignments for _Identity, _PlayerCount, and _Actions map cleanly to the named areas declared above, making the markup easy to scan and maintain.

Comment on lines +19 to +24
const playerCount = competitor.players.filter((p) => p.active).length;
return (
<div className={clsx(styles.PlayerCount, className)} data-full={playerCount === competitorSize}>
<Users />
{`${playerCount}/${competitorSize}`}
</div>
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add basic accessibility & robustness guards.

  1. The Users icon is decorative; hide it from screen-readers.
  2. Expose an aria-label on the wrapper so assistive tech announces the count.
  3. Guard against a missing players array to avoid a runtime crash.
-const playerCount = competitor.players.filter((p) => p.active).length;
+const playerCount = (competitor.players ?? []).filter((p) => p.active).length;

-<div className={clsx(styles.PlayerCount, className)} data-full={playerCount === competitorSize}>
-  <Users />
+<div
+  className={clsx(styles.PlayerCount, className)}
+  data-full={playerCount === competitorSize}
+  aria-label={`${playerCount} of ${competitorSize} players active`}
+>
+  <Users aria-hidden="true" focusable="false" />
   {`${playerCount}/${competitorSize}`}
 </div>

These tweaks cost almost nothing and improve a11y and runtime safety.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const playerCount = competitor.players.filter((p) => p.active).length;
return (
<div className={clsx(styles.PlayerCount, className)} data-full={playerCount === competitorSize}>
<Users />
{`${playerCount}/${competitorSize}`}
</div>
const playerCount = (competitor.players ?? []).filter((p) => p.active).length;
return (
<div
className={clsx(styles.PlayerCount, className)}
data-full={playerCount === competitorSize}
aria-label={`${playerCount} of ${competitorSize} players active`}
>
<Users aria-hidden="true" focusable="false" />
{`${playerCount}/${competitorSize}`}
</div>
🤖 Prompt for AI Agents
In src/components/TournamentRoster/components/PlayerCount/PlayerCount.tsx around
lines 19 to 24, the Users icon should be hidden from screen readers by adding an
appropriate aria attribute since it is decorative. Add an aria-label to the
wrapper div that clearly announces the player count for assistive technologies.
Also, add a guard to safely handle cases where competitor.players might be
undefined or null to prevent runtime errors by defaulting to an empty array
before filtering.

@ianpaschal ianpaschal merged commit e2aa511 into develop Jun 30, 2025
3 checks passed
@ianpaschal ianpaschal deleted the feat-101-add-player-count-to-roster branch June 30, 2025 14:50
@coderabbitai coderabbitai bot mentioned this pull request Jun 30, 2025
ianpaschal added a commit that referenced this pull request Jul 1, 2025
* Update update-project-status.yml

* Update updateProjectStatus.js

* fix: Toast text does not wrap (#87)

* fix: #86 Sanitize sign in/sign up inputs (#91)

* feat: #32 Auto generate avatars & refactor users (#90)

* feat: Improve <TournamentDetailPage/> default tab

* feat: Improve <TournamentCard/> styling

* Update mockData.ts

* feat: Improve <AccordionItem/> disabled state (#97)

#94

* feat: Hide completed pairings from match check-in (#96)

#95

* bug: Preserve <TournamentPairingsGrid/> internal state (#98)

#93

* feat: #101 Add player count to roster (#103)

* feat: Show full player names when tournaments require it

* feat: Add activePlayerCount to deep tournaments

* feat: Sort tournament competitors by name

* task: #100 Clean-up .card mixin (#102)

* feat: #99 Improve tournament competitor edit dialog (#104)

* feat: #106 Improve signIn error handling (#107)

* Update convex/_model/tournamentCompetitors/queries/getTournamentCompetitorsByTournament.ts

* Update convex/_model/users/_helpers/checkUserTournamentForcedName.ts

* feat: Hide players with 0 matches from rankings
ianpaschal added a commit that referenced this pull request Jul 18, 2025
* Update update-project-status.yml

* Update updateProjectStatus.js

* fix: Toast text does not wrap (#87)

* fix: #86 Sanitize sign in/sign up inputs (#91)

* feat: #32 Auto generate avatars & refactor users (#90)

* feat: Improve <TournamentDetailPage/> default tab

* feat: Improve <TournamentCard/> styling

* Update mockData.ts

* feat: #94 Improve <AccordionItem/> disabled state (#97)

* feat: #95 Hide completed pairings from match check-in (#96)

* bug: #93 Preserve <TournamentPairingsGrid/> internal state (#98)

* feat: #101 Add player count to roster (#103)

* feat: Show full player names when tournaments require it

* feat: Add activePlayerCount to deep tournaments

* feat: Sort tournament competitors by name

* task: #100 Clean-up .card mixin (#102)

* feat: #99 Improve tournament competitor edit dialog (#104)

* feat: #106 Improve signIn error handling (#107)

* Update convex/_model/tournamentCompetitors/queries/getTournamentCompetitorsByTournament.ts

* Update convex/_model/users/_helpers/checkUserTournamentForcedName.ts

* feat: Hide players with 0 matches from rankings

* feat: #112 Add more mercenary team options (#113)

* feat: #110 Add manual table assignments (#111)

* fix: Ensure round 0 rankings can be included

* Refactor tournament actions (#114)

* refactor: Improve tournament actions

* chore: Clean-up Convex errors

* fix: Do not try to clean up current round timer on tournament end

* fix: Don't allow players to be removed from tournament

* chore: Update test tournament banner image

* Update TournamentCard.tsx

* fix: Ensure round 0 rankings can be included

* fix: Fix end tournament round context menu behavior

* chore: Improve mock match result creation

* feat: Allow matchResult.playedAt to be date string or number

* feat: #115 Hide match result battle plans (#116)

* feat: Set page title based on <PageWrapper/> title prop

* fix: Use <IdentityBadge/> to fix player name spacing on match results

* fix: Correctly include match results relevant to a tournament
ianpaschal added a commit that referenced this pull request Jul 24, 2025
* Update update-project-status.yml

* Update updateProjectStatus.js

* fix: Toast text does not wrap (#87)

* fix: Sanitize sign in/sign up inputs (#91)

#86

* feat: #32 Auto generate avatars & refactor users (#90)

* feat: Improve <TournamentDetailPage/> default tab

* feat: Improve <TournamentCard/> styling

* Update mockData.ts

* feat: Improve <AccordionItem/> disabled state (#97)

#94

* feat: Hide completed pairings from match check-in (#96)

#95

* bug: Preserve <TournamentPairingsGrid/> internal state (#98)

#93

* feat: #101 Add player count to roster (#103)

* feat: Show full player names when tournaments require it

* feat: Add activePlayerCount to deep tournaments

* feat: Sort tournament competitors by name

* task: Clean-up .card mixin (#102)

#100

* feat: #99 Improve tournament competitor edit dialog (#104)

* feat: #106 Improve signIn error handling (#107)

* Update convex/_model/tournamentCompetitors/queries/getTournamentCompetitorsByTournament.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update convex/_model/users/_helpers/checkUserTournamentForcedName.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* feat: Hide players with 0 matches from rankings

* feat: #112 Add more mercenary team options (#113)

* feat: #110 Add manual table assignments (#111)

* fix: Ensure round 0 rankings can be included

* Refactor tournament actions (#114)

* refactor: Improve tournament actions

* chore: Clean-up Convex errors

* fix: Do not try to clean up current round timer on tournament end

* fix: Don't allow players to be removed from tournament

* chore: Update test tournament banner image

* Update TournamentCard.tsx

* fix: Ensure round 0 rankings can be included

* fix: Fix end tournament round context menu behavior

* chore: Improve mock match result creation

* feat: Allow matchResult.playedAt to be date string or number

* feat: #115 Hide match result battle plans (#116)

* feat: Set page title based on <PageWrapper/> title prop

* fix: Use <IdentityBadge/> to fix player name spacing on match results

* fix: Correctly include match results relevant to a tournament

* feat: #57 Implement basic dashboard (#119)

* fix: Remove double border on dashboard sections

* fix: Add key to dashboard tournaments

* feat: Improve <TournamentPairingRow/> styling

* fix: Remove extraneous error message

* fix: Improve <Form/> isDirty calculation

* fix: Render all competitors in <TournamentCompetitorForm/>

* fix: Also show empty state if rankings are empty

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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.

1 participant