refactor: rule of coverage are in one place
This commit is contained in:
@@ -24,6 +24,10 @@ import {
|
||||
} from "lucide-react";
|
||||
import { TechIcon } from "@/components/icons/tech-icon";
|
||||
import { getImportanceColors } from "@/lib/tech-colors";
|
||||
import {
|
||||
COVERAGE_OBJECTIVES,
|
||||
isCoverageBelowObjective,
|
||||
} from "@/lib/evaluation-utils";
|
||||
|
||||
interface TeamStatsRowProps {
|
||||
teamId: string;
|
||||
@@ -70,10 +74,11 @@ export function getSkillLevelBadgeClasses(level: number): string {
|
||||
return "bg-green-500/20 border-green-500/30 text-green-300";
|
||||
}
|
||||
|
||||
export function getProgressColor(percentage: number): string {
|
||||
if (percentage < 30) return "bg-red-500";
|
||||
if (percentage < 60) return "bg-orange-500";
|
||||
if (percentage < 80) return "bg-blue-500";
|
||||
export function getProgressColor(
|
||||
percentage: number,
|
||||
importance: "incontournable" | "majeure" | "standard"
|
||||
): string {
|
||||
if (isCoverageBelowObjective(percentage, importance)) return "bg-red-500";
|
||||
return "bg-green-500";
|
||||
}
|
||||
|
||||
@@ -90,8 +95,14 @@ export function TeamStatsRow({
|
||||
onViewReport,
|
||||
}: TeamStatsRowProps) {
|
||||
// Calculer les alertes sur les compétences critiques
|
||||
const hasIncontournableAlert = criticalSkillsCoverage.incontournable < 75;
|
||||
const hasMajeureAlert = criticalSkillsCoverage.majeure < 60;
|
||||
const hasIncontournableAlert = isCoverageBelowObjective(
|
||||
criticalSkillsCoverage.incontournable,
|
||||
"incontournable"
|
||||
);
|
||||
const hasMajeureAlert = isCoverageBelowObjective(
|
||||
criticalSkillsCoverage.majeure,
|
||||
"majeure"
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="group bg-gradient-to-r from-slate-800/50 to-slate-700/40 backdrop-blur-sm border border-slate-600/40 rounded-xl p-4 hover:from-slate-700/60 hover:to-slate-600/50 hover:border-slate-500/50 transition-all duration-300 shadow-lg hover:shadow-xl">
|
||||
@@ -144,7 +155,10 @@ export function TeamStatsRow({
|
||||
<div className="text-center">
|
||||
<div
|
||||
className={`text-sm font-bold ${
|
||||
criticalSkillsCoverage.incontournable < 75
|
||||
isCoverageBelowObjective(
|
||||
criticalSkillsCoverage.incontournable,
|
||||
"incontournable"
|
||||
)
|
||||
? "text-red-400"
|
||||
: "text-green-400"
|
||||
}`}
|
||||
@@ -158,7 +172,7 @@ export function TeamStatsRow({
|
||||
<p className="text-xs">
|
||||
Couverture des compétences incontournables
|
||||
<br />
|
||||
Objectif : 75%
|
||||
Objectif : {COVERAGE_OBJECTIVES.incontournable}%
|
||||
</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
@@ -170,7 +184,10 @@ export function TeamStatsRow({
|
||||
<div className="text-center">
|
||||
<div
|
||||
className={`text-sm font-bold ${
|
||||
criticalSkillsCoverage.majeure < 60
|
||||
isCoverageBelowObjective(
|
||||
criticalSkillsCoverage.majeure,
|
||||
"majeure"
|
||||
)
|
||||
? "text-red-400"
|
||||
: "text-green-400"
|
||||
}`}
|
||||
@@ -184,7 +201,7 @@ export function TeamStatsRow({
|
||||
<p className="text-xs">
|
||||
Couverture des compétences majeures
|
||||
<br />
|
||||
Objectif : 60%
|
||||
Objectif : {COVERAGE_OBJECTIVES.majeure}%
|
||||
</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
@@ -222,13 +239,11 @@ export function TeamStatsRow({
|
||||
<div className="flex items-center gap-2">
|
||||
{topSkills.slice(0, 3).map((skill, idx) => {
|
||||
const colors = getImportanceColors(skill.importance);
|
||||
const target =
|
||||
skill.importance === "incontournable"
|
||||
? 75
|
||||
: skill.importance === "majeure"
|
||||
? 60
|
||||
: 0;
|
||||
const isUnderTarget = target > 0 && skill.coverage < target;
|
||||
const target = COVERAGE_OBJECTIVES[skill.importance];
|
||||
const isUnderTarget = isCoverageBelowObjective(
|
||||
skill.coverage,
|
||||
skill.importance
|
||||
);
|
||||
|
||||
return (
|
||||
<TooltipProvider key={idx}>
|
||||
|
||||
Reference in New Issue
Block a user