import { NavLink, Outlet, useOutletContext, useParams } from 'react-router-dom'; import { Box } from '@mui/material'; import { Heading } from '@moex-vibe/design-system'; import { useBrokerPortfolio } from '@/entities/broker-account'; export type BrokerAccountContext = { accountId: string; portfolio: ReturnType; }; export function useBrokerAccountContext() { return useOutletContext(); } const links = [ { to: '', label: 'Обзор', end: true }, { to: '/shares', label: 'Акции' }, { to: '/bonds', label: 'Облигации' }, { to: '/operations', label: 'Операции' }, ]; export function BrokerAccountLayout() { const { accountId = '' } = useParams(); const portfolio = useBrokerPortfolio(accountId); const basePath = `/broker/${encodeURIComponent(accountId)}`; const context: BrokerAccountContext = { accountId, portfolio }; return ( {portfolio.data?.account.name || 'Брокерский счёт'} {links.map((link) => ( {link.label} ))} ); }