'use client'; import { cn } from '@/lib/utils.js'; interface GridStressGaugeProps { regionCode: string; regionName: string; demandMw: number; capacityMw: number; className?: string; } function getStressColor(pct: number): string { if (pct >= 90) return '#ef4444'; if (pct >= 80) return '#f97316'; if (pct >= 60) return '#eab308'; return '#22c55e'; } function getStressLabel(pct: number): string { if (pct >= 90) return 'Critical'; if (pct >= 80) return 'High'; if (pct >= 60) return 'Moderate'; return 'Normal'; } export function GridStressGauge({ regionCode, regionName, demandMw, capacityMw, className }: GridStressGaugeProps) { const pct = capacityMw > 0 ? Math.min((demandMw / capacityMw) * 100, 100) : 0; const color = getStressColor(pct); const label = getStressLabel(pct); const radius = 40; const circumference = Math.PI * radius; const offset = circumference - (pct / 100) * circumference; const isCritical = pct >= 85; return (