import { Brain, Landmark, Eye, EyeOff, Copy, Check, } from 'lucide-react' import type { AIModel, Exchange } from '../../types' import type { Language } from '../../i18n/translations' import { t } from '../../i18n/translations' import { getModelIcon } from '../common/ModelIcons' import { getExchangeIcon } from '../common/ExchangeIcons' import { getShortName, AI_PROVIDER_CONFIG, truncateAddress, } from './model-constants' interface UsageInfo { runningCount: number totalCount: number } interface ConfigStatusGridProps { configuredModels: AIModel[] configuredExchanges: Exchange[] visibleExchangeAddresses: Set copiedId: string | null language: Language isModelInUse: (modelId: string) => boolean | undefined getModelUsageInfo: (modelId: string) => UsageInfo isExchangeInUse: (exchangeId: string) => boolean | undefined getExchangeUsageInfo: (exchangeId: string) => UsageInfo onModelClick: (modelId: string) => void onExchangeClick: (exchangeId: string) => void onToggleExchangeAddress: (exchangeId: string) => void onCopyAddress: (id: string, address: string) => void } export function ConfigStatusGrid({ configuredModels, configuredExchanges, visibleExchangeAddresses, copiedId, language, isModelInUse, getModelUsageInfo, isExchangeInUse, getExchangeUsageInfo, onModelClick, onExchangeClick, onToggleExchangeAddress, onCopyAddress, }: ConfigStatusGridProps) { return (
{/* AI Models Card */}

{t('aiModels', language)}

{configuredModels.map((model) => { const inUse = isModelInUse(model.id) const usageInfo = getModelUsageInfo(model.id) return (
onModelClick(model.id)} >
{getModelIcon(model.provider || model.id, { width: 20, height: 20 }) || ( {getShortName(model.name)[0]} )}
{getShortName(model.name)}
{model.customModelName || AI_PROVIDER_CONFIG[model.provider]?.defaultModel || ''}
{model.provider === 'claw402' && (model.balanceUsdc || model.walletAddress) ? (
{model.balanceUsdc ? ( {model.balanceUsdc} USDC ) : null} {model.walletAddress ? ( {truncateAddress(model.walletAddress)} ) : null}
) : null}
{usageInfo.totalCount > 0 ? ( 0 ? 'bg-green-500/10 border-green-500/30 text-green-400' : 'bg-yellow-500/10 border-yellow-500/30 text-yellow-400' }`}> {usageInfo.runningCount}/{usageInfo.totalCount} ACTIVE ) : ( {language === 'zh' ? '就绪' : 'STANDBY'} )}
) })} {configuredModels.length === 0 && (
{t('noModelsConfigured', language)}
)}
{/* Exchanges Card */}

{t('exchanges', language)}

{configuredExchanges.map((exchange) => { const inUse = isExchangeInUse(exchange.id) const usageInfo = getExchangeUsageInfo(exchange.id) return (
onExchangeClick(exchange.id)} >
{getExchangeIcon(exchange.exchange_type || exchange.id, { width: 20, height: 20 })}
{exchange.exchange_type?.toUpperCase() || getShortName(exchange.name)} {exchange.account_name || 'DEFAULT'}
{exchange.type?.toUpperCase() || 'CEX'}
{/* Wallet Address Display Logic */} {(() => { const walletAddr = exchange.hyperliquidWalletAddr || exchange.asterUser || exchange.lighterWalletAddr if (exchange.type !== 'dex' || !walletAddr) return null const isVisible = visibleExchangeAddresses.has(exchange.id) const isCopied = copiedId === `exchange-${exchange.id}` return (
e.stopPropagation()}> {isVisible ? walletAddr : truncateAddress(walletAddr)}
) })()} {usageInfo.totalCount > 0 ? ( 0 ? 'bg-green-500/10 border-green-500/30 text-green-400' : 'bg-yellow-500/10 border-yellow-500/30 text-yellow-400' }`}> {usageInfo.runningCount}/{usageInfo.totalCount} ACTIVE ) : ( {language === 'zh' ? '就绪' : 'STANDBY'} )}
) })} {configuredExchanges.length === 0 && (
{t('noExchangesConfigured', language)}
)}
) }