import { useParams } from 'react-router-dom'; import { useStock, useStockCandles, useStockDividends } from '../entities/stock'; import { StockDetails } from '../components/StockDetails'; import { PriceChart } from '../components/PriceChart'; export function StockPage() { const { secid } = useParams<{ secid: string }>(); const { data: stock, isLoading, error } = useStock(secid!); const till = new Date().toISOString().split('T')[0]; const from = new Date(Date.now() - 365 * 24 * 60 * 60 * 1000).toISOString().split('T')[0]; const { data: candles } = useStockCandles(secid!, '24h', from, till); const { data: dividends } = useStockDividends(secid!); if (isLoading) return
Загрузка...
; if (error || !stock) return
Инструмент не найден
; return (

График цены

{dividends && dividends.length > 0 && (

Дивиденды

{dividends.map((d, i) => ( ))}
Дата закрытия реестра Сумма
{d.registryCloseDate} {d.value.toFixed(2)} {d.currency}
)}
); }