codex/broker-dashboard-redesign #49
@ -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', () => {
|
||||
|
||||
@ -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}>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user