fix: combat page field mapping — monster levels, history names, XP/gold values
All checks were successful
CI/CD — Build & Deploy / Build & Deploy (push) Successful in 33s

Monster: minLevel/maxLevel (backend) vs levelMin/levelMax (frontend type)
History: xpEarned/goldEarned + monster.name vs xpGained/goldGained/monsterName
Combat result: rewards.xp/gold vs xpGained/goldGained, level up display
This commit is contained in:
2026-03-24 17:16:24 +01:00
parent eafac3d8c7
commit e3c870bb9f

View File

@@ -21,7 +21,7 @@ function MonsterCard({ m, selected, onSelect }: { m: Monster; selected: boolean;
> >
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', marginBottom: 6 }}> <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', marginBottom: 6 }}>
<span style={{ fontWeight: 700, fontSize: 14, color: selected ? '#f4c94e' : '#dce4f0' }}>{m.name}</span> <span style={{ fontWeight: 700, fontSize: 14, color: selected ? '#f4c94e' : '#dce4f0' }}>{m.name}</span>
<span className="badge badge-red" style={{ fontSize: 10 }}>Niv. {m.levelMin}{m.levelMax}</span> <span className="badge badge-red" style={{ fontSize: 10 }}>Niv. {(m as any).minLevel ?? m.levelMin}{(m as any).maxLevel ?? m.levelMax}</span>
</div> </div>
<div style={{ display: 'flex', gap: 12, fontSize: 12, color: '#6b7a99' }}> <div style={{ display: 'flex', gap: 12, fontSize: 12, color: '#6b7a99' }}>
<span> {m.hp}</span> <span> {m.hp}</span>
@@ -43,16 +43,21 @@ function CombatLog({ result }: { result: CombatResult }) {
{won {won
? <div style={{ color: '#3ddc84', fontWeight: 800, fontSize: 18 }}> ? <div style={{ color: '#3ddc84', fontWeight: 800, fontSize: 18 }}>
<Trophy size={20} style={{ display: 'inline', marginRight: 8 }} /> <Trophy size={20} style={{ display: 'inline', marginRight: 8 }} />
Victoire ! +{result.xpGained} XP +{result.goldGained} or Victoire ! +{(result as any).rewards?.xp ?? result.xpGained} XP +{(result as any).rewards?.gold ?? result.goldGained} or
</div> </div>
: <div style={{ color: '#e84040', fontWeight: 800, fontSize: 18 }}> : <div style={{ color: '#e84040', fontWeight: 800, fontSize: 18 }}>
<Skull size={20} style={{ display: 'inline', marginRight: 8 }} /> <Skull size={20} style={{ display: 'inline', marginRight: 8 }} />
Défaite 50 endurance Défaite 50 endurance
</div> </div>
} }
{result.loot && ( {((result as any).rewards?.loot ?? result.loot) && (
<div style={{ fontSize: 13, color: '#f4c94e', marginTop: 4 }}> <div style={{ fontSize: 13, color: '#f4c94e', marginTop: 4 }}>
🎁 Loot : {result.loot.material.name} ×{result.loot.quantity} 🎁 Loot obtenu !
</div>
)}
{(result as any).rewards?.levelUp && (
<div style={{ fontSize: 13, color: '#a78bfa', marginTop: 4 }}>
🎉 LEVEL UP ! Niveau {(result as any).rewards.newLevel} +{(result as any).rewards.statPointsGained} points de stats
</div> </div>
)} )}
</div> </div>
@@ -190,9 +195,9 @@ export function CombatPage() {
{history.slice(0, 5).map(h => ( {history.slice(0, 5).map(h => (
<div key={h.id} style={{ display: 'flex', justifyContent: 'space-between', fontSize: 12, padding: '3px 0', borderBottom: '1px solid #1e2535' }}> <div key={h.id} style={{ display: 'flex', justifyContent: 'space-between', fontSize: 12, padding: '3px 0', borderBottom: '1px solid #1e2535' }}>
<span style={{ color: h.winner === 'player' ? '#3ddc84' : '#e84040' }}> <span style={{ color: h.winner === 'player' ? '#3ddc84' : '#e84040' }}>
{h.winner === 'player' ? '' : ''} {h.monsterName ?? 'Monstre'} {h.winner === 'player' ? '' : ''} {(h as any).monster?.name ?? h.monsterName ?? 'Monstre'}
</span> </span>
<span style={{ color: '#6b7a99' }}>+{h.xpGained}xp +{h.goldGained}or</span> <span style={{ color: '#6b7a99' }}>+{(h as any).xpEarned ?? h.xpGained}xp +{(h as any).goldEarned ?? h.goldGained}or</span>
</div> </div>
))} ))}
</div> </div>