import { Position } from '../types'; import { cn } from '../lib/utils'; interface PositionsTableProps { positions: Position[]; priceFlash: { [key: string]: 'up' | 'down' | null }; className?: string; } export const PositionsTable = ({ positions, priceFlash, className }: PositionsTableProps) => { return (

Active Positions

{positions.map((position) => { const isPositive = position.pnlDollars >= 0; const flashClass = priceFlash[position.id] === 'up' ? 'animate-flash-green' : priceFlash[position.id] === 'down' ? 'animate-flash-red' : ''; return ( ); })}
Symbol Type Leverage Entry Price Mark Price P&L ($) P&L (%) Size
{position.symbol} {position.type} {position.leverage} ${position.entryPrice.toLocaleString()} ${position.markPrice.toLocaleString()} {isPositive ? '+' : ''}${position.pnlDollars.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 })} {isPositive ? '+' : ''}{position.pnlPercent.toFixed(2)}% {position.size}
); };