codex/broker-operations-ui #18

Merged
ksv741 merged 22 commits from codex/broker-operations-ui into main 2026-06-18 06:34:55 +03:00
Showing only changes of commit 2670097a5e - Show all commits

View File

@ -6,6 +6,7 @@ import {
getBrokerOperationTypeLabel, getBrokerOperationTypeLabel,
type BrokerOperationImpact, type BrokerOperationImpact,
} from './brokerDisplay'; } from './brokerDisplay';
import { TableSkeleton } from '../../components/TableSkeleton';
const tableStyle = { const tableStyle = {
width: '100%', width: '100%',
@ -50,18 +51,28 @@ function moneyColor(impact: BrokerOperationImpact): string {
} }
function OperationInstrument({ operation }: { operation: BrokerOperation }) { function OperationInstrument({ operation }: { operation: BrokerOperation }) {
const label = operation.ticker || operation.description || '-'; const ticker = operation.ticker || operation.description || '-';
const path = getBrokerInstrumentPath({ const path = getBrokerInstrumentPath({
ticker: operation.ticker, ticker: operation.ticker,
instrumentType: operation.instrumentType, instrumentType: operation.instrumentType,
classCode: operation.classCode, classCode: operation.classCode,
}); });
const name = operation.name || operation.description;
if (!path || label === '-') { if (!path && !name) return <span>-</span>;
return <span>{label}</span>; if (!path) return <span>{name}</span>;
} if (!ticker || ticker === '-') return <Link to={path}>{name}</Link>;
return <Link to={path}>{label}</Link>; return (
<div style={{ display: 'grid', gap: 2 }}>
<Link to={path} style={{ fontWeight: 700 }}>
{ticker}
</Link>
{name && name !== ticker && (
<span style={{ color: 'var(--color-text-secondary)', fontSize: 12 }}>{name}</span>
)}
</div>
);
} }
const pagButtonStyle = { const pagButtonStyle = {
@ -145,7 +156,30 @@ export function BrokerOperationsTable({
</div> </div>
{isLoading ? ( {isLoading ? (
<p>Загрузка операций...</p> <div style={{ overflowX: 'auto', background: 'var(--color-surface)' }}>
<table style={tableStyle}>
<thead>
<tr>
<th align="left" style={thStyle}>
Дата
</th>
<th align="left" style={thStyle}>
Тип
</th>
<th align="left" style={thStyle}>
Инструмент
</th>
<th align="right" style={thStyle}>
Сумма
</th>
</tr>
</thead>
<TableSkeleton
rows={5}
columns={[{ width: '35%' }, { width: '30%' }, { width: '40%' }, { width: '25%' }]}
/>
</table>
</div>
) : operations.length === 0 ? ( ) : operations.length === 0 ? (
<p style={{ color: 'var(--color-text-secondary)' }}>Операций за выбранный период нет</p> <p style={{ color: 'var(--color-text-secondary)' }}>Операций за выбранный период нет</p>
) : ( ) : (