diff --git a/components/home/category-card.tsx b/components/home/category-card.tsx index 56dcd99..b284141 100644 --- a/components/home/category-card.tsx +++ b/components/home/category-card.tsx @@ -5,6 +5,7 @@ import { Button } from "@/components/ui/button"; import { ChevronDown, ChevronRight, ExternalLink } from "lucide-react"; import { getCategoryIcon } from "@/lib/category-icons"; import { getScoreColors } from "@/lib/score-utils"; +import { getImportanceColors } from "@/lib/tech-colors"; import { SkillProgress } from "./skill-progress"; import Link from "next/link"; @@ -29,6 +30,7 @@ interface CategoryCardProps { id: string; name: string; icon?: string; + importance: "incontournable" | "majeure" | "standard"; }>; }; } @@ -114,23 +116,39 @@ export function CategoryCard({
{categoryEval && skillCategory && skillsCount > 0 ? (
- {categoryEval.selectedSkillIds.map((skillId) => { - const skill = skillCategory.skills.find( - (s) => s.id === skillId - ); - if (!skill) return null; - - const skillEval = categoryEval.skills.find( - (s) => s.skillId === skillId - ); - return ( - - ); - })} + {categoryEval.selectedSkillIds + .map((skillId) => { + const skill = skillCategory.skills.find( + (s) => s.id === skillId + ); + return skill ? { ...skill, id: skillId } : null; + }) + .filter( + (skill): skill is NonNullable => skill !== null + ) + .sort((a, b) => { + const importanceOrder = { + incontournable: 2, + majeure: 1, + standard: 0, + }; + return ( + importanceOrder[b.importance] - + importanceOrder[a.importance] + ); + }) + .map((skill) => { + const skillEval = categoryEval.skills.find( + (s) => s.skillId === skill.id + ); + return ( + + ); + })}
) : (
diff --git a/components/home/mentor-section.tsx b/components/home/mentor-section.tsx index 2368cf0..ce6c90a 100644 --- a/components/home/mentor-section.tsx +++ b/components/home/mentor-section.tsx @@ -13,6 +13,22 @@ export function MentorSection({ userEvaluation, skillCategories, }: MentorSectionProps) { + // Fonction de tri par importance + const sortByImportance = ( + a: { importance: string }, + b: { importance: string } + ) => { + const importanceOrder = { + incontournable: 2, + majeure: 1, + standard: 0, + }; + return ( + importanceOrder[b.importance as keyof typeof importanceOrder] - + importanceOrder[a.importance as keyof typeof importanceOrder] + ); + }; + // Récupérer les compétences maîtrisées (expert uniquement) const masteredSkills = userEvaluation.evaluations.flatMap((cat) => { const skillCategory = skillCategories.find( @@ -81,6 +97,40 @@ export function MentorSection({ className={`bg-white/5 border border-white/10 rounded-xl p-6 backdrop-blur-sm ${className}`} >
+ {/* Peut mentorer */} +
+

+ + Peut mentorer +

+
+ {mentorSkills.length > 0 ? ( + mentorSkills.sort(sortByImportance).map((tech) => { + const colors = getImportanceColors(tech.importance); + return ( +
+ + + {tech.name} + +
+ ); + }) + ) : ( +

+ Aucune compétence mentor configurée +

+ )} +
+
+ {/* Technologies maîtrisées */}

@@ -89,7 +139,7 @@ export function MentorSection({

{masteredSkills.length > 0 ? ( - masteredSkills.map((tech) => { + masteredSkills.sort(sortByImportance).map((tech) => { const colors = getImportanceColors(tech.importance); return (
- {/* Peut mentorer */} -
-

- - Peut mentorer -

-
- {mentorSkills.length > 0 ? ( - mentorSkills.map((tech) => { - const colors = getImportanceColors(tech.importance); - return ( -
- - - {tech.name} - -
- ); - }) - ) : ( -

- Aucune compétence mentor configurée -

- )} -
-
- {/* Technologies à apprendre */}

@@ -158,7 +174,7 @@ export function MentorSection({

{learningSkills.length > 0 ? ( - learningSkills.map((tech) => { + learningSkills.sort(sortByImportance).map((tech) => { const colors = getImportanceColors(tech.importance); return (
+
- {skill.name} + {skill.name}
{skillEval?.level && (