import type { StockSentimentInsights } from '@/lib/actions/adanos.helpers'; interface StockSentimentCardProps { insight: StockSentimentInsights | null; } function formatScore(value: number | null, suffix: string): string { if (value === null) return 'N/A'; return `${value.toFixed(1)}${suffix}`; } function formatCompactNumber(value: number): string { return new Intl.NumberFormat('en-US', { notation: 'compact', maximumFractionDigits: 1, }).format(value); } function getTrendClasses(trend: string | null): string { if (trend === 'rising') return 'text-emerald-400'; if (trend === 'falling') return 'text-rose-400'; if (trend === 'stable') return 'text-amber-300'; return 'text-gray-400'; } function getAlignmentClasses(alignment: string): string { if (alignment === 'Bullish alignment') return 'text-emerald-400'; if (alignment === 'Bearish alignment' || alignment === 'Wide divergence') return 'text-rose-400'; if (alignment === 'Tight alignment') return 'text-blue-300'; if (alignment === 'Mixed') return 'text-amber-300'; if (alignment === 'Single-source view') return 'text-slate-300'; if (alignment === 'No sentiment mix') return 'text-zinc-400'; return 'text-gray-300'; } export default function StockSentimentCard({ insight }: StockSentimentCardProps) { if (!insight) { return null; } return (

Sentiment Insights

{insight.symbol} across social and public channels

{insight.companyName ? (

{insight.companyName}

) : null}

Structured sentiment snapshot across Reddit, X.com, news, and Polymarket.

Avg. Buzz

{formatScore(insight.averageBuzz, '/100')}

Bullish Avg

{formatScore(insight.bullishAverage, '%')}

Source Alignment

{insight.sourceAlignment}

Coverage

{insight.availableSources}/4

{insight.sources.map((source) => (

{source.label}

{source.trend ?? 'No trend'}

Buzz

{formatScore(source.buzzScore, '/100')}

Bullish

{formatScore(source.bullishPct, '%')}

{source.metricLabel}

{formatCompactNumber(source.metricValue)}

Trend

{source.trend ?? 'N/A'}

))}
); }