Skip to content

refactor: décomposer Index.tsx en composants de pages (issue #374) - #387

Merged
thomasgermain93 merged 3 commits into
mainfrom
refactor/issue-374-index-pages
Mar 22, 2026
Merged

thomasgermain93 merged 3 commits into
mainfrom
refactor/issue-374-index-pages

Conversation

@thomasgermain93

Copy link
Copy Markdown
Owner

Résumé

  • Extrait 4 pages du god component Index.tsx (2587 lignes) vers des composants dédiés dans src/pages/game/
  • SummonPage.tsx : Page 0 — Invoquer (onglets BC/Shards, dernière invocation, PityTracker)
  • HeroesPage.tsx : Page 1 — Héros (collection, codex, équipes, filtres)
  • ProgressionPage.tsx : Page 3 — Progression (stats joueur, quêtes journalières, succès)
  • ForgePage.tsx : Page 4 — Forge (fusion + recyclage)

Stratégie

Conservatrice : tout l'état (useState, useEffect, useCallback) reste dans Index.tsx. Les composants sont des renderers purs qui reçoivent leurs données via props. Page 2 (Combat + game loop) non extraite intentionnellement.

Résultat

  • Index.tsx : 2587 → 1751 lignes (-836 lignes, -32%)
  • Nettoyage des imports non utilisés après extraction
  • 4 nouveaux fichiers dans src/pages/game/

Plan de test

  • npm run build — aucune erreur
  • npm test — 246/246 tests passent
  • Aucun état déplacé hors de Index.tsx
  • Page Combat (game loop) non modifiée

Closes #374

🤖 Generated with Claude Code

Thomas and others added 2 commits March 22, 2026 18:26
…(issue #376)

Enable `strictNullChecks: true` in tsconfig.app.json and fix all 108
resulting type errors across 12 files.

Changes by file:
- tsconfig.app.json: add strictNullChecks: true
- TreasureHuntCanvas.tsx: rename canvas/ctx to typed non-null vars for closure safety
- PixelIcon.tsx: remove duplicate keys 'crown' and 'skull' in ICON_MAP
- bestiary.ts: cast bomber.assets as BomberAssetRefs; add as BestiaryBomber[] on map()
- heroVisualSystem.ts: annotate traits as HeroVisualTraits to fix helmetStyle literal type
- useCloudSave.ts: add xp to PlayerHeroRowExtended; cast rarity as Rarity, family as
  HeroFamilyId; double-cast statsOnly as unknown as PlayerData; import Rarity, HeroFamilyId
- useLeaderboard.ts: cast RPC args as never to bypass missing Supabase type definition
- useMarketplace.ts: cast RPC args as never; cast data as unknown as MarketplaceListing[]
- animations.ts: cast pixelSlide return as Variants to fix Framer Motion index signature
- Index.tsx: type boss as Boss|null; capture stageSnapshot.boss for closure narrowing;
  fix storyFailed boolean|undefined with ?? false; import Boss from storyTypes
- Profile.tsx: add @ts-expect-error for delete_user_account RPC (absent from generated types)
- WikiPage.tsx: replace .filter(Boolean) with explicit type guard .filter((a): a is ...)
- ProgressionPage.tsx: move ACHIEVEMENTS import from @/game/types to @/game/achievements

Result: tsc --noEmit 0 errors, 246/246 tests passing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extrait 4 pages du god component Index.tsx (2587 lignes) vers des
composants dédiés dans src/pages/game/ :

- SummonPage.tsx : Page 0 — Invoquer (onglets BC/Shards, dernière invocation)
- HeroesPage.tsx : Page 1 — Héros (collection, codex, équipes, filtres)
- ProgressionPage.tsx : Page 3 — Progression (stats, quêtes journalières, succès)
- ForgePage.tsx : Page 4 — Forge (fusion + recyclage)

Stratégie conservatrice : tout l'état (useState, useEffect, useCallback)
reste dans Index.tsx. Les composants reçoivent leurs données via props.
Page 2 (Combat + game loop) non extraite intentionnellement.

Index.tsx : 2587 → 1751 lignes (-836 lignes, -32%)
Nettoyage des imports non utilisés après extraction.

246 tests passent. Build OK.

Closes #374

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Mar 22, 2026

Copy link
Copy Markdown

Deploying bomberquest with  Cloudflare Pages  Cloudflare Pages

Latest commit: 50f6666
Status:⚡️  Build in progress...

View logs

… page

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@thomasgermain93
thomasgermain93 merged commit 841bcb2 into main Mar 22, 2026
1 of 2 checks passed
github-actions Bot added a commit that referenced this pull request Mar 22, 2026
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.

[ARCH] Décomposer Index.tsx (2598 lignes) en composants et hooks spécialisés

1 participant