Skip to content

Migrate/react - #3

Merged
Franklyn-R-Silva merged 16 commits into
mainfrom
migrate/react
Jul 12, 2026
Merged

Migrate/react#3
Franklyn-R-Silva merged 16 commits into
mainfrom
migrate/react

Conversation

@Franklyn-R-Silva

Copy link
Copy Markdown
Owner

No description provided.

Franklyn-R-Silva and others added 16 commits July 12, 2026 18:06
- Meta decks expanded to 10 archetypes (Charizard, Miraidon, Gardevoir,
  Lugia, Lost Box, Gholdengo, Chien-Pao, Arceus, Roaring Moon, Snorlax)
- Faster import: meta loading now fetches all cards in parallel (Promise.all)
  instead of sequentially, and searchCards caches results in memory so repeat
  loads are instant
- View a card up close in the deck builder: a magnifier on catalog cards and
  the deck-list rows opens the 3D CardDetail; the modal gains an optional
  "Add to deck" button so you can inspect then add

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A dedicated "Cartas" view (?view=cards, opened from the header) to browse
the whole Pokémon TCG catalog — frontend only, via the Pokémon TCG API:

- Advanced filters: name search, supertype, energy type, rarity, and sort
  (newest / A–Z / highest HP / price); price sort is applied per page
- Paginated grid (24/page) over the full catalog (~17k cards) with each
  card's market price; clicking opens the 3D CardDetail
- searchCards gains rarity/orderBy/pageSize params and in-memory caching
- Lazy-loaded as its own chunk (~4KB); styles in src/styles/cards.css
- Header now has 🃟 Cartas + 🃏 Deck buttons; App routes ?view=cards|deck

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Plans the community/collection/deck backend (no marketplace/selling):
- IMPLEMENTATION_PLAN.md: scope, Supabase setup, auth (email + OAuth),
  schema + RLS, React layer (contexts/hooks/views), phased roadmap
- supabase/migrations/ numbered 00001..00006, every table prefixed poke_:
  poke_profiles, poke_collection, poke_wishlist, poke_decks, poke_favorites,
  poke_deck_likes — each with RLS (own-row; public read for profiles and
  public decks), plus a handle_new_user trigger to auto-create profiles
- .env.example documents VITE_SUPABASE_URL / _PUBLISHABLE_KEY (the real .env
  stays gitignored)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Full picture of what is left (no marketplace): finalize the React migration,
security/config (anon key + Cloudflare env), Supabase phases (auth, collection,
decks, public decks, sync, community), frontend items (portal nav, deck
sharing, card page), quality (tests, RLS checks), docs and deploy — with a
recommended order. Backend details live in IMPLEMENTATION_PLAN.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- services/supabase.ts: single client from VITE_SUPABASE_* env (null +
  isSupabaseConfigured=false when not set, so the app runs without it)
- context/AuthContext: session/user + signIn/signUp/OAuth(Google,Discord)/
  signOut, wired via onAuthStateChange
- components/auth/AuthModal: email/password + OAuth, sign-in/up toggle
- Header shows Sign in / Sign out when Supabase is configured
- @supabase/supabase-js added; styles in src/styles/auth.css

Note: use the ANON/publishable key in .env (never service_role) — the app
security relies on the poke_* RLS policies.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… progress

- ModalContext restores focus to the trigger element on close (#13, a11y)
- CardBrowser: skeleton grid while loading instead of a spinner, and all
  filters + page are kept in the URL so back/reload preserves the state (#8)
- DeckBuilder: a progress bar tracks the meta-deck import as each card
  resolves (#11)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Battle mini-game is now dynamically imported on the first Batalhar
  click (separate ~7KB chunk) instead of loading with the panels (#5)
- Device image swapped from pokedex.png (118KB) to pokedex.webp (18KB),
  ~85% smaller; old PNG removed (#6/perf)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Restore src/assets/pokedex.png as the device image and revert the import
  (the .webp the user provided is a logo, not the device)
- Use logo_pokedex.webp as the header brand (replaces the text)
- Battle: WebAudio hit sound on each attack (higher/gold tone on super
  effective) and the fainted Pokémon plays its real cry

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
An Emerald-inspired mini-game (?view=aventura, lazy-loaded, 🎮 in the header):
- Canvas tile overworld (grass, tall grass, trees, water, gym) with simple
  icon tiles; the player walks with arrow keys/WASD (collision + saved
  position); the character is the team's lead Pokémon sprite
- Tall grass triggers random wild encounters; the gym tile starts a leader
  battle; winning the gym grants a badge (localStorage)
- AdventureBattle: a compact React turn-based battle reusing the battle
  engine's shared core (buildFighter/computeDamage) and sound (WebAudio hit +
  fainted cry), styled with the existing .battle-* classes
- battle.ts now exports buildFighter/computeDamage/playHit/playCry + types
- Bilingual strings; styles in src/styles/adventure.css

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Reverts the overworld mini-game per request: deletes the adventure
components and CSS, unwires the route/header button, drops the adv* i18n
keys, and un-exports the battle helpers that were only used by it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Expert analysis: analyzeDeck now counts draw Supporters and adds actionable
  "expert suggestions" — ideal Pokémon count (~12–20), draw Supporters
  (~6–10), energy ratio (~8–15), high energy-curve warning, and a "solid
  deck" note. Shown in a dedicated 💡 section under the analysis
- Robust meta import: picks the exact-name match (not just the first result)
  and retries once on empty responses (rate limits), so archetypes import
  with the right cards and their quantities

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Potion item (🧪, 2 uses per run): heals the active Pokemon ~40% and costs
  the turn (the opponent attacks back) — adds strategy to the fight
- Win record: best number of phases cleared is saved in localStorage and
  shown on the setup screen and the victory screen
- battle-potion styling

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A dedicated, LigaPokémon-style browse view (?view=pokedex, 🔎 Explorar in the
header) — clean React, professional layout:
- Sidebar filters: search, Type (18 colored type chips with contextual
  counts, multi-select), Generation (I–IX with counts), Clear
- Grid of Pokémon (sprite, number, name, type badges) with sort and load-more;
  clicking a Pokémon opens it in the main Pokédex
- Counts are contextual (type counts respect the selected generation and
  vice-versa); type membership is built once from the type/generation lists
- Lazy-loaded (~5KB) chunk; styles in src/styles/pokedex.css

Fix: the view uses <div> (not <main>/<header>) so it doesn't inherit the
app's global `main { display:flex }` 3-column layout, which was collapsing
the results grid to one column.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- tcg.ts selects `legalities`; TcgCard gains legalStandard/legalExpanded
- analyzeDeck reports standardLegal/expandedLegal + how many cards are out of
  Standard (rotated); shown as ✔/✖ format badges in the analysis
- unit test for legality

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Meta decks are hardcoded templates (src/domain/metaDecks.ts) whose cards are
fetched from the Pokemon TCG API by name. Import was ~13 requests per deck.

- fetchCardsByNames(names): a single OR query (name:A OR name:B ...) for
  the whole archetype, returning a name->best-card map, cached in memory +
  localStorage
- DeckBuilder loadMeta uses it: 1 request instead of ~13; a re-import of the
  same deck is instant (served from localStorage, 0 requests)

Measured: 1st import ~2 requests; 2nd import 0 requests / ~40ms.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The .dark class was only applied by useTheme inside Header, which is not
rendered on the full-screen sub-views (deck/cards/pokedex). Opening those
directly left them in light mode (dark text issues / inconsistency).

- Lift useTheme to App (always mounted) so the theme class applies on every
  view; Header now receives theme + onToggleTheme via props
- Truncate long Pokémon names in the explorer grid (ellipsis) so text no
  longer overflows the card

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 12, 2026 22:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Franklyn-R-Silva
Franklyn-R-Silva merged commit 5921c74 into main Jul 12, 2026
1 of 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