import Link from 'next/link' import type { RunSummary } from '@/lib/types/run' type Props = { runs: RunSummary[] } function DecisionBadge({ decision }: { decision: string }) { const lower = decision.toLowerCase() if (lower === 'buy') return {decision} if (lower === 'sell') return {decision} if (lower === 'hold') return {decision} return ( {decision} ) } function StatusDot({ decision }: { decision?: string }) { const lower = decision?.toLowerCase() const color = lower === 'buy' ? 'var(--buy)' : lower === 'sell' ? 'var(--sell)' : lower === 'hold' ? 'var(--hold)' : 'var(--text-low)' return (
) } export default function RunHistoryTable({ runs }: Props) { if (runs.length === 0) { return (
{/* Empty state icon */}

No analysis runs yet

Start your first analysis to see results here

New Analysis
) } return (
{/* Table header */}
{['Ticker', 'Date', 'Decision', 'Created', ''].map((h) => (
{h}
))}
{/* Rows */}
{runs.map((run, idx) => (
(e.currentTarget.style.background = 'var(--bg-hover)')} onMouseLeave={(e) => (e.currentTarget.style.background = '')} > {/* Ticker */}
{run.ticker}
{/* Date */}
{run.date}
{/* Decision */}
{run.decision ? ( ) : ( PENDING )}
{/* Created */}
{new Date(run.created_at).toLocaleString()}
{/* Action */}
{ (e.currentTarget as HTMLElement).style.color = 'var(--accent-light)' }} onMouseLeave={(e) => { (e.currentTarget as HTMLElement).style.color = 'var(--accent)' }} > View
))}
{/* Footer */}
{runs.length} RUN{runs.length !== 1 ? 'S' : ''} TOTAL TRADINGAGENTS ยท LOCAL
) }