From da656330b3317a00dd4c27f859515e2c6d691e74 Mon Sep 17 00:00:00 2001 From: Sergey Krylov Date: Sun, 21 Jun 2026 18:41:53 +0300 Subject: [PATCH] feat: migrate BrokerPositionTable, PositionTicker and TableSkeleton --- apps/frontend/src/shared/ui/TableSkeleton.tsx | 4 +- .../ui/BrokerPositionTable.tsx | 274 +++++++++--------- .../ui/PositionTicker.tsx | 13 +- 3 files changed, 149 insertions(+), 142 deletions(-) diff --git a/apps/frontend/src/shared/ui/TableSkeleton.tsx b/apps/frontend/src/shared/ui/TableSkeleton.tsx index 5190a2e..34e94bd 100644 --- a/apps/frontend/src/shared/ui/TableSkeleton.tsx +++ b/apps/frontend/src/shared/ui/TableSkeleton.tsx @@ -1,4 +1,4 @@ -import { SkeletonBlock } from '@/shared/ui/SkeletonBlock'; +import { Skeleton } from '@moex-vibe/design-system'; const tdStyle = { borderBottom: '1px solid #eeeeee', @@ -15,7 +15,7 @@ export function TableSkeleton({ rows = 5, columns }: { rows?: number; columns: C {columns.map((col, j) => ( - + ))} diff --git a/apps/frontend/src/widgets/broker-positions-table/ui/BrokerPositionTable.tsx b/apps/frontend/src/widgets/broker-positions-table/ui/BrokerPositionTable.tsx index 881c37f..5422d18 100644 --- a/apps/frontend/src/widgets/broker-positions-table/ui/BrokerPositionTable.tsx +++ b/apps/frontend/src/widgets/broker-positions-table/ui/BrokerPositionTable.tsx @@ -1,44 +1,36 @@ import type { BrokerPositionsPage as BrokerPositionsPageData } from '@/shared/api/responses'; -import { TableSkeleton } from '@/shared/ui/TableSkeleton'; +import { Box } from '@mui/material'; +import { Button, Heading, Skeleton, Text } from '@moex-vibe/design-system'; import { formatBrokerMoney as formatMoney } from '@/shared/lib/formatters'; import { PositionTicker } from './PositionTicker'; -const tableStyle = { +const tableSx = { width: '100%', borderCollapse: 'collapse', fontSize: 14, -} satisfies React.CSSProperties; +} as const; -const thStyle = { - borderBottom: '1px solid #e0e0e0', - color: 'var(--color-text-secondary)', +const thSx = { + borderBottom: '1px solid', + borderColor: 'divider', + color: 'text.secondary', fontWeight: 600, - padding: '10px 8px', -} satisfies React.CSSProperties; + p: 1, + textAlign: 'left', +} as const; -const tdStyle = { - borderBottom: '1px solid #eeeeee', - padding: '10px 8px', +const tdSx = { + borderBottom: '1px solid', + borderColor: 'divider', + p: 1, verticalAlign: 'top', -} satisfies React.CSSProperties; + textAlign: 'right', +} as const; -const pagButtonStyle = { - padding: '6px 14px', - borderRadius: 6, - border: '1px solid #e0e0e0', - background: 'var(--color-surface)', - color: 'var(--color-text)', - fontSize: 14, - fontWeight: 600, - cursor: 'pointer', - lineHeight: 1.4, -} satisfies React.CSSProperties; - -const pagButtonDisabledStyle = { - ...pagButtonStyle, - opacity: 0.35, - cursor: 'not-allowed', -} satisfies React.CSSProperties; +const tdSxLeft = { + ...tdSx, + textAlign: 'left', +} as const; function formatQuantity(value: number | null | undefined) { return value == null ? '-' : value.toLocaleString('ru-RU'); @@ -69,127 +61,127 @@ export function BrokerPositionTable({ return (
-
-

+ {title} -

-
- - : '←'} + + {pageNumber} - - -
-
+ {isFetching ? : '→'} + + + {isLoading ? ( -
- - - - - - - - - - - -
+ + + + + Тикер - + + Название - + + Количество - + + Цена - + + Стоимость -
-
+ + + + + {[1, 2, 3, 4].map((row) => ( + + + + + + + + + + + + + + + + + + ))} + + + ) : positions.length === 0 && !isFetching ? ( -

{emptyMessage}

+ + {emptyMessage} + ) : ( -
-
- - - - - - - - - - - + + + + {positions.map((position) => ( - - - - - - - + + ))} - -
+ + + + + + Тикер - + + Название - + + Количество - + + Цена - + + Стоимость -
+ - - - {position.name || '-'} - - + + + {position.name || '-'} + + {formatQuantity(position.quantity)} - + + {formatMoney(position.currentPrice)} - + + {formatMoney(position.currentValue)} -
-
+ + + {isFetching && ( -
-
- + + + Загрузка страницы {pageNumber}… - -
+ + )} -
+ )}
); diff --git a/apps/frontend/src/widgets/broker-positions-table/ui/PositionTicker.tsx b/apps/frontend/src/widgets/broker-positions-table/ui/PositionTicker.tsx index 16a61fe..fbc1f66 100644 --- a/apps/frontend/src/widgets/broker-positions-table/ui/PositionTicker.tsx +++ b/apps/frontend/src/widgets/broker-positions-table/ui/PositionTicker.tsx @@ -1,4 +1,5 @@ import { Link } from 'react-router-dom'; +import { Box } from '@mui/material'; import type { BrokerPosition } from '@/shared/api/responses'; import { getBrokerInstrumentPath } from '@/entities/broker-position'; @@ -11,12 +12,18 @@ export function PositionTicker({ position }: { position: BrokerPosition }) { }); if (!path || label === '-') { - return {label}; + return ( + + {label} + + ); } return ( - - {label} + + + {label} + ); }