Sergey Krylov 2af2ff32c1
Some checks failed
CI / ci (pull_request) Failing after 12m13s
CI / ci (push) Failing after 11m35s
feat: finalize table-migration — fix DataTable types, remove legacy helpers, update docs
2026-06-24 15:24:56 +03:00

48 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { DataTable, Text } from '@moex-vibe/design-system'
import { Box } from '@mui/material'
import { createColumnHelper, getCoreRowModel, useReactTable } from '@tanstack/react-table'
import type { DividendItem } from '@/shared/api'
interface DividendsTableProps {
dividends: DividendItem[]
}
const columnHelper = createColumnHelper<DividendItem>()
const columns = [
columnHelper.accessor('registryCloseDate', {
header: 'Дата закрытия реестра',
cell: (info) => info.getValue(),
}),
columnHelper.accessor('value', {
header: 'Сумма',
meta: { align: 'right' },
cell: (info) => `${info.getValue().toFixed(2)} ${info.row.original.currency}`,
}),
]
export function DividendsTable({ dividends }: DividendsTableProps) {
const table = useReactTable({
data: dividends,
columns,
getCoreRowModel: getCoreRowModel(),
})
return (
<Box
sx={{
background: 'var(--color-surface)',
borderRadius: 'var(--border-radius)',
boxShadow: 'var(--shadow)',
padding: 3,
}}
>
<DataTable
table={table}
caption="Дивиденды"
empty={<Text tone="secondary">Нет дивидендов</Text>}
/>
</Box>
)
}