import { ExecutiveKPICard, DonutWidget, RegionalMatrix, RankingOverviewPro, MasterPortfolioTable, TreemapWidget, PerformerWidget } from './VisualWidgets'; import { BarChart, Bar, AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, Cell } from 'recharts'; interface WidgetFactoryProps { analysis: any; theme: any; } const CHART_COLORS = ['#3B82F6', '#10B981', '#F59E0B', '#8B5CF6', '#EF4444', '#06B6D4']; export const WidgetFactory: React.FC = ({ analysis, theme }) => { const { chart_type, widget_size, title, data } = analysis; // CSS class for widget size const getSizeClass = () => { switch (widget_size) { case 'small': return 'col-span-12 sm:col-span-6 lg:col-span-3 h-32'; case 'medium': return 'col-span-12 sm:col-span-6 lg:col-span-4 h-80'; case 'large': return 'col-span-12 lg:col-span-8 h-80'; case 'full': return 'col-span-12 h-[32rem]'; default: return 'col-span-12 sm:col-span-6 lg:col-span-4 h-64'; } }; const renderWidget = () => { if (!data || data.length === 0) { return (
No data for {title}
); } switch (chart_type) { case 'executive_kpi': case 'kpi': return ; case 'donut': case 'donut_group': return ; case 'ranking': case 'ranking_pro': return ; case 'matrix': return ; case 'master_table': return ; case 'performer': return ; case 'treemap': return ; case 'bar': return (

{title}

{data.map((_: any, i: number) => ( ))}
); case 'line': case 'area': return (

{title}

); default: return (
Widget: {chart_type}
); } }; return (
{renderWidget()}
); };