Repository navigation
feat: add a Pokédex tab, and fix the learnsets it exposed - #11
Merged
Merged
Conversation
Joseph asked for a section showing full Pokémon details with a decent sized picture, and a way to jump straight there from the Stats tab. The Pokédex tab (src/features/Dex.jsx) shows one Pokémon at a time: official artwork, the Pokédex entry quoted from the games with the game named underneath it, height/weight/gender/catch rate/egg groups, every ability with what it does, base stats, defensive type matchups, the evolution line with what each step takes, and the full learnset with a "as it levels up" / "everything it can learn" toggle and a search. Stats rows get an inline link button beside each name that opens that Pokémon in the Pokédex. The descriptive data is baked, not fetched: scripts/build-species.mjs (npm run refresh-species) writes src/data/species.json and abilities.json, same rule as the rest of the dex. The bio is stored verbatim with the game it came from, because attribution is what makes it safe to show. Baking it surfaced a real bug in the existing learnsets. PokéAPI's Japan-only Gen 1 re-releases were added to the API late and carry version-group ids above Scarlet/Violet, so ranking on id made them "latest" for most of Gen 1 — Mewtwo had 43 moves, all from Red and Blue, and Bulbasaur had 23. 187 Pokémon were affected. The Legends games and the battle-only spin-offs have the opposite problem: full entries, tiny move pools. scripts/version-groups.mjs now holds the main-series list and both bakes share it, so a move's level and the learnset it sits in always come from the same game. Mewtwo is on 102 moves; only learnsets changed in pokedex.json, no stats or types moved. New tests: src/lib/dex.test.js (matchups, conversions, evolution steps, learnset splitting — values derived by hand) and src/data/species.test.js (guards the bake, including that every bio names its game).
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.
Joseph asked for a Pokédex section — full details, a decent sized picture, a bio if we're sure the data is canonical, and inline link buttons on the Stats page to jump straight there.
The Pokédex tab
One Pokémon at a time, picture first:
Stats → Pokédex
An inline icon button sits beside every name in the Stats table and in the expanded card. It stops the click from also expanding the row, and it carries a counter alongside the id so pressing the same link twice still moves the Pokédex.
The bug this turned up
Baking the level-up data meant working out which game a learnset comes from, and the existing answer was wrong twice over:
scripts/version-groups.mjsnow holds the main-series list with the reason each exclusion is there, and both bakes import it, so a move's level and the learnset it sits in always come from the same game. Mewtwo is on 102 moves, Bulbasaur on 48.Only learnsets moved in
pokedex.json— 444 entries changed, 0 stats, types, abilities, names or sprites. 93 shrank, all Pokémon that had been drawing their moves from a battle-only spin-off; what's left is what they can actually learn in Scarlet/Violet. There's a changelog line saying so, because Machamp losing 18 options is the kind of thing Joseph notices.Data
npm run refresh-species(scripts/build-species.mjs) writessrc/data/species.jsonandsrc/data/abilities.json, committed like the rest — still nothing fetched at runtime.LIMIT=20runs it over a slice for a quick check. The bake asserts the artwork URL it builds matches the one PokéAPI reports, so a moved path fails there rather than on a phone. All 1025 Pokémon came back with artwork and a modern-game bio.Tests
npm run test:run— 353 pass (up from 314).src/lib/dex.test.js— matchup multipliers, unit conversions, gender, evolution steps, learnset splitting. Values derived by hand from the type chart, same asbattle.test.js.src/data/species.test.js— guards the bake: every Pokémon covered, every bio present and naming its game, no raw Game Boy line breaks, evolution conditions readable and grammatical, every level pointing at a real move, artwork for everyone, and a regression check that Gen 1 isn't back on its Red/Blue learnset.Verified in a real browser at desktop and phone widths — including that the new toggle style doesn't leak onto the battle screen's move buttons, which carry
data-onon every slot.npm run buildis green anddist/CNAMEsurvives.🤖 Generated with Claude Code
https://claude.ai/code/session_01E63KHsTdwuRVEzKx7sBK1Y
Generated by Claude Code