import { motion } from 'framer-motion'; import { Bot, Zap, Brain, Activity, ChevronRight } from 'lucide-react'; import { OpportunityTreemap, TreemapData, ReadinessCategory } from '../charts/OpportunityTreemap'; import type { AnalysisData, HeatmapDataPoint, SubFactor } from '../../types'; interface AgenticReadinessTabProps { data: AnalysisData; } // Global Score Gauge function GlobalScoreGauge({ score, confidence }: { score: number; confidence?: string }) { const getColor = (s: number) => { if (s >= 7) return '#059669'; // emerald-600 - Ready to automate if (s >= 5) return '#6D84E3'; // primary blue - Assist with copilot if (s >= 3) return '#D97706'; // amber-600 - Optimize first return '#DC2626'; // red-600 - Not ready }; const getLabel = (s: number) => { if (s >= 7) return 'Listo para Automatizar'; if (s >= 5) return 'Asistir con Copilot'; if (s >= 3) return 'Optimizar Primero'; return 'No Apto'; }; const color = getColor(score); const percentage = (score / 10) * 100; return (

Agentic Readiness Score

{confidence && ( Confianza: {confidence === 'high' ? 'Alta' : confidence === 'medium' ? 'Media' : 'Baja'} )}
{/* Score Display */}
{score.toFixed(1)} /10

{getLabel(score)}

{score >= 7 ? 'Skills con alta predictibilidad y bajo riesgo de error' : score >= 5 ? 'Skills aptos para asistencia AI con supervisión humana' : 'Requiere optimización de procesos antes de automatizar'}

); } // Sub-factors Breakdown function SubFactorsBreakdown({ subFactors }: { subFactors: SubFactor[] }) { const getIcon = (name: string) => { if (name.includes('repetitiv')) return Activity; if (name.includes('predict')) return Brain; if (name.includes('estructura') || name.includes('complex')) return Zap; return Bot; }; return (

Desglose de Factores

{subFactors.map((factor) => { const Icon = getIcon(factor.name); const percentage = (factor.score / 10) * 100; const weightPct = Math.round(factor.weight * 100); return (
{factor.displayName} ({weightPct}%)
{factor.score.toFixed(1)}

{factor.description}

); })}
); } // Skills Heatmap/Table function SkillsReadinessTable({ heatmapData }: { heatmapData: HeatmapDataPoint[] }) { // Sort by automation_readiness descending const sortedData = [...heatmapData].sort((a, b) => b.automation_readiness - a.automation_readiness); const getReadinessColor = (score: number) => { if (score >= 70) return 'bg-emerald-100 text-emerald-700'; if (score >= 50) return 'bg-[#6D84E3]/20 text-[#6D84E3]'; if (score >= 30) return 'bg-amber-100 text-amber-700'; return 'bg-red-100 text-red-700'; }; const getCategoryLabel = (category?: string) => { switch (category) { case 'automate_now': return 'Automatizar'; case 'assist_copilot': return 'Copilot'; case 'optimize_first': return 'Optimizar'; default: return 'Evaluar'; } }; const getRecommendation = (dataPoint: HeatmapDataPoint): string => { const score = dataPoint.automation_readiness; if (score >= 70) return 'Implementar agente autónomo con supervisión mínima'; if (score >= 50) return 'Desplegar copilot con escalado humano'; if (score >= 30) return 'Reducir variabilidad antes de automatizar'; return 'Optimizar procesos y reducir transferencias'; }; return (

Análisis por Skill

{sortedData.map((item) => ( ))}
Skill Volumen AHT CV AHT Transfer Score Categoría Siguiente Paso
{item.skill} {item.volume.toLocaleString()} {item.aht_seconds}s 50 ? 'text-amber-600' : 'text-slate-600'}> {item.variability.cv_aht.toFixed(0)}% 20 ? 'text-red-600' : 'text-slate-600'}> {item.variability.transfer_rate.toFixed(0)}% {(item.automation_readiness / 10).toFixed(1)} {getCategoryLabel(item.readiness_category)}
{getRecommendation(item)}
); } export function AgenticReadinessTab({ data }: AgenticReadinessTabProps) { // Get agentic readiness dimension or use fallback const agenticDimension = data.dimensions.find(d => d.name === 'agentic_readiness'); const globalScore = data.agenticReadiness?.score || agenticDimension?.score || 0; const subFactors = data.agenticReadiness?.sub_factors || agenticDimension?.sub_factors || []; const confidence = data.agenticReadiness?.confidence; // Convert heatmap data to treemap format const treemapData: TreemapData[] = data.heatmapData.map(item => ({ name: item.skill, value: item.annual_cost || item.volume * item.aht_seconds * 0.005, // Use annual cost or estimate category: item.readiness_category || ( item.automation_readiness >= 70 ? 'automate_now' : item.automation_readiness >= 50 ? 'assist_copilot' : 'optimize_first' ) as ReadinessCategory, skill: item.skill, score: item.automation_readiness / 10, volume: item.volume })); return (
{/* Top Row: Score Gauge + Sub-factors */}
{/* Treemap */} {/* Skills Table */}
); } export default AgenticReadinessTab;