import { CheckCircle, Mail, Diamond, Gem, Circle } 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.find(m => m.name === 'gemini-3-pro-high');
const geminiFlashModel = account.quota?.models.find(m => m.name === 'gemini-3-flash');
const claudeModel = account.quota?.models.find(m => m.name === 'claude-sonnet-4-5-thinking');
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
);
}
})()}
{/* Gemini Pro 配额 */}
{geminiProModel && (
Gemini 3 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 Flash 配额 */}
{geminiFlashModel && (
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 && (
Claude 4.5
{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;