refacto: constants.ts — source unique frontend
All checks were successful
CI/CD — Build & Deploy / Build & Deploy (push) Successful in 41s
All checks were successful
CI/CD — Build & Deploy / Build & Deploy (push) Successful in 41s
- Centralise RARITY_COLORS, RARITY_LABELS, ZONE_INFO, STAT_LABELS - Centralise COMBAT_COST, REST_COST, FORGE_*, ATTACK_TYPES - Supprime 6 duplications dans CombatPage, GuidePage, ShopPage, ForgePage, InventoryPage
This commit is contained in:
@@ -5,14 +5,7 @@ import { combatApi, characterApi } from '../api/endpoints';
|
||||
import type { Monster, CombatResult, MultiCombatResult, CombatLog } from '../api/types';
|
||||
import { Swords, Trophy, Skull, Clock, Zap, Heart, Lock } from 'lucide-react';
|
||||
|
||||
const COMBAT_COST = 5;
|
||||
const REST_COST = 10;
|
||||
|
||||
const ATTACK_TYPES = [
|
||||
{ id: 'melee', label: 'Mêlée', emoji: '⚔️', stat: 'Force × 1.5' },
|
||||
{ id: 'ranged', label: 'Distance', emoji: '🏹', stat: 'Agilité × 1.5' },
|
||||
{ id: 'magic', label: 'Magie', emoji: '✨', stat: 'Intelligence × 1.5' },
|
||||
];
|
||||
import { COMBAT_COST, REST_COST, ATTACK_TYPES, ZONE_INFO } from '../constants';
|
||||
|
||||
function MonsterCard({ m, selected, onSelect, playerLevel }: { m: Monster; selected: boolean; onSelect: () => void; playerLevel: number }) {
|
||||
const tooHard = m.minLevel > playerLevel + 2;
|
||||
@@ -211,11 +204,7 @@ export function CombatPage() {
|
||||
monstersByZone.set(zone, list);
|
||||
}
|
||||
|
||||
const ZONE_LABELS: Record<string, { name: string; emoji: string }> = {
|
||||
marais: { name: 'Les Marais', emoji: '🌿' },
|
||||
egouts: { name: 'Les Égouts', emoji: '🕳️' },
|
||||
desert: { name: 'Le Désert', emoji: '🏜️' },
|
||||
};
|
||||
const ZONE_LABELS = ZONE_INFO;
|
||||
|
||||
// Locked zones (zones not in monsters response = locked)
|
||||
const lockedZones = (zones ?? []).filter((z: any) => !z.unlocked);
|
||||
|
||||
Reference in New Issue
Block a user