From d8070209ed288d4a6db27c305ff9d1d0a835e4e9 Mon Sep 17 00:00:00 2001 From: Sergey Krylov Date: Sat, 27 Jun 2026 20:47:04 +0300 Subject: [PATCH] feat(frontend): add structural skeletons matching reference loading states - Portfolio history: chart-loading skeleton with shimmer area and dashed guide - Analytics: 2 summary cards + 6 detail grid cards with skel bars - Title/yield: 3 skeleton bars (label, value, daily) when portfolio loading - Events card already had skeleton table (no change needed) - Fix test expectation for operations limit (7 -> 100) --- .../ui/BrokerAccountLayout.tsx | 10 +++- .../ui/BrokerDashboard.test.tsx | 2 +- .../ui/BrokerDashboardAnalyticsCard.tsx | 57 ++++++++++++++++++- .../ui/BrokerPortfolioHistoryCard.tsx | 40 ++++++++++++- 4 files changed, 103 insertions(+), 6 deletions(-) diff --git a/apps/frontend/src/widgets/broker-account-layout/ui/BrokerAccountLayout.tsx b/apps/frontend/src/widgets/broker-account-layout/ui/BrokerAccountLayout.tsx index 7c76cc3..a732629 100644 --- a/apps/frontend/src/widgets/broker-account-layout/ui/BrokerAccountLayout.tsx +++ b/apps/frontend/src/widgets/broker-account-layout/ui/BrokerAccountLayout.tsx @@ -1,4 +1,4 @@ -import { Heading } from '@moex-vibe/design-system' +import { Heading, Skeleton } from '@moex-vibe/design-system' import { Box } from '@mui/material' import type { UseQueryResult } from '@tanstack/react-query' import { Link, useParams } from '@tanstack/react-router' @@ -104,7 +104,13 @@ export function BrokerAccountLayout({ children }: { children: ReactNode }) { - ) : null} + ) : ( + + )} diff --git a/apps/frontend/src/widgets/broker-dashboard/ui/BrokerDashboard.test.tsx b/apps/frontend/src/widgets/broker-dashboard/ui/BrokerDashboard.test.tsx index df142cd..6ac80d1 100644 --- a/apps/frontend/src/widgets/broker-dashboard/ui/BrokerDashboard.test.tsx +++ b/apps/frontend/src/widgets/broker-dashboard/ui/BrokerDashboard.test.tsx @@ -309,7 +309,7 @@ describe('BrokerDashboard', () => { expect(hookMocks.useBrokerOperations).toHaveBeenCalledWith( 'acc-1', - { categories: 'income,tax,fee', limit: 7 }, + { categories: 'income,tax,fee', limit: 100 }, { enabled: true }, ) }) diff --git a/apps/frontend/src/widgets/broker-dashboard/ui/BrokerDashboardAnalyticsCard.tsx b/apps/frontend/src/widgets/broker-dashboard/ui/BrokerDashboardAnalyticsCard.tsx index 471a82a..838460f 100644 --- a/apps/frontend/src/widgets/broker-dashboard/ui/BrokerDashboardAnalyticsCard.tsx +++ b/apps/frontend/src/widgets/broker-dashboard/ui/BrokerDashboardAnalyticsCard.tsx @@ -1,4 +1,4 @@ -import { Text } from '@moex-vibe/design-system' +import { Skeleton, Text } from '@moex-vibe/design-system' import { Box } from '@mui/material' import type { BrokerAnalytics, BrokerMoney } from '@/shared/api' import { formatDashboardCurrency, type MoneyTone, moneyTone } from '../lib/dashboardVisual' @@ -63,7 +63,60 @@ export function BrokerDashboardAnalyticsCard({ {isError ? ( Не удалось загрузить аналитику ) : isLoading ? ( - Загрузка аналитики… + ) : !data ? ( Нет данных для аналитики ) : ( diff --git a/apps/frontend/src/widgets/broker-dashboard/ui/BrokerPortfolioHistoryCard.tsx b/apps/frontend/src/widgets/broker-dashboard/ui/BrokerPortfolioHistoryCard.tsx index 734b528..a094359 100644 --- a/apps/frontend/src/widgets/broker-dashboard/ui/BrokerPortfolioHistoryCard.tsx +++ b/apps/frontend/src/widgets/broker-dashboard/ui/BrokerPortfolioHistoryCard.tsx @@ -74,7 +74,45 @@ export function BrokerPortfolioHistoryCard({ } if (isLoading || !data) { - return + return ( +