Add mentor and learning status updates to skill evaluation
- Introduced `updateSkillMentorStatus` and `updateSkillLearningStatus` functions to manage mentor and learning preferences for skills. - Updated `SkillEvaluationCard` to include buttons for toggling mentor and learning statuses with corresponding icons. - Enhanced `SkillEvaluationGrid` and `SkillEvaluation` components to pass new status update handlers. - Modified `SkillEvaluation` type to accommodate new properties for mentor and learning status.
This commit is contained in:
@@ -5,6 +5,16 @@ 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;
|
||||
}
|
||||
|
||||
@@ -12,13 +22,22 @@ export function SkillEvaluationGrid({
|
||||
currentCategory,
|
||||
currentEvaluation,
|
||||
onUpdateSkill,
|
||||
onUpdateMentorStatus,
|
||||
onUpdateLearningStatus,
|
||||
onRemoveSkill,
|
||||
}: SkillEvaluationGridProps) {
|
||||
const getSkillLevel = (skillId: string): SkillLevel => {
|
||||
const getSkillEvaluation = (skillId: string) => {
|
||||
const skillEval = currentEvaluation?.skills.find(
|
||||
(s) => s.skillId === skillId
|
||||
);
|
||||
return skillEval?.level || null;
|
||||
return (
|
||||
skillEval || {
|
||||
skillId,
|
||||
level: null,
|
||||
canMentor: false,
|
||||
wantsToLearn: false,
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
if (!currentEvaluation.selectedSkillIds.length) {
|
||||
@@ -44,16 +63,30 @@ export function SkillEvaluationGrid({
|
||||
const skill = currentCategory.skills.find((s) => s.id === skillId);
|
||||
if (!skill) return null;
|
||||
|
||||
const currentLevel = getSkillLevel(skill.id);
|
||||
const skillEvaluation = getSkillEvaluation(skill.id);
|
||||
|
||||
return (
|
||||
<SkillEvaluationCard
|
||||
key={skill.id}
|
||||
skill={skill}
|
||||
currentLevel={currentLevel}
|
||||
skillEvaluation={skillEvaluation}
|
||||
onUpdateSkill={(skillId, level) =>
|
||||
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user