import { TechIcon } from "@/components/icons/tech-icon"; import { getTechColors } from "@/lib/tech-colors"; import { UserEvaluation, SkillCategory } from "@/lib/types"; interface MentorSectionProps { className?: string; userEvaluation: UserEvaluation; skillCategories: SkillCategory[]; } export function MentorSection({ className = "", userEvaluation, skillCategories, }: MentorSectionProps) { // Récupérer les compétences où l'utilisateur peut être mentor const mentorSkills = userEvaluation.evaluations.flatMap((cat) => { const skillCategory = skillCategories.find( (sc) => sc.category === cat.category ); return cat.skills .filter((skill) => skill.canMentor) .map((skill) => { const skillInfo = skillCategory?.skills.find( (s) => s.id === skill.skillId ); return { id: skill.skillId, name: skillInfo?.name || skill.skillId, icon: skillInfo?.icon || "fas-code", level: skill.level, }; }); }); // Récupérer les compétences maîtrisées (expert uniquement) const masteredSkills = userEvaluation.evaluations.flatMap((cat) => { const skillCategory = skillCategories.find( (sc) => sc.category === cat.category ); return cat.skills .filter((skill) => skill.level === "expert") .map((skill) => { const skillInfo = skillCategory?.skills.find( (s) => s.id === skill.skillId ); return { id: skill.skillId, name: skillInfo?.name || skill.skillId, icon: skillInfo?.icon || "fas-code", level: skill.level, }; }); }); // Récupérer les compétences que l'utilisateur veut apprendre const learningSkills = userEvaluation.evaluations.flatMap((cat) => { const skillCategory = skillCategories.find( (sc) => sc.category === cat.category ); return cat.skills .filter((skill) => skill.wantsToLearn) .map((skill) => { const skillInfo = skillCategory?.skills.find( (s) => s.id === skill.skillId ); return { id: skill.skillId, name: skillInfo?.name || skill.skillId, icon: skillInfo?.icon || "fas-code", level: skill.level, }; }); }); // Fonction pour déterminer la couleur d'une technologie const getTechColor = (techName: string) => { const lowerName = techName.toLowerCase(); if (lowerName.includes("react") || lowerName.includes("next")) return "react"; if (lowerName.includes("typescript") || lowerName.includes("javascript")) return "typescript"; if (lowerName.includes("node")) return "nodejs"; if (lowerName.includes("python")) return "python"; if (lowerName.includes("docker")) return "docker"; if (lowerName.includes("aws")) return "aws"; if (lowerName.includes("kubernetes")) return "kubernetes"; if (lowerName.includes("git")) return "default"; return "default"; }; return (
{/* Technologies maîtrisées */}

Technologies maîtrisées

{masteredSkills.length > 0 ? ( masteredSkills.map((tech) => { const colors = getTechColors(getTechColor(tech.name)); return (
{tech.name} Expert
); }) ) : (

Aucune technologie maîtrisée

)}
{/* Peut mentorer */}

Peut mentorer

{mentorSkills.length > 0 ? ( mentorSkills.map((tech) => { const colors = getTechColors(getTechColor(tech.name)); return (
{tech.name}
); }) ) : (

Aucune compétence mentor configurée

)}
{/* Technologies à apprendre */}

Veux apprendre

{learningSkills.length > 0 ? ( learningSkills.map((tech) => { const colors = getTechColors(getTechColor(tech.name)); return (
{tech.name}
); }) ) : (

Aucun objectif d'apprentissage configuré

)}
); }