(panel, 'limit', first.limit)
const state = readNewsState({ symbol, limit })
return (
)
}
function Body({ panel, symbol, limit }: { panel: PanelRef; symbol: string; limit: number }): ReactElement {
const bridge = useBridge()
const news = useData('fmp/news', { endpoint: 'search-stock-news', symbols: [symbol], limit })
const rows = rowsOf(news)
usePublish(panel, newsOutput(symbol, news.data))
return (
{rows.map((row, index) => (
- void bridge.openLink(url)} />
))}
)
}
function Item({ row, onOpen }: { row: Row; onOpen: (url: string) => void }): ReactElement {
const url = typeof row['url'] === 'string' ? row['url'] : ''
const title = String(row['title'] ?? '')
return (
{String(row['publishedDate'] ?? '').slice(0, 16)}
{String(row['site'] ?? row['publisher'] ?? '')}
{url.startsWith('https://') ? (
) : (
{title}
)}
{typeof row['text'] === 'string' && row['text'] && {row['text']}
}
)
}