import { SkillCategory, CategoryEvaluation, SkillLevel } from "@/lib/types"; import { SkillEvaluationCard } from "./skill-evaluation-card"; interface SkillEvaluationGridProps { currentCategory: SkillCategory; currentEvaluation: CategoryEvaluation; onUpdateSkill: (category: string, skillId: string, level: SkillLevel) => void; onUpdateMentorStatus: ( category: string, skillId: string, canMentor: boolean ) => void; onUpdateLearningStatus: ( category: string, skillId: string, wantsToLearn: boolean ) => void; onRemoveSkill: (category: string, skillId: string) => void; } export function SkillEvaluationGrid({ currentCategory, currentEvaluation, onUpdateSkill, onUpdateMentorStatus, onUpdateLearningStatus, onRemoveSkill, }: SkillEvaluationGridProps) { const getSkillEvaluation = (skillId: string) => { const skillEval = currentEvaluation?.skills.find( (s) => s.skillId === skillId ); return ( skillEval || { skillId, level: null, canMentor: false, wantsToLearn: false, } ); }; if (!currentEvaluation.selectedSkillIds.length) { return null; } return (

{currentCategory.category}

{currentEvaluation.selectedSkillIds.length} compétence {currentEvaluation.selectedSkillIds.length > 1 ? "s" : ""}
{currentEvaluation.selectedSkillIds.map((skillId) => { const skill = currentCategory.skills.find((s) => s.id === skillId); if (!skill) return null; const skillEvaluation = getSkillEvaluation(skill.id); return ( onUpdateSkill(currentCategory.category, skillId, level) } onUpdateMentorStatus={(skillId, canMentor) => onUpdateMentorStatus( currentCategory.category, skillId, canMentor ) } onUpdateLearningStatus={(skillId, wantsToLearn) => onUpdateLearningStatus( currentCategory.category, skillId, wantsToLearn ) } onRemoveSkill={(skillId) => onRemoveSkill(currentCategory.category, skillId) } /> ); })}
); }