import { Card, CardContent, Typography, Box, LinearProgress, IconButton, Tooltip, Chip, useTheme, alpha, Grid, Divider, } from '@mui/material' import { TrendingUp as ScaleUpIcon, TrendingDown as ScaleDownIcon, Settings as SettingsIcon, CheckCircle as OnlineIcon, Sync as ScalingIcon, Error as ErrorIcon, } from '@mui/icons-material' import { ResponsiveContainer, AreaChart, Area } from 'recharts' import { PillarStats } from '../../hooks/usePillars' interface PillarCardProps { stats: PillarStats onScale?: (pillar: string, action: 'up' | 'down') => void } const mockChartData = [ { val: 40 }, { val: 30 }, { val: 45 }, { val: 60 }, { val: 55 }, { val: 70 }, { val: 85 } ] export default function PillarCard({ stats, onScale }: PillarCardProps) { const theme = useTheme() const isScaling = stats.is_scaling const hasSuggestion = stats.suggestion && stats.suggestion.action !== 'none' return ( {/* Scaling Animation Overlay */} {isScaling && ( )} {stats.pillar} {stats.active_count} / {stats.node_count} nodes : } label={isScaling ? 'Scaling' : 'Online'} size="small" color={isScaling ? 'primary' : 'success'} variant="outlined" sx={{ fontWeight: 'bold', '@keyframes spin': { '0%': { transform: 'rotate(0deg)' }, '100%': { transform: 'rotate(360deg)' } } }} /> {/* Mini Sparkline */} {/* Metrics Gauges */} CPU Load 80 ? 'error' : 'primary'} /> {stats.metrics?.cpu_usage || 12}% Memory {stats.metrics?.memory_usage || 45}% {/* Suggestion & Actions */} {hasSuggestion ? ( Sug: {stats.suggestion?.action === 'scale_up' ? '+' : '-'}{Math.abs(stats.suggestion!.target_count - stats.node_count)} nodes ) : ( Optimal Performance )} onScale?.(stats.pillar, 'down')} disabled={isScaling || stats.node_count <= 1}> onScale?.(stats.pillar, 'up')} disabled={isScaling}> ) }