From ef97fd7136f578664ea58295fd148d8ccb1a73f4 Mon Sep 17 00:00:00 2001 From: Sergey Krylov Date: Sun, 21 Jun 2026 18:14:49 +0300 Subject: [PATCH] feat: migrate BrokerSummary, BrokerAssetCards and BrokerAccountOverviewPage --- .../ui/BrokerAccountOverviewPage.tsx | 16 +++-- .../broker-overview/ui/BrokerAssetCards.tsx | 42 +++++++---- .../broker-overview/ui/BrokerSummary.tsx | 72 +++++++++++++------ 3 files changed, 91 insertions(+), 39 deletions(-) diff --git a/apps/frontend/src/pages/broker-account/ui/BrokerAccountOverviewPage.tsx b/apps/frontend/src/pages/broker-account/ui/BrokerAccountOverviewPage.tsx index e7b4b79..10cf30a 100644 --- a/apps/frontend/src/pages/broker-account/ui/BrokerAccountOverviewPage.tsx +++ b/apps/frontend/src/pages/broker-account/ui/BrokerAccountOverviewPage.tsx @@ -1,4 +1,6 @@ import { Link } from 'react-router-dom'; +import { Box } from '@mui/material'; +import { Text } from '@moex-vibe/design-system'; import { useBrokerOperations } from '@/entities/broker-operation'; import { useBrokerAccountContext } from '@/widgets/broker-account-layout'; import { BrokerAllocationChart } from '@/widgets/broker-allocation-chart'; @@ -11,16 +13,22 @@ export function BrokerAccountOverviewPage() { if (portfolio.isLoading) return ; if (portfolio.error || !portfolio.data) { - return

Не удалось загрузить сводку счёта

; + return ( + + Не удалось загрузить сводку счёта + + ); } return ( -
+ {operations.error ? ( -

Не удалось загрузить последние операции

+ + Не удалось загрузить последние операции + ) : ( )} -
+ ); } diff --git a/apps/frontend/src/widgets/broker-overview/ui/BrokerAssetCards.tsx b/apps/frontend/src/widgets/broker-overview/ui/BrokerAssetCards.tsx index 662dbe9..5f1dc51 100644 --- a/apps/frontend/src/widgets/broker-overview/ui/BrokerAssetCards.tsx +++ b/apps/frontend/src/widgets/broker-overview/ui/BrokerAssetCards.tsx @@ -1,4 +1,6 @@ import { Link } from 'react-router-dom'; +import { Box } from '@mui/material'; +import { Text } from '@moex-vibe/design-system'; import type { BrokerMoney, BrokerPortfolio } from '@/shared/api/responses'; import { formatBrokerMoney, pluralize } from '@/shared/lib/formatters'; @@ -11,6 +13,16 @@ function formatAllocationPercent(value: number | null) { return value === null ? '\u2014' : `${value.toFixed(1)}%`; } +const cardSx = { + p: 2, + border: '1px solid', + borderColor: 'divider', + borderRadius: 2, + bgcolor: 'surface.default', + display: 'grid', + gap: 1, +}; + export function BrokerAssetCards({ accountId, portfolio, @@ -37,23 +49,23 @@ export function BrokerAssetCards({ ]; return ( -
+ {cards.map((card) => ( - - {card.label} - - {card.count} {card.countLabel} - - {formatBrokerMoney(card.value)} - - {formatAllocationPercent(allocationPercent(card.value, portfolio.totals.portfolio))} - + + + + {card.label} + + + {card.count} {card.countLabel} + + {formatBrokerMoney(card.value)} + + {formatAllocationPercent(allocationPercent(card.value, portfolio.totals.portfolio))} + + ))} -
+ ); } diff --git a/apps/frontend/src/widgets/broker-overview/ui/BrokerSummary.tsx b/apps/frontend/src/widgets/broker-overview/ui/BrokerSummary.tsx index fd7dde4..d87e458 100644 --- a/apps/frontend/src/widgets/broker-overview/ui/BrokerSummary.tsx +++ b/apps/frontend/src/widgets/broker-overview/ui/BrokerSummary.tsx @@ -1,3 +1,5 @@ +import { Box } from '@mui/material'; +import { Text } from '@moex-vibe/design-system'; import type { BrokerPortfolio } from '@/shared/api/responses'; import { formatBrokerMoney as formatMoney, @@ -6,31 +8,61 @@ import { export function BrokerSummary({ portfolio }: { portfolio: BrokerPortfolio }) { return ( -
-
- Стоимость портфеля - + + + + Стоимость портфеля + + {formatMoney(portfolio.totals.portfolio)} - - За день: {formatMoney(portfolio.yields.daily)} - Дневная доходность: {formatPercent(portfolio.yields.dailyPercent)} - Ожидаемая доходность: {formatPercent(portfolio.yields.expectedPercent)} -
-
- Денежный остаток + + За день: {formatMoney(portfolio.yields.daily)} + Дневная доходность: {formatPercent(portfolio.yields.dailyPercent)} + Ожидаемая доходность: {formatPercent(portfolio.yields.expectedPercent)} + + + + Денежный остаток + {portfolio.cash.length === 0 ? ( - Нет денежных остатков + Нет денежных остатков ) : ( -
    + {portfolio.cash.map((money, index) => ( -
  • - {money.currency} - {formatMoney(money)} -
  • + + {money.currency} + + {formatMoney(money)} + + ))} -
+
)} -
-
+ + ); }