interface EnvironmentGaugeProps { label: string; value: number; unit: string; target: number; min: number; max: number; compact?: boolean; } export default function EnvironmentGauge({ label, value, unit, target, min, max, compact = false, }: EnvironmentGaugeProps) { const isLow = value < min; const isHigh = value > max; const isOptimal = value >= min && value <= max; const statusColor = isOptimal ? 'text-green-600' : isLow || isHigh ? 'text-red-600' : 'text-yellow-600'; const bgColor = isOptimal ? 'bg-green-100' : isLow || isHigh ? 'bg-red-100' : 'bg-yellow-100'; if (compact) { return (

{label}

{typeof value === 'number' ? value.toFixed(0) : value} {unit && {unit}}

); } const deviation = value - target; const deviationPercent = ((value - min) / (max - min)) * 100; return (
{label} {value.toFixed(1)}{unit}
{min}{unit} Target: {target}{unit} {max}{unit}
{deviation !== 0 && (

{deviation > 0 ? '+' : ''}{deviation.toFixed(1)}{unit} from target

)}
); }