Skip to content

feat(deck): add multi-select filters to card restrictions - #64

Merged
TONY-All merged 2 commits into
StarMoe-org:mainfrom
Hugefunny:feat/deck-constraint-filters
Oct 24, 2026
Merged

TONY-All merged 2 commits into
StarMoe-org:mainfrom
Hugefunny:feat/deck-constraint-filters

Conversation

@Hugefunny

Copy link
Copy Markdown
Contributor

No description provided.

Hugefunny and others added 2 commits October 23, 2026 22:51
The restriction dialog's filters were a hand-built copy of the shared
card filter panel, and they mixed members and Snaps in one rarity row:
Snap rarities showed member icons, and 2-4 star chips matched both
kinds at once.

- Show one kind at a time (member / Snap tabs when the box holds both)
  and filter it with useCardFilters + <CardFilters>, so each kind gets
  its own rarity scale and icons, the NFKC multi-word search, sorting,
  and the character filter of the other card pickers.
- The all / required / excluded tab narrows the list through the
  controller's match, so the band and rarity options stay those of the
  whole kind.
- Whenever the shown kind changes (picked, or the box lost the other
  kind), the filters reset but keep the search, so no filter stays on
  without its chip.
- Drop constraintCount and constraintEmpty: the shared panel shows the
  count, and the empty list reuses deckWorkspace.emptyCards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TONY-All

Copy link
Copy Markdown
Contributor

Thanks for this, @Hugefunny! The filters are a nice addition. I pushed a follow-up commit (40cb1aa) to your branch instead of asking for another round, since the changes were mostly about wiring it into existing pieces:

What changed

  • One card kind at a time. Members and Snaps use different rarity scales (member 2/3/4/20, Snap 2/3/4/10), and a single rarity row showed member icons for Snap rarities and matched both kinds on the shared 2-4★ chips. The dialog now has Member / Snap tabs (only when the box holds both kinds).
  • Built on the shared useCardFilters + <CardFilters> (the same panel CardIdentitySelection and the Snap pickers use) instead of a hand-built copy. That brings the per-kind rarity icons, the NFKC multi-word search (matchesCardFilters), sorting, the character filter, the count and the reset button for free.
  • All / Required / Excluded goes through the controller's match, so the band / rarity options stay those of the whole kind when you switch tabs.
  • No hidden filters: whenever the shown kind changes (picked, or the box no longer has the other kind) the filters reset but keep the search text, so no filter stays on without a visible chip.
  • Dropped constraintCount / constraintEmpty: the shared panel shows the count and the empty list reuses deckWorkspace.emptyCards. constraintKind stays as the tabs' label.

Checked

  • bun test (893 pass), bun run check (0 errors), bun run lint.
  • In astro dev with a test box (8 members, 6 Snaps): the Snap tab shows Snap rarity icons; EX → 2 Snaps; switching back to members restores all 8; the Required tab lists only the required card and keeps all band options; the search 爱音 千早 (reversed words) finds all three Anon cards.

Let me know if you'd rather keep a mixed member + Snap view. That would need CardFilters to support mixed kinds, which is a bigger change, so I left it out.

🤖 Generated with Claude Code

@TONY-All
TONY-All merged commit 1f4ffe7 into StarMoe-org:main Oct 24, 2026
2 checks passed
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.

2 participants