import { motion } from 'framer-motion'; import { ChevronRight, TrendingUp, TrendingDown, Minus } from 'lucide-react'; import type { AnalysisData, DimensionAnalysis, Finding, Recommendation } from '../../types'; interface DimensionAnalysisTabProps { data: AnalysisData; } // Dimension Card Component function DimensionCard({ dimension, findings, recommendations, delay = 0 }: { dimension: DimensionAnalysis; findings: Finding[]; recommendations: Recommendation[]; delay?: number; }) { const Icon = dimension.icon; const getScoreColor = (score: number) => { if (score >= 80) return 'text-emerald-600 bg-emerald-100'; if (score >= 60) return 'text-amber-600 bg-amber-100'; return 'text-red-600 bg-red-100'; }; const getScoreLabel = (score: number) => { if (score >= 80) return 'Óptimo'; if (score >= 60) return 'Aceptable'; if (score >= 40) return 'Mejorable'; return 'Crítico'; }; // Get KPI trend icon const TrendIcon = dimension.kpi.changeType === 'positive' ? TrendingUp : dimension.kpi.changeType === 'negative' ? TrendingDown : Minus; const trendColor = dimension.kpi.changeType === 'positive' ? 'text-emerald-600' : dimension.kpi.changeType === 'negative' ? 'text-red-600' : 'text-slate-500'; return ( {/* Header */}

{dimension.title}

{dimension.summary}

{dimension.score} {getScoreLabel(dimension.score)}
{/* KPI Highlight */}
{dimension.kpi.label}
{dimension.kpi.value} {dimension.kpi.change && (
{dimension.kpi.change}
)}
{dimension.percentile && (
Percentil P{dimension.percentile}
)}
{/* Findings */}

Hallazgos Clave

    {findings.slice(0, 3).map((finding, idx) => (
  • {finding.text}
  • ))} {findings.length === 0 && (
  • Sin hallazgos destacados
  • )}
{/* Recommendations Preview */} {recommendations.length > 0 && (
Recomendación: {recommendations[0].text}
)} ); } // Benchmark Comparison Table function BenchmarkTable({ benchmarkData }: { benchmarkData: AnalysisData['benchmarkData'] }) { const getPercentileColor = (percentile: number) => { if (percentile >= 75) return 'text-emerald-600'; if (percentile >= 50) return 'text-amber-600'; return 'text-red-600'; }; return (

Benchmark vs Industria

{benchmarkData.map((item) => ( ))}
KPI Actual Industria Percentil
{item.kpi} {item.userDisplay} {item.industryDisplay} P{item.percentile}
); } export function DimensionAnalysisTab({ data }: DimensionAnalysisTabProps) { // Filter out agentic_readiness (has its own tab) const coreDimensions = data.dimensions.filter(d => d.name !== 'agentic_readiness'); // Group findings and recommendations by dimension const getFindingsForDimension = (dimensionId: string) => data.findings.filter(f => f.dimensionId === dimensionId); const getRecommendationsForDimension = (dimensionId: string) => data.recommendations.filter(r => r.dimensionId === dimensionId); return (
{/* Dimensions Grid */}
{coreDimensions.map((dimension, idx) => ( ))}
{/* Benchmark Table */}
); } export default DimensionAnalysisTab;