"use client"; import { Code2, Palette, Database, Cloud, Shield, Smartphone, Layers, } from "lucide-react"; import { TreeCategoryHeader, TreeItemRow } from "@/components/admin"; import { TechIcon } from "@/components/icons/tech-icon"; import { Skill } from "@/clients/domains/admin-client"; interface SkillsListProps { filteredSkillsByCategory: Record; expandedCategories: Set; onToggleCategory: (category: string) => void; onEditSkill: (skill: Skill) => void; onDeleteSkill: (skillId: string) => void; } export function SkillsList({ filteredSkillsByCategory, expandedCategories, onToggleCategory, onEditSkill, onDeleteSkill, }: SkillsListProps) { // Fonction pour obtenir l'icône de la catégorie const getCategoryIcon = (category: string) => { const categoryName = category.toLowerCase(); if (categoryName.includes("frontend") || categoryName.includes("front")) return Code2; if (categoryName.includes("backend") || categoryName.includes("back")) return Layers; if ( categoryName.includes("design") || categoryName.includes("ui") || categoryName.includes("ux") ) return Palette; if (categoryName.includes("data") || categoryName.includes("database")) return Database; if (categoryName.includes("cloud") || categoryName.includes("devops")) return Cloud; if (categoryName.includes("security") || categoryName.includes("securité")) return Shield; if ( categoryName.includes("mobile") || categoryName.includes("android") || categoryName.includes("ios") ) return Smartphone; return Code2; // Par défaut }; return ( <> {Object.entries(filteredSkillsByCategory).map( ([category, categorySkills], index) => (
onToggleCategory(category)} icon={(() => { const IconComponent = getCategoryIcon(category); return ; })()} itemCount={categorySkills.length} itemLabel="skill" showSeparator={index > 0} /> {/* Liste des skills de la catégorie */} {expandedCategories.has(category) && (
{categorySkills.map((skill, skillIndex) => (
{skill.icon || "?"}
} title={skill.name} subtitle={skill.description} badges={[ { text: `${skill.usageCount} util.`, variant: "outline", }, ]} onEdit={() => onEditSkill(skill)} onDelete={() => onDeleteSkill(skill.id)} canDelete={skill.usageCount === 0} showSeparator={skillIndex > 0} /> ))}
)} ) )} ); }