import { Button, Chip, Text } from '@moex-vibe/design-system' import { Box } from '@mui/material' import { Link } from '@tanstack/react-router' import type { BrokerOperationsPage } from '@/shared/api' import { formatBrokerCurrencyValue, formatBrokerDate } from '@/shared/lib/formatters' import { getDashboardIncomeRows, sumDashboardIncome } from '../lib/dashboardIncome' import { BrokerDashboardCard } from './BrokerDashboardCard' type BrokerDashboardIncomeCardProps = { accountId: string page: BrokerOperationsPage | undefined isLoading: boolean isError: boolean pageNumber: number canGoBack: boolean canGoForward: boolean onPreviousPage: () => void onNextPage: () => void } export function BrokerDashboardIncomeCard({ accountId, page, isLoading, isError, pageNumber, canGoBack, canGoForward, onPreviousPage, onNextPage, }: BrokerDashboardIncomeCardProps) { const rows = getDashboardIncomeRows(page?.items ?? []).slice(0, 10) const total = sumDashboardIncome(rows) return ( Все операции} > {isError ? ( Не удалось загрузить доходные операции ) : isLoading ? ( Загрузка доходов… ) : rows.length === 0 ? ( Дивидендов и купонов в последних операциях нет ) : ( {rows.map((row) => ( {formatBrokerDate(row.date)} {row.instrument} {row.typeLabel} +{formatBrokerCurrencyValue(row.amount.currency, row.amount.value)} ))} Показано: {rows.length} · Итого:{' '} {total ? formatBrokerCurrencyValue(total.currency, total.value) : '—'} {pageNumber} )} ) }