Refactor character class handling across components: Replace hardcoded character class definitions with a centralized CHARACTER_CLASSES import, enhancing maintainability and consistency. Update ProfileForm, Leaderboard, and LeaderboardSection components to utilize new utility functions for character class icons and names, improving code clarity and reducing duplication.
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 2m48s

This commit is contained in:
Julien Froidefond
2025-12-15 10:08:12 +01:00
parent 7dfd426d1f
commit 1e865330a0
7 changed files with 191 additions and 199 deletions

View File

@@ -14,6 +14,7 @@ import {
BackgroundSection,
SectionTitle,
} from "@/components/ui";
import { CHARACTER_CLASSES } from "@/lib/character-classes";
export default function RegisterPage() {
const router = useRouter();
@@ -397,22 +398,7 @@ export default function RegisterPage() {
Classe de Personnage (optionnel)
</label>
<div className="grid grid-cols-2 gap-2">
{[
{ value: "WARRIOR", name: "Guerrier", icon: "⚔️" },
{ value: "MAGE", name: "Mage", icon: "🔮" },
{ value: "ROGUE", name: "Voleur", icon: "🗡️" },
{ value: "RANGER", name: "Rôdeur", icon: "🏹" },
{ value: "PALADIN", name: "Paladin", icon: "🛡️" },
{ value: "ENGINEER", name: "Ingénieur", icon: "⚙️" },
{ value: "MERCHANT", name: "Marchand", icon: "💰" },
{ value: "SCHOLAR", name: "Érudit", icon: "📚" },
{ value: "BERSERKER", name: "Berserker", icon: "🔥" },
{
value: "NECROMANCER",
name: "Nécromancien",
icon: "💀",
},
].map((cls) => (
{CHARACTER_CLASSES.map((cls) => (
<button
key={cls.value}
type="button"