Skip to content

feat(dex): add search, sorting, and filters to Pokédex and Catch Log - #329

Open
KillianHzr wants to merge 2 commits into
chattymin:mainfrom
KillianHzr:feat/dex-search-sort-filters
Open

KillianHzr wants to merge 2 commits into
chattymin:mainfrom
KillianHzr:feat/dex-search-sort-filters

Conversation

@KillianHzr

Copy link
Copy Markdown
Contributor

Summary

This PR introduces comprehensive search, sorting, and filtering capabilities to both the Pokédex grid and the Catch Log (Journal de captures) in the Collection tab:

  • Search Bar: Live search by Pokémon name (case- and diacritic-insensitive), Pokédex number (e.g. 25 or #25), and multilingual translations stored in saves. Includes a clear button (xmark.circle.fill).
  • Shiny Filter: Quick toggle button to filter species captured as shiny (in Pokédex) or individual shiny catches (in Catch Log), with clear visual highlight when active.
  • Sorting Options:
    • Pokédex: Number (Low to High - default), Number (High to Low), Name (A–Z), Name (Z–A), and Rarity (High to Low).
    • Catch Log: Most Recent (default, active companion pinned first), Oldest First, Number (Low to High), Number (High to Low), Name (A–Z), Name (Z–A), and Rarity (High to Low).
  • Empty State: Displays a friendly empty search result state with an icon, message, and a "Reset filters" button to quickly restore the full collection.
  • Localization: All UI copy and sort option labels are localized across all 7 supported languages (ko, en, ja, es, fr, pt, de).
  • Tests: Comprehensive unit tests covering search matching, sort orders, and filter combinations in DexSearchAndFilterTests.swift.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Documentation
  • Other:

UI changes

Before After
The Pokédex grid only displayed species in fixed ascending numerical order without search, custom sorting, or shiny filtering. The Catch Log only displayed entries in chronological order. A compact toolbar sits below the Collection subtab picker with a search field, a shiny filter toggle, and a sort menu. When no matches are found, a clear empty state with a "Reset filters" button is shown. Cell sizes remain balanced within the 520pt fixed popover height.

Checklist

  • swift build and swift test pass locally
  • PR title and description are written in English
  • UI changes are described above (before/after — images optional)
  • No copyrighted assets, secrets, or private tooling references are committed (see CONTRIBUTING)
  • Tests were added or updated for this change

- Add search bar matching by species name, # ID, and multilingual names
- Add sorting options: Pokédex number asc/desc, name A-Z / Z-A, and rarity descending
- Add Catch Log sorting options: most recent / oldest first, number asc/desc, name, and rarity
- Add shiny-only filter toggle with visual indicator
- Add empty search results state with reset filters button
- Support all 7 application languages
- Add comprehensive unit test suite in DexSearchAndFilterTests
…n DexSearchAndFilterTests

- Initialize CompanionStore via encoded file to avoid private state setter access
- Use boolean comparison checks for ComparisonResult ordering
- Remove unused store instance in localization test
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