codex/broker-dashboard-redesign #49

Merged
ksv741 merged 19 commits from codex/broker-dashboard-redesign into main 2026-06-27 16:55:04 +03:00
2 changed files with 15 additions and 9 deletions
Showing only changes of commit 94f8bb876d - Show all commits

View File

@ -362,7 +362,7 @@ describe('BrokerDashboard', () => {
const [amount] = screen.getAllByTestId('dashboard-events-amount')
expect(amount.getAttribute('data-tone')).toBe('negative')
expect(amount.textContent).toContain('-87,00')
expect(amount.textContent).toBe('87,00 ')
})
it('renders events and income amounts with the ₽ symbol and no "RUB" code', () => {

View File

@ -98,6 +98,19 @@ function eventMoneyTone(event: BrokerEventItem): MoneyTone {
return moneyTone(eventAmountValue(event), event.source)
}
function eventAmountDisplay(event: BrokerEventItem): string {
const amount = eventAmountValue(event)
if (amount === null || amount === undefined) return '—'
const abs = formatDashboardCurrency({
currency: event.currency ?? 'RUB',
value: Math.abs(amount),
})
if (event.source === 'forecast') return `~${abs}`
if (amount > 0) return `+${abs}`
if (amount < 0) return `${abs}`
return abs
}
export function BrokerDashboardEventsCard({
accountId,
data,
@ -195,14 +208,7 @@ export function BrokerDashboardEventsCard({
ticker: event.ticker,
name: event.name,
})
const amount = eventAmountValue(event)
const formattedAmount =
amount === null || amount === undefined
? '—'
: `${event.source === 'actual' ? '+' : '~'}${formatDashboardCurrency({
currency: event.currency ?? 'RUB',
value: amount,
})}`
const formattedAmount = eventAmountDisplay(event)
return (
<Box component="tr" key={event.id} data-testid="dashboard-events-row">
<Box component="td" sx={TD_SX_LEFT}>