'use client' import { useTranslations } from 'next-intl' import { useState } from 'react' import { useAccount } from 'wagmi' import { useConnectModal } from '@rainbow-me/rainbowkit' import type { BotPerformance } from '@/types' import { useDashboardStore } from '@/store/dashboard' import { formatPct, formatHold } from '@/lib/utils' const MOCK_PERFORMANCE: BotPerformance = { period_days: 30, total_trades: 89, win_rate: 0.73, net_pnl_usd: 12840, avg_hold_seconds: 14 * 60, max_drawdown_pct: 8.2, } interface BotPanelProps { performance?: BotPerformance } export default function BotPanel({ performance = MOCK_PERFORMANCE }: BotPanelProps) { const t = useTranslations('bot') const { isSubscribed, setSubscribed } = useDashboardStore() const { address, isConnected } = useAccount() const { openConnectModal } = useConnectModal() const [apiKey, setApiKey] = useState('') const stats = [ { label: t('winRate'), value: formatPct(performance.win_rate * 100 - 100 + performance.win_rate * 100), display: `${Math.round(performance.win_rate * 100)}%` }, { label: t('netPnl'), value: `+$${performance.net_pnl_usd.toLocaleString()}`, positive: true }, { label: t('totalTrades'), value: String(performance.total_trades) }, { label: t('avgHold'), value: formatHold(performance.avg_hold_seconds) }, ] return (
{t('title')} ยท {t('period')}
{stat.label}
{stat.display ?? stat.value}
{t('connectCta')}
{t('connectDesc')}
{t('settingsTitle')}
Locked{t('settingsTitle')}
{t('activeStatus')}