refactor: décomposer Index.tsx en composants de pages (issue #374) - #387
Merged
Merged
Conversation
…(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>
… page Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Résumé
Index.tsx(2587 lignes) vers des composants dédiés danssrc/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 dansIndex.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%)src/pages/game/Plan de test
npm run build— aucune erreurnpm test— 246/246 tests passentIndex.tsxCloses #374
🤖 Generated with Claude Code