Skip to content

Refactor tournament actions#114

Merged
ianpaschal merged 8 commits intodevelopfrom
refactor-tournament-actions
Jul 15, 2025
Merged

Refactor tournament actions#114
ianpaschal merged 8 commits intodevelopfrom
refactor-tournament-actions

Conversation

@ianpaschal
Copy link
Owner

@ianpaschal ianpaschal commented Jul 10, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a centralized tournament actions provider for consistent management and access to tournament-related actions and confirmation dialogs.
    • Added support for customizable labels and enhanced flexibility in the confirmation dialog component.
    • Enhanced toast notifications to support multi-line descriptions.
    • Added a new computed property for upcoming tournament rounds and improved validation logic.
  • Improvements

    • Refactored tournament context menu and pairing card components to leverage the new action provider, simplifying UI logic.
    • Improved validation and warning messages when configuring tournament rounds.
    • Added eligibility checks to prevent ending tournaments during active rounds.
  • Bug Fixes

    • Corrected error messages related to player removal and tournament actions.
    • Enforced restrictions on removing players from active tournaments.
  • Removals

    • Removed redundant dialog components, utility files, and related styles from the tournament context menu to streamline the codebase.
  • Style

    • Updated dialog description styles to enhance emphasis on important text.

@vercel
Copy link

vercel bot commented Jul 10, 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 Jul 15, 2025 6:26am

@coderabbitai
Copy link

coderabbitai bot commented Jul 10, 2025

Walkthrough

This update introduces a centralized action provider pattern for tournament-related actions in the application. It adds a context and hooks for managing and accessing tournament actions, refactors confirmation dialog logic and types, and removes local dialog and utility files in favor of this new approach. Several backend and frontend modules are updated to support new validations, error messages, and computed fields, while some obsolete files and exports are removed.

Changes

Files / Groups Change Summary
convex/_model/tournamentCompetitors/mutations/updateTournamentCompetitor.ts Added validation: prevents removing players from an active tournament competitor during updates.
convex/_model/tournaments/_helpers/deepenTournament.ts Refactored derived properties to be computed inline; added conditional nextRound property.
convex/_model/tournaments/index.ts
src/api.ts
Added and exported TournamentActionKey enum for tournament actions.
convex/_model/tournaments/mutations/endTournament.ts Removed timer cleanup; added error if ending tournament mid-round.
convex/_model/tournaments/queries/getTournamentOpenRound.ts Added remaining field to matchResultsProgress in open round query.
convex/_model/utils/createTestTournament.ts Updated tournament creation to use a new banner storage ID.
convex/common/errors.ts Corrected and added error messages; removed obsolete errors.
src/components/ConfirmationDialog/ConfirmationDialog.hooks.ts
src/components/ConfirmationDialog/ConfirmationDialog.tsx
src/components/ConfirmationDialog/ConfirmationDialog.types.ts
src/components/ConfirmationDialog/index.ts
Centralized and updated dialog props/types; added customizable button labels and improved fallback logic.
src/components/ToastProvider/ToastProvider.store.ts Allowed description in ToastItem to accept string or string[].
src/components/TournamentActionsProvider/TournamentActionsProvider.context.ts
src/components/TournamentActionsProvider/TournamentActionsProvider.hooks.tsx
src/components/TournamentActionsProvider/TournamentActionsProvider.tsx
src/components/TournamentActionsProvider/utils/validateConfigureRound.tsx
src/components/TournamentActionsProvider/index.ts
Introduced action context, hooks, provider component, and round configuration validation utility.
src/components/TournamentContextMenu/TournamentContextMenu.tsx Refactored to use centralized action provider; removed internal logic, state, and dialog handling.
src/components/TournamentContextMenu/TournamentContextMenu.utils.ts
src/components/TournamentContextMenu/components/ConfirmConfigureRoundDialog/ConfirmConfigureRoundDialog.module.scss
src/components/TournamentContextMenu/components/ConfirmConfigureRoundDialog/ConfirmConfigureRoundDialog.tsx
src/components/TournamentContextMenu/components/ConfirmConfigureRoundDialog/ConfirmConfigureRoundDialog.utils.tsx
src/components/TournamentContextMenu/components/ConfirmConfigureRoundDialog/index.ts
src/components/TournamentContextMenu/index.ts
Deleted confirm dialog component, related utilities, styles, and exports.
src/components/generic/Dialog/DialogDescription.module.scss Added font weight styling for strong elements inside dialog descriptions.
src/pages/TournamentDetailPage/TournamentDetailPage.tsx Wrapped content with new TournamentActionsProvider.
src/pages/TournamentDetailPage/components/TournamentPairingsCard/TournamentPairingsCard.tsx Switched from dialog-based to action provider pattern for configuring rounds; updated round index logic.
src/components/TournamentCard/TournamentCard.tsx Wrapped component content with TournamentActionsProvider context provider.
convex/_model/tournamentCompetitors/queries/getTournamentCompetitorsByTournament.ts Changed condition to fetch rankings to explicitly check for undefined allowing zero as valid.

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 58d35c4 and 815ac39.

📒 Files selected for processing (1)
  • src/components/TournamentActionsProvider/TournamentActionsProvider.hooks.tsx (1 hunks)

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

🪧 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? Join our Discord community 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 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.

@ianpaschal
Copy link
Owner Author

@coderabbitai full review

@coderabbitai
Copy link

coderabbitai bot commented Jul 10, 2025

✅ Actions performed

Full review triggered.

@ianpaschal
Copy link
Owner Author

@coderabbitai full review

@coderabbitai
Copy link

coderabbitai bot commented Jul 12, 2025

✅ Actions performed

Full review triggered.

@ianpaschal ianpaschal merged commit 66302d7 into develop Jul 15, 2025
3 checks passed
@ianpaschal ianpaschal deleted the refactor-tournament-actions branch July 15, 2025 06:41
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