import { useTranslation } from 'react-i18next'; import { Card, CardContent } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; import { Button } from '@/components/ui/button'; import { Trash2, Pencil, Key, CheckCircle2, XCircle, Loader2, MapPin, Wallet, CloudDownload, } from 'lucide-react'; import { CloudBrandIcon, getProviderColor } from '@/components/icons/CloudBrandIcon'; import type { JsonData } from '@/types/common'; import type { ActionLoading } from './types'; export interface AccountCardProps { account: JsonData; providerLabels: Record; actionLoading: ActionLoading; onEdit: (account: JsonData) => void; onDelete: (id: string) => void; onDetail: (account: JsonData) => void; onSyncRegions: (account: JsonData) => void; onSyncBilling: (account: JsonData) => void; onImport: (account: JsonData) => void; } export function AccountCard({ account, providerLabels, actionLoading, onEdit, onDelete, onDetail, onSyncRegions, onSyncBilling, onImport, }: AccountCardProps) { const { t } = useTranslation(); const accountIdStr = String(account.id); const accessKey = account.access_key || account.accessKey || ''; const serverCount = account.server_count ?? account.serverCount ?? 0; const lastSync = account.last_sync || account.lastSync || account.created_at || '-'; const monthlyCost = account.monthly_cost ?? account.monthlyCost ?? 0; return (

{providerLabels[account.provider] || account.provider}

{accessKey && ( {accessKey.slice(0, 8)}... )} {account.status === 'active' && ( {t('cloud.normal')} )} {account.status === 'inactive' && ( {t('cloud.stopped')} )} {account.status === 'error' && ( {t('cloud.error')} )}

{t('cloud.monthlyFee')}

¥{Number(monthlyCost).toLocaleString()}

{t('cloud.serverCount')}

{serverCount}

{t('cloud.syncTime')}

{lastSync !== '-' ? new Date(lastSync).toLocaleString() : '-'}

); }