dex/src/store/ui.js
chris c9807127d6 Dex grid: ability, egg group, min BST and fully-evolved filters
Extends the existing filter drawer (type/gen) with four more:

- Ability — snapshot abilities already carry a reverse pokemon[] index,
  so this is a plain lookup, no new data needed.
- Egg group — options derived from the species list's own eggGroups.
- Min BST — a number field; hard filter, distinct from sorting by BST.
- Fully evolved only — new species.evolvesFromId field (from
  pokemon-species' evolves_from_species, already fetched during the
  snapshot build, so no extra requests). "Fully evolved" is computed
  client-side as "no other species points here via evolvesFromId" —
  correctly handles branching lines (Eevee's evolutions all count as
  fully evolved; Eevee itself doesn't).

All four persist via the ui store and count toward the filter badge, same
as the existing filters.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Ve7HLspzeG2xDPtJQ8vmu
2026-09-04 12:14:36 -04:00

33 lines
674 B
JavaScript

import { createStore } from './createStore.js';
/**
* Small view-state that should survive reloads but isn't a user "setting":
* e.g. which detail-page tab you last looked at.
*/
export const ui = createStore('pdx.ui', {
detailTab: 'about',
searchQuery: '',
searchScroll: 0,
searchTab: 'pokemon',
feedScroll: 0,
sort: 'dex',
sortDesc: false,
filter: 'all',
filterType: '',
filterGen: 0,
filterAbility: 0,
filterEggGroup: '',
filterMinBst: 0,
filterFullyEvolved: false,
recent: [],
toolsOpen: false,
teamMode: 'coverage',
mvType: '',
mvClass: '',
mvSort: 'name',
mvTm: false,
itCat: '',
itSort: 'name',
abSort: 'name',
});