'use client' import type { TrumpPost } from '@/types' function fmtPct(n: number | null | undefined) { if (n == null || isNaN(n)) return '—' const s = n.toFixed(2) + '%' return n >= 0 ? '+' + s : s } function timeAgo(iso: string) { const diff = Date.now() - new Date(iso).getTime() const m = Math.floor(diff / 60000) if (m < 1) return 'just now' if (m < 60) return m + 'm' const h = Math.floor(m / 60) if (h < 24) return h + 'h' return Math.floor(h / 24) + 'd' } function SourceIcon({ source }: { source: string }) { if (source === 'x') return
𝕏
return
T
} function SignalPill({ signal }: { signal: string | null }) { if (!signal || signal === 'hold') return HOLD return {signal.toUpperCase()} } interface PostRowProps { post: TrumpPost selected?: boolean onClick?: () => void } export default function PostRow({ post, selected, onClick }: PostRowProps) { const impact = post.price_impact return (
@realDonaldTrump · {timeAgo(post.published_at)} ago · {post.sentiment}

{post.text.slice(0, 180)}{post.text.length > 180 ? '…' : ''}

{impact ? ( <> 1h = 0 ? 'up' : 'down'}`}>{fmtPct(impact.m1h)} ) : ( no data )}
AI {post.ai_confidence}%
) } export { SignalPill, SourceIcon, fmtPct, timeAgo }