feat: importance in db and mentorcard home colors
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { TechIcon } from "@/components/icons/tech-icon";
|
||||
import { getTechColors } from "@/lib/tech-colors";
|
||||
import { getImportanceColors } from "@/lib/tech-colors";
|
||||
import { UserEvaluation, SkillCategory } from "@/lib/types";
|
||||
|
||||
interface MentorSectionProps {
|
||||
@@ -13,26 +13,6 @@ export function MentorSection({
|
||||
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(
|
||||
@@ -49,6 +29,28 @@ export function MentorSection({
|
||||
name: skillInfo?.name || skill.skillId,
|
||||
icon: skillInfo?.icon || "fas-code",
|
||||
level: skill.level,
|
||||
importance: skillInfo?.importance || "standard", // Récupérer l'importance depuis la base
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
// 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,
|
||||
importance: skillInfo?.importance || "standard", // Récupérer l'importance depuis la base
|
||||
};
|
||||
});
|
||||
});
|
||||
@@ -69,26 +71,11 @@ export function MentorSection({
|
||||
name: skillInfo?.name || skill.skillId,
|
||||
icon: skillInfo?.icon || "fas-code",
|
||||
level: skill.level,
|
||||
importance: skillInfo?.importance || "standard", // Récupérer l'importance depuis la base
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
// 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 (
|
||||
<div
|
||||
className={`bg-white/5 border border-white/10 rounded-xl p-6 backdrop-blur-sm ${className}`}
|
||||
@@ -103,7 +90,7 @@ export function MentorSection({
|
||||
<div className="flex flex-wrap gap-3">
|
||||
{masteredSkills.length > 0 ? (
|
||||
masteredSkills.map((tech) => {
|
||||
const colors = getTechColors(getTechColor(tech.name));
|
||||
const colors = getImportanceColors(tech.importance);
|
||||
return (
|
||||
<div
|
||||
key={tech.id}
|
||||
@@ -138,7 +125,7 @@ export function MentorSection({
|
||||
<div className="flex flex-wrap gap-3">
|
||||
{mentorSkills.length > 0 ? (
|
||||
mentorSkills.map((tech) => {
|
||||
const colors = getTechColors(getTechColor(tech.name));
|
||||
const colors = getImportanceColors(tech.importance);
|
||||
return (
|
||||
<div
|
||||
key={tech.id}
|
||||
@@ -172,7 +159,7 @@ export function MentorSection({
|
||||
<div className="flex flex-wrap gap-3">
|
||||
{learningSkills.length > 0 ? (
|
||||
learningSkills.map((tech) => {
|
||||
const colors = getTechColors(getTechColor(tech.name));
|
||||
const colors = getImportanceColors(tech.importance);
|
||||
return (
|
||||
<div
|
||||
key={tech.id}
|
||||
|
||||
Reference in New Issue
Block a user