diff --git a/src/components/quota/AntigravitySection/AntigravityCard.tsx b/src/components/quota/AntigravitySection/AntigravityCard.tsx new file mode 100644 index 0000000..908497c --- /dev/null +++ b/src/components/quota/AntigravitySection/AntigravityCard.tsx @@ -0,0 +1,114 @@ +/** + * Individual Antigravity quota card component. + */ + +import { useTranslation } from 'react-i18next'; +import type { + AntigravityQuotaState, + AuthFileItem, + ResolvedTheme, + ThemeColors +} from '@/types'; +import { TYPE_COLORS, formatQuotaResetTime } from '@/utils/quota'; +import styles from '@/pages/QuotaPage.module.scss'; + +interface AntigravityCardProps { + item: AuthFileItem; + quota?: AntigravityQuotaState; + resolvedTheme: ResolvedTheme; + getQuotaErrorMessage: (status: number | undefined, fallback: string) => string; +} + +export function AntigravityCard({ + item, + quota, + resolvedTheme, + getQuotaErrorMessage +}: AntigravityCardProps) { + const { t } = useTranslation(); + + const displayType = item.type || item.provider || 'antigravity'; + const typeColorSet = TYPE_COLORS[displayType] || TYPE_COLORS.unknown; + const typeColor: ThemeColors = + resolvedTheme === 'dark' && typeColorSet.dark ? typeColorSet.dark : typeColorSet.light; + + const quotaStatus = quota?.status ?? 'idle'; + const quotaGroups = quota?.groups ?? []; + const quotaErrorMessage = getQuotaErrorMessage( + quota?.errorStatus, + quota?.error || t('common.unknown_error') + ); + + const getTypeLabel = (type: string): string => { + const key = `auth_files.filter_${type}`; + const translated = t(key); + if (translated !== key) return translated; + if (type.toLowerCase() === 'iflow') return 'iFlow'; + return type.charAt(0).toUpperCase() + type.slice(1); + }; + + return ( +