import { useState } from 'react' import { PieChart, Pie, Cell, ResponsiveContainer, LineChart, Line, XAxis } from 'recharts' import { Plus, Server, Activity, AlertTriangle, DollarSign, Globe2 } from 'lucide-react' const subTabs = ['Overview'] const statusCards = [ { label: 'Total Resources', value: '128', icon: Server, sub: '+4 this week' }, { label: 'Healthy', value: '124', icon: Activity, sub: '96.9%', color: '#2ECC71' }, { label: 'Warnings', value: '3', icon: AlertTriangle, sub: 'Needs attention', color: '#E67E22' }, { label: 'Critical', value: '1', icon: AlertTriangle, sub: 'Action required', color: '#E74C3C' }, { label: 'Monthly Cost', value: '$24,560.75', icon: DollarSign, sub: '↑ 3.2% MTD' }, ] const distributionData = [ { name: 'Compute', value: 42, color: '#C8A434' }, { name: 'Storage', value: 28, color: '#E67E22' }, { name: 'Database', value: 18, color: '#2ECC71' }, { name: 'Network', value: 12, color: '#7A7D85' }, ] const costData = [ { name: 'Compute', value: 38, color: '#C8A434' }, { name: 'Storage', value: 22, color: '#E67E22' }, { name: 'Database', value: 25, color: '#2ECC71' }, { name: 'Network', value: 15, color: '#7A7D85' }, ] const regions = [ { name: 'us-east-1', x: '22%', y: '38%', resources: 42 }, { name: 'us-west-2', x: '12%', y: '42%', resources: 18 }, { name: 'eu-west-1', x: '48%', y: '30%', resources: 31 }, { name: 'ap-southeast-1', x: '78%', y: '58%', resources: 22 }, { name: 'sa-east-1', x: '32%', y: '72%', resources: 9 }, { name: 'ap-northeast-1', x: '85%', y: '40%', resources: 6 }, ] const topResources = [ { label: 'db-primary-01', percentage: 92 }, { label: 'app-server-03', percentage: 85 }, { label: 'cache-cluster-02', percentage: 78 }, { label: 'web-frontend-lb', percentage: 64 }, { label: 'batch-worker-04', percentage: 51 }, ] const trendData = Array.from({ length: 14 }, (_, i) => ({ day: i, compute: 60 + i * 0.6 + Math.sin(i / 2) * 3, storage: 35 + i * 0.4 + Math.cos(i / 3) * 2, database: 20 + i * 0.2 + Math.sin(i / 4) * 1.5, })) const activities = [ { title: 'Auto-scaling triggered', source: 'App Server Group', time: '4m ago' }, { title: 'Resource provisioned', source: 'db-replica-02', time: '19m ago' }, { title: 'Health check failed', source: 'cache-cluster-02', time: '27m ago' }, { title: 'Tag updated', source: '12 resources', time: '1h ago' }, ] const cardBase: React.CSSProperties = { backgroundColor: 'rgba(10, 10, 12, 0.92)', border: '1px solid rgba(200, 164, 52, 0.08)', borderRadius: '12px', padding: '20px', boxShadow: '0 0 20px rgba(200, 164, 52, 0.03)', transition: 'border-color 0.2s ease', position: 'relative', overflow: 'hidden', height: '100%', display: 'flex', flexDirection: 'column', } const sectionTitle: React.CSSProperties = { fontSize: '11px', textTransform: 'uppercase', letterSpacing: '1.5px', color: '#7A7D85', fontWeight: 500, marginBottom: '16px', } function Donut({ data, centerLabel }: { data: { name: string; value: number; color: string }[]; centerLabel?: string }) { return (
{data.map((entry) => ( ))} {centerLabel && (
{centerLabel}
)}
{data.map((entry) => (
{entry.name} {entry.value}%
))}
) } export default function Infrastructure() { const [activeTab, setActiveTab] = useState('Overview') return ( <> {/* Sub-tabs + Add Resource — hero banner is rendered at the layout level behind this */}
{subTabs.map((tab) => { const active = tab === activeTab return ( ) })}
{/* Status Cards */}
{statusCards.map((card) => { const Icon = card.icon return (

{card.label}

{card.value}

{card.sub}

) })}
{/* Middle Row */}
{/* Resource Distribution */}

Resource Distribution

{/* Infrastructure Map */}

Infrastructure Map

{regions.map((r) => (
))}
{/* Top Resources by Utilization */}

Top Resources by Utilization

{topResources.map((res) => { const color = res.percentage >= 90 ? '#E74C3C' : res.percentage >= 70 ? '#E67E22' : '#C8A434' return (
{res.label} {res.percentage}%
) })}
{/* Bottom Row */}
{/* Resource Trend */}

Resource Trend

{/* Cost Breakdown */}

Cost Breakdown (MTD)

{/* Recent Activity */}

Recent Activity

{activities.map((item, i) => (

{item.title}

{item.source}

{item.time}
))}
{/* Footer stats bar */}
AWS| 6 Regions| 18 AZs| 128 Resources| 98.7% Health| $24,560.75 MTD| 2 Alerts
) }