"use client"; import { Card } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import type { Strategy } from "@/lib/types"; import { TrendingUp, TrendingDown } from "lucide-react"; interface StrategyCardProps { name: string; strategy?: Strategy; tab: "live" | "paper" | "backtest" | "historical"; onClick: () => void; badge?: string; stats?: { label: string; value: string; negative?: boolean }[]; pnlPct?: number; status?: string; } export function StrategyCard({ name, strategy, tab, onClick, badge, stats, pnlPct, status }: StrategyCardProps) { if (strategy) { const equity = strategy.allocation + (strategy.pnl ?? 0); const isUp = equity >= strategy.allocation; const pnl = strategy.pnl ?? 0; const pnlPctVal = strategy.pnl_pct ?? 0; return (

{name}

${strategy.allocation} · {strategy.type}

{strategy.status?.toUpperCase()} {strategy.fee_model?.toUpperCase()}
{isUp ? : } ${equity.toFixed(2)}
PnL: = 0 ? "text-green-500" : "text-red-500"}>{pnl >= 0 ? "+" : ""}{pnl.toFixed(2)} ({pnlPctVal >= 0 ? "+" : ""}{pnlPctVal.toFixed(2)}%) Trades: {strategy.trades_today ?? 0} Win: {Math.round((strategy.win_rate ?? 0) * 100)}% Pos: {(strategy.position ?? 0).toFixed(4)}
Alloc: ${strategy.allocation} · Max pos: {strategy.max_position ?? "—"} · Stop: {strategy.stop_loss ?? "—"}
); } // Backtest / Historical card return (

{name}

{badge ?? "Backtest"}

{status ?? "BACKTEST"}
= 0 ? "text-green-500" : "text-red-500"}`}> {(pnlPct ?? 0) >= 0 ? : } {(pnlPct ?? 0) >= 0 ? "+" : ""}{(pnlPct ?? 0).toFixed(2)}%
{stats && (
{stats.map((s) => ( {s.label}: {s.value} ))}
)}
); }