'use client'; import { YieldPool } from '@/types'; import { SecurityScore } from './SecurityScore'; import { formatNumber, formatPercent } from '@/utils/security'; import { ExternalLink, TrendingUp, Shield, Clock } from 'lucide-react'; import { translations, Locale } from '@/utils/i18n'; interface TopPoolCardProps { pool: YieldPool; rank: number; locale?: Locale; } export function TopPoolCard({ pool, rank, locale = 'en' }: TopPoolCardProps) { const t = translations[locale]; const medals: Record = { 1: '🥇', 2: '🥈', 3: '🥉' }; const glowColors: Record = { 1: 'shadow-[0_0_30px_rgba(250,204,21,0.3)] border-yellow-500/40', 2: 'shadow-[0_0_25px_rgba(156,163,175,0.25)] border-gray-400/40', 3: 'shadow-[0_0_20px_rgba(217,119,6,0.25)] border-amber-600/40', }; const exploitCount = pool.exploits || 0; const years = Math.floor(pool.protocolAge / 365); return (
{medals[rank]}
{pool.protocolLogo ? ( {pool.protocol} { (e.target as HTMLImageElement).style.display = 'none'; (e.target as HTMLImageElement).parentElement!.innerHTML = `${pool.protocol.charAt(0)}`; }} /> ) : ( {pool.protocol.charAt(0)} )}

{pool.protocol} {pool.protocolType && ( {pool.protocolType === 'lending' ? 'Lending' : 'Vault'} )}

{pool.chainLogo && {pool.chain} { (e.target as HTMLImageElement).style.display = 'none'; }} />} {pool.chain} • {pool.stablecoinLogo && {pool.stablecoin} { (e.target as HTMLImageElement).style.display = 'none'; }} />} {pool.stablecoin} {pool.currency}
{t['top.annualYield']}
{formatPercent(pool.apy)} APY
{pool.apyReward > 0 &&
Base: {formatPercent(pool.apyBase)} + Rewards: {formatPercent(pool.apyReward)}
}
{t['top.security']}
TVL
{formatNumber(pool.tvl)}
{pool.audits} {t['top.audits']}
{years > 0 ? `${years}+ ${t['top.years']}` : `${pool.protocolAge} ${t['top.days']}`}
{exploitCount > 0 &&
= 2 ? 'text-red-400' : 'text-yellow-400'}`}>âš  {exploitCount} {exploitCount > 1 ? t['top.exploits'] : t['top.exploit']}
}
{t['top.deposit']}
); } interface TopPoolsProps { pools: YieldPool[]; locale?: Locale; } export function TopPools({ pools, locale = 'en' }: TopPoolsProps) { const t = translations[locale]; if (pools.length === 0) return null; return (

{t['top.title']}

{t['top.subtitle']}

{pools.slice(0, 3).map((pool, index) => ( ))}
); }