refactor: types frontend alignés backend — zéro as any, monstres triés par level
All checks were successful
CI/CD — Build & Deploy / Build & Deploy (push) Successful in 33s

types.ts: rewrite complet — Character, Monster, CombatResult, CombatLog
alignés sur les champs réels du backend. Plus de mapping approximatif.

CombatPage: réécriture propre — monstres triés par level (appropriés en
haut, trop forts en bas avec opacity + warning), historique avec vrais
noms de monstres et valeurs XP/or, level up affiché dans le résultat.

Cleanup: 0 occurrence de "as any" dans tout le frontend.
This commit is contained in:
2026-03-24 17:24:59 +01:00
parent e3c870bb9f
commit 014ffdd789
5 changed files with 103 additions and 58 deletions

View File

@@ -150,10 +150,10 @@ export function DashboardPage() {
if (isLoading) return <div style={{ padding: '2rem', color: '#6b7a99' }}>Chargement</div>;
if (isError || !char) return <CreateCharacter />;
const xpNext = (char as any).xpToNextLevel ?? Math.round(100 * Math.pow(char.level, 1.5));
const statPoints = (char as any).statPoints ?? 0;
const xpNext = char.xpToNextLevel;
const statPoints = char.statPoints ?? 0;
const needsHeal = char.hpCurrent < char.hpMax;
const endurance = (char as any).enduranceCurrent ?? (char as any).endurance ?? 0;
const endurance = char.enduranceCurrent;
const REST_COST = 10;
const COMBAT_COST = 5;
const FORGE_COST = 10;
@@ -202,9 +202,9 @@ export function DashboardPage() {
<span style={{ fontSize: 12, color: '#5ba4f5', display: 'flex', alignItems: 'center', gap: 4 }}>
<Zap size={11} /> Endurance
</span>
<span style={{ fontSize: 11, color: '#6b7a99' }}>{char.enduranceCurrent ?? char.endurance} / {char.enduranceMax}</span>
<span style={{ fontSize: 11, color: '#6b7a99' }}>{endurance} / {char.enduranceMax}</span>
</div>
<Bar value={char.enduranceCurrent ?? char.endurance} max={char.enduranceMax} type="end" showValues={false} />
<Bar value={endurance} max={char.enduranceMax} type="end" showValues={false} />
</div>
<div>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 4 }}>