import { CheckCircle, Mail, Diamond, Gem, Circle, Tag, Lock } from 'lucide-react';
import { Account } from '../../types/account';
import { formatTimeRemaining } from '../../utils/format';
interface CurrentAccountProps {
account: Account | null;
onSwitch?: () => void;
}
import { useTranslation } from 'react-i18next';
function CurrentAccount({ account, onSwitch }: CurrentAccountProps) {
const { t } = useTranslation();
if (!account) {
return (
{t('dashboard.current_account')}
{t('dashboard.no_active_account')}
);
}
const geminiProModel = account.quota?.models
.filter(m =>
m.name.toLowerCase() === 'gemini-3-pro-high'
|| m.name.toLowerCase() === 'gemini-3-pro-low'
|| m.name.toLowerCase() === 'gemini-3.1-pro-high'
|| m.name.toLowerCase() === 'gemini-3.1-pro-low'
)
.sort((a, b) => (a.percentage || 0) - (b.percentage || 0))[0];
const geminiFlashModel = account.quota?.models.find(m => m.name.toLowerCase() === 'gemini-3-flash');
const geminiImageModel = account.quota?.models.find(m => m.name.toLowerCase() === 'gemini-3-pro-image');
const claudeGroupNames = [
'claude-opus-4-6-thinking',
'claude'
];
const claudeModel = account.quota?.models
.filter(m => claudeGroupNames.includes(m.name.toLowerCase()))
.sort((a, b) => (a.percentage || 0) - (b.percentage || 0))[0];
return (
{t('dashboard.current_account')}
{account.email}
{/* 订阅类型 */}
{account.quota?.subscription_tier && (() => {
const tier = account.quota.subscription_tier.toLowerCase();
if (tier.includes('ultra')) {
return (
ULTRA
);
} else if (tier.includes('pro')) {
return (
PRO
);
} else {
return (
FREE
);
}
})()}
{/* 自定义标签 */}
{account.custom_label && (
{account.custom_label}
)}
{/* Gemini Pro 配额 */}
{geminiProModel && (
{(account.protected_models?.includes('gemini-3-pro-high') || account.protected_models?.includes('gemini-3.1-pro-high')) && }
Gemini 3.1 Pro
{geminiProModel.reset_time ? `R: ${formatTimeRemaining(geminiProModel.reset_time)}` : t('common.unknown')}
= 50 ? 'text-emerald-600 dark:text-emerald-400' :
geminiProModel.percentage >= 20 ? 'text-amber-600 dark:text-amber-400' : 'text-rose-600 dark:text-rose-400'
}`}>
{geminiProModel.percentage}%
= 50 ? 'bg-gradient-to-r from-emerald-400 to-emerald-500' :
geminiProModel.percentage >= 20 ? 'bg-gradient-to-r from-amber-400 to-amber-500' :
'bg-gradient-to-r from-rose-400 to-rose-500'
}`}
style={{ width: `${geminiProModel.percentage}%` }}
>
)}
{/* Gemini 3 Pro Image 配额 */}
{geminiImageModel && (
{account.protected_models?.includes('gemini-3-pro-image') && }
Gemini 3 Pro Image
{geminiImageModel.reset_time ? `R: ${formatTimeRemaining(geminiImageModel.reset_time)}` : t('common.unknown')}
= 50 ? 'text-emerald-600 dark:text-emerald-400' :
geminiImageModel.percentage >= 20 ? 'text-amber-600 dark:text-amber-400' : 'text-rose-600 dark:text-rose-400'
}`}>
{geminiImageModel.percentage}%
= 50 ? 'bg-gradient-to-r from-emerald-400 to-emerald-500' :
geminiImageModel.percentage >= 20 ? 'bg-gradient-to-r from-amber-400 to-amber-500' :
'bg-gradient-to-r from-rose-400 to-rose-500'
}`}
style={{ width: `${geminiImageModel.percentage}%` }}
>
)}
{/* Gemini Flash 配额 */}
{geminiFlashModel && (
{account.protected_models?.includes('gemini-3-flash') && }
Gemini 3 Flash
{geminiFlashModel.reset_time ? `R: ${formatTimeRemaining(geminiFlashModel.reset_time)}` : t('common.unknown')}
= 50 ? 'text-emerald-600 dark:text-emerald-400' :
geminiFlashModel.percentage >= 20 ? 'text-amber-600 dark:text-amber-400' : 'text-rose-600 dark:text-rose-400'
}`}>
{geminiFlashModel.percentage}%
= 50 ? 'bg-gradient-to-r from-emerald-400 to-emerald-500' :
geminiFlashModel.percentage >= 20 ? 'bg-gradient-to-r from-amber-400 to-amber-500' :
'bg-gradient-to-r from-rose-400 to-rose-500'
}`}
style={{ width: `${geminiFlashModel.percentage}%` }}
>
)}
{/* Claude 配额 */}
{claudeModel && (
{account.protected_models?.includes('claude') && }
Claude 系列
{claudeModel.reset_time ? `R: ${formatTimeRemaining(claudeModel.reset_time)}` : t('common.unknown')}
= 50 ? 'text-cyan-600 dark:text-cyan-400' :
claudeModel.percentage >= 20 ? 'text-orange-600 dark:text-orange-400' : 'text-rose-600 dark:text-rose-400'
}`}>
{claudeModel.percentage}%
= 50 ? 'bg-gradient-to-r from-cyan-400 to-cyan-500' :
claudeModel.percentage >= 20 ? 'bg-gradient-to-r from-orange-400 to-orange-500' :
'bg-gradient-to-r from-rose-400 to-rose-500'
}`}
style={{ width: `${claudeModel.percentage}%` }}
>
)}
{onSwitch && (
)}
);
}
export default CurrentAccount;