"use client"; import { BarChart3, Target, Star } from "lucide-react"; import { TeamStats } from "@/lib/admin-types"; import { TechIcon } from "@/components/icons/tech-icon"; import { COVERAGE_OBJECTIVES, isCoverageBelowObjective, } from "@/lib/evaluation-utils"; interface SkillAnalysis { skillName: string; category: string; importance: "incontournable" | "majeure" | "standard"; icon?: string; experts: Array<{ name: string; level: number; canMentor: boolean; }>; learners: Array<{ name: string; currentLevel: number; }>; averageLevel: number; totalEvaluations: number; expertCount: number; learnerCount: number; proficiencyRate: number; coverage: number; } interface TeamInsights { averageTeamLevel: number; totalExperts: number; totalLearners: number; skillGaps: { incontournable: number; majeure: number; standard: number; }; strongSkills: { incontournable: number; majeure: number; standard: number; }; criticalSkillsCoverage: { incontournable: number; majeure: number; }; } interface TeamOverviewTabProps { team: TeamStats; teamInsights: TeamInsights; skillAnalysis: SkillAnalysis[]; } function getSkillLevelColor(level: number): string { if (level < 0.5) return "bg-red-500"; if (level < 1.5) return "bg-orange-500"; if (level < 2.5) return "bg-blue-500"; return "bg-green-500"; } export function TeamOverviewTab({ team, teamInsights, skillAnalysis, }: TeamOverviewTabProps) { return ( <> {/* Top Skills avec design amélioré */}

Top Compétences de l'équipe

{team.topSkills.slice(0, 6).map((skill, idx) => (
{skill.icon && (
)}
{skill.skillName}
{skill.importance === "incontournable" ? "Incontournable" : skill.importance === "majeure" ? "Majeure" : "Standard"}
{skill.coverage.toFixed(0)}%
{skill.averageLevel.toFixed(1)} {skill.averageLevel < 0.5 ? "Débutant" : skill.averageLevel < 1.5 ? "Intermé." : skill.averageLevel < 2.5 ? "Avancé" : "Expert"}
))}
{/* Compétences critiques */}

Compétences critiques

{/* Incontournables */}

Incontournables

{teamInsights.strongSkills.incontournable} / {teamInsights.strongSkills.incontournable + teamInsights.skillGaps.incontournable}
{skillAnalysis .filter((s) => s.importance === "incontournable") .sort((a, b) => b.coverage - a.coverage) .map((skill, idx) => (
{skill.icon && (
)} {skill.skillName}
{skill.coverage.toFixed(0)}%
))}
{/* Majeures */}

Majeures

{teamInsights.strongSkills.majeure} / {teamInsights.strongSkills.majeure + teamInsights.skillGaps.majeure}
{skillAnalysis .filter((s) => s.importance === "majeure") .sort((a, b) => b.coverage - a.coverage) .map((skill, idx) => (
{skill.icon && (
)} {skill.skillName}
{skill.coverage.toFixed(0)}%
))}
{/* Distribution des niveaux */}

Répartition des niveaux par compétence

{(() => { // Calculer la répartition par compétence individuelle const allSkills = team.members.flatMap((m) => m.skills); const totalSkills = allSkills.length; const levelDistribution = { expert: allSkills.filter((s) => s.level === 3).length, autonomous: allSkills.filter((s) => s.level === 2).length, notAutonomous: allSkills.filter((s) => s.level === 1).length, never: allSkills.filter((s) => s.level === 0).length, }; return [ { label: "Expert", count: levelDistribution.expert, total: totalSkills, color: "bg-green-500", }, { label: "Autonome", count: levelDistribution.autonomous, total: totalSkills, color: "bg-blue-500", }, { label: "Pas autonome", count: levelDistribution.notAutonomous, total: totalSkills, color: "bg-orange-500", }, { label: "Jamais utilisé", count: levelDistribution.never, total: totalSkills, color: "bg-red-500", }, ].map((level, idx) => (
{level.label}
{level.count}
{((level.count / level.total) * 100).toFixed(0)}%
)); })()}

Métriques clés

Compétences incontournables
{teamInsights.criticalSkillsCoverage.incontournable.toFixed( 0 )} %
{teamInsights.skillGaps.incontournable} à renforcer
Compétences majeures
{teamInsights.criticalSkillsCoverage.majeure.toFixed(0)}%
{teamInsights.skillGaps.majeure} à renforcer
Compétences standards
{teamInsights.skillGaps.standard} à renforcer
Objectifs d'apprentissage {teamInsights.totalLearners}
); }