import { useTranslation } from '@/i18n/TranslationProvider'; interface CapBoost { campaignId: string; name: Record; amount: number; } interface UsageBarProps { used: number; limit: number; label?: string; basePlanLimit?: number; boosts?: CapBoost[]; } export function UsageBar({ used, limit, label, basePlanLimit, boosts }: UsageBarProps) { const { t, locale } = useTranslation(); const displayLabel = label || t('subscription.commands'); const percentage = limit > 0 ? Math.min((used / limit) * 100, 100) : 0; const isNearLimit = percentage >= 80; const isOverLimit = percentage >= 100; const hasBreakdown = basePlanLimit !== undefined && boosts && boosts.length > 0; return (
{displayLabel} {used.toLocaleString()} / {limit.toLocaleString()}

{limit - used > 0 ? t('common.remaining', { count: (limit - used).toLocaleString() }) : t('common.limitReached')}

{hasBreakdown && (
{t('subscription.quotaBase')}: {basePlanLimit.toLocaleString()}
{boosts.map((b) => (
{t('subscription.quotaBoost', { amount: b.amount.toLocaleString(), name: b.name[locale] || b.name.en })}
))}
)}
); }