From df1fd24e8471772afacad151ee5533dcb8d666e6 Mon Sep 17 00:00:00 2001 From: Julien Froidefond Date: Wed, 27 Aug 2025 11:25:00 +0200 Subject: [PATCH] feat: mentor section on homepage --- app/page.tsx | 11 +- components/home/index.ts | 1 + components/home/mentor-section.tsx | 202 +++++++++++++++++++++++++++++ components/home/radar-section.tsx | 2 +- 4 files changed, 213 insertions(+), 3 deletions(-) create mode 100644 components/home/mentor-section.tsx diff --git a/app/page.tsx b/app/page.tsx index 558633b..536b80d 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -9,6 +9,7 @@ import { ActionSection, ClientWrapper, WelcomeScreen, + MentorSection, } from "@/components/home"; export default async function HomePage() { @@ -51,8 +52,14 @@ export default async function HomePage() { {/* Main Content Grid */}
- {/* Radar Chart */} - + {/* Left Column: Radar + Mentor */} +
+ + +
{/* Category Breakdown */} { + 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é +

+ )} +
+
+
+
+ ); +} diff --git a/components/home/radar-section.tsx b/components/home/radar-section.tsx index 5a8f7be..594eb5a 100644 --- a/components/home/radar-section.tsx +++ b/components/home/radar-section.tsx @@ -19,7 +19,7 @@ export function RadarSection({ radarData }: RadarSectionProps) { Radar chart représentant votre niveau par catégorie

-
+