import type { HeatmapTechnique } from "../../api/heatmap"; interface HeatmapTooltipProps { technique: HeatmapTechnique; } export default function HeatmapTooltip({ technique }: HeatmapTooltipProps) { const getMeta = (name: string): string | null => { const item = technique.metadata.find((m) => m.name === name); return item?.value ?? null; }; const testsCount = getMeta("tests_count"); const detectionRules = getMeta("detection_rules"); const totalRules = getMeta("total_rules"); const evaluatedRules = getMeta("evaluated_rules"); const lastValidated = getMeta("last_validated"); const campaignTests = getMeta("campaign_tests"); // Determine status label from score const getStatusLabel = (score: number): { label: string; color: string } => { if (score >= 100) return { label: "Validated", color: "text-green-400" }; if (score >= 60) return { label: "Partial", color: "text-yellow-400" }; if (score >= 30) return { label: "In Progress", color: "text-blue-400" }; if (score > 0) return { label: "Not Covered", color: "text-red-400" }; return { label: "Not Evaluated", color: "text-gray-400" }; }; const status = getStatusLabel(technique.score); return (
{/* Header */}

{technique.techniqueID}

{technique.tactic && (

{technique.tactic.replace(/-/g, " ")}

)}
{/* Status & Score */}
Status: {status.label}
Score: {technique.score}/100
{/* Score bar */}
{testsCount !== null && (
Tests: {testsCount} validated
)} {detectionRules !== null && (
Detection Rules: {detectionRules} available
)} {totalRules !== null && (
Rules: {evaluatedRules || 0} evaluated / {totalRules} total
)} {campaignTests !== null && (
Campaign Tests: {campaignTests}
)} {lastValidated && (
Last validated: {lastValidated}
)}
{/* Comment */} {technique.comment && (

{technique.comment}

)}
); }