Repository navigation
Extract useSelectCards composable for multi-select dialogs - #1489
Merged
Merged
Conversation
Contributor
Author
|
I've extended this PR to cover the single-select dialogs and the legacy FourDialog as well (see the updated description). The FiveDialog toggle change is in a separate commit in case you'd prefer to leave it out. |
itsalaidbacklife
approved these changes
Nov 21, 2026
itsalaidbacklife
left a comment
Contributor
There was a problem hiding this comment.
Nice work; thank you for your contribution!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue number
Relevant issue number
Please check the following
Please describe additional details for testing this change
This PR covers #1460, except for the shared
.is-selectedCSS (see the question below).src/composables/useSelectCards.js, which accepts either a number or a ref/computed forcount(viatoValue), with Vitest unit tests intests/unit/specs/use-select-cards.spec.js.FourRevealDialog,FourDiscardDialogandDiscardToHandLimitDialoguse it with no template name changes.ThreeDialogandSevenDoubleJacksDialoguse it withcount = 1.SevenDoubleJacksDialogis converted to<script setup>, following the same approach as refactor(four-dialog): migrate FourDialog to script setup (#1412) #1477. Both already toggled, so no behaviour change.FourDialoguses it withcount = 2, keeping its special ready rule (one card is enough when only one is in hand).FiveDialoguses it withcount = 1. UX change: clicking the selected card again now deselects it. This is in its own commit, so it's easy to drop if you'd rather keep the old behaviour.Verified locally:
npm run lintandnpm run test:unitpass, and the3_threes,4_fours,5_fives,7_sevens/player_sevensandhandLimite2e specs pass.Not included: the duplicated
.is-selectedCSS.4_fours.spec.jsasserts on theis-selectedclass, andGameCardalready has its ownselectedstyle in a different colour, so moving it into a shared style or aGameCardprop seemed like a design decision worth checking first. Happy to do it here or in a follow-up, whichever you prefer.

Confidence Score: 5/5
The changes appear safe to merge based on the code reviewed.Summary
Extracts shared card selection into
useSelectCardsand adopts it across seven game dialogs.No actionable new issues found. Validation was blocked because
eslintis not installed; tests did not run.Reviews (2) · Last reviewed commit: "Use useSelectCards in FiveDialog (select..." · Reviewed by Greptile