import { useTranslation } from 'react-i18next'; import { clampQuotaPercentage, getQuotaStatus, type QuotaStatus } from '@/utils/quota-display'; interface AccountsHeaderProps { totalAccounts: number; activeAccounts: number; rateLimitedAccounts: number; overallQuotaPercentage: number | null; overallQuotaStatus: QuotaStatus | null; } const GLOBAL_QUOTA_BAR_COLOR_CLASS_BY_STATUS: Record = { high: 'bg-emerald-500', medium: 'bg-amber-500', low: 'bg-rose-500', }; const GLOBAL_QUOTA_TEXT_COLOR_CLASS_BY_STATUS: Record = { high: 'text-emerald-400', medium: 'text-amber-400', low: 'text-rose-400', }; export function AccountsHeader({ totalAccounts, activeAccounts, rateLimitedAccounts, overallQuotaPercentage, overallQuotaStatus, }: AccountsHeaderProps) { const { t } = useTranslation(); const quotaStatus = overallQuotaStatus ?? (overallQuotaPercentage === null ? null : getQuotaStatus(overallQuotaPercentage)); return (
{/* Title Area */}

{t('cloud.title')}

{t('cloud.description')}

{/* Stats Row */}
{/* Total & Active combined stat */}
{totalAccounts} {activeAccounts} active
{t('cloud.card.actions')}
{/* Rate Limited stat (only if > 0) */} {rateLimitedAccounts > 0 && (
{rateLimitedAccounts} {t('cloud.card.rateLimited')}
)} {/* Global Quota */} {overallQuotaPercentage !== null && quotaStatus && (
{overallQuotaPercentage}%
{t('cloud.globalQuota')}
)}
); }