import styles from '../styles/platform.module.css'; interface Props { used: number; limit: number; label: string; } function barColor(pct: number): string { if (pct >= 100) return 'var(--error)'; if (pct >= 75) return 'var(--warning)'; return 'var(--success)'; } export function UsageIndicator({ used, limit, label }: Props) { const unlimited = limit < 0; const pct = unlimited ? 0 : limit === 0 ? 100 : Math.min((used / limit) * 100, 100); return (
{label} = 100 ? { color: 'var(--error)', fontWeight: 600 } : undefined}> {used.toLocaleString()}{' / '}{unlimited ? '\u221e' : limit.toLocaleString()}
{!unlimited && (
)}
); }