diff --git a/apps/trading-e2e/src/integration/trading-deal-ticket-order.cy.ts b/apps/trading-e2e/src/integration/trading-deal-ticket-order.cy.ts index fe82aee3e..d2bd1c0d6 100644 --- a/apps/trading-e2e/src/integration/trading-deal-ticket-order.cy.ts +++ b/apps/trading-e2e/src/integration/trading-deal-ticket-order.cy.ts @@ -24,6 +24,9 @@ describe('deal ticker order validation', { tags: '@smoke' }, () => { beforeEach(() => { cy.mockTradingPage(); + cy.getByTestId('deal-ticket-fee-margin-required').within(() => { + cy.get('button').click(); + }); }); describe('limit order', () => { diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-fee-details.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-fee-details.tsx index 182ab55fa..16c20a96a 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-fee-details.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-fee-details.tsx @@ -12,6 +12,8 @@ import { formatRange, formatValue } from '@vegaprotocol/utils'; import { marketMarginDataProvider } from '@vegaprotocol/accounts'; import { useDataProvider } from '@vegaprotocol/data-provider'; +import * as Accordion from '@radix-ui/react-accordion'; + import { MARGIN_DIFF_TOOLTIP_TEXT, DEDUCTION_FROM_COLLATERAL_TOOLTIP_TEXT, @@ -22,6 +24,7 @@ import { } from '../../constants'; import { useEstimateFees } from '../../hooks'; import { KeyValue } from './key-value'; +import { TOOLTIP_TRIGGER_CLASS_NAME } from '@vegaprotocol/ui-toolkit'; const emptyValue = '-'; @@ -244,55 +247,72 @@ export const DealTicketMarginDetails = ({ return ( <> - - - {deductionFromCollateral} - setBreakdownDialog(true) : undefined - } - value={formatValue(marginAccountBalance, assetDecimals)} - symbol={assetSymbol} - labelDescription={MARGIN_ACCOUNT_TOOLTIP_TEXT} - formattedValue={formatValue( - marginAccountBalance, - assetDecimals, - quantum - )} - /> + + + + {t('Margin required')} + + } + value={formatRange( + marginRequiredBestCase, + marginRequiredWorstCase, + assetDecimals + )} + formattedValue={formatRange( + marginRequiredBestCase, + marginRequiredWorstCase, + assetDecimals, + quantum + )} + labelDescription={MARGIN_DIFF_TOOLTIP_TEXT(assetSymbol)} + symbol={assetSymbol} + /> + + + {deductionFromCollateral} + setBreakdownDialog(true) + : undefined + } + value={formatValue(marginAccountBalance, assetDecimals)} + symbol={assetSymbol} + labelDescription={MARGIN_ACCOUNT_TOOLTIP_TEXT} + formattedValue={formatValue( + marginAccountBalance, + assetDecimals, + quantum + )} + /> + + + {projectedMargin} - + {children} {description && (