import React, { memo } from 'react'; import { cn } from '../../lib/utils'; interface ResourceBarProps { label: string; value: number; className?: string; } export const ResourceBar = memo(function ResourceBar({ label, value, className }: ResourceBarProps) { const clamped = Math.max(0, Math.min(100, value)); return (
{label}
85 ? 'bg-destructive/70' : 'bg-primary/70', )} style={{ width: `${clamped}%` }} />
{Number.isFinite(value) ? `${value.toFixed(1)}%` : '--'}
); });