diff --git a/apps/trading/client-pages/transfer/transfer.spec.tsx b/apps/trading/client-pages/transfer/transfer.spec.tsx index 3315432a7..61f314fdb 100644 --- a/apps/trading/client-pages/transfer/transfer.spec.tsx +++ b/apps/trading/client-pages/transfer/transfer.spec.tsx @@ -8,7 +8,7 @@ jest.mock('@vegaprotocol/accounts', () => ({ ), })); -jest.mock('../../components/welcome-dialog/get-started.ts', () => ({ +jest.mock('../../components/welcome-dialog/get-started', () => ({ GetStarted: () =>
GetStarted
, })); diff --git a/apps/trading/client-pages/withdraw/withdraw.spec.tsx b/apps/trading/client-pages/withdraw/withdraw.spec.tsx index 8253fcdf7..d427e627c 100644 --- a/apps/trading/client-pages/withdraw/withdraw.spec.tsx +++ b/apps/trading/client-pages/withdraw/withdraw.spec.tsx @@ -8,7 +8,7 @@ jest.mock('../../components/withdraw-container', () => ({ ), })); -jest.mock('../../components/welcome-dialog/get-started.ts', () => ({ +jest.mock('../../components/welcome-dialog/get-started', () => ({ GetStarted: () =>
GetStarted
, })); 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 dd1d6fa83..075d3225f 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 @@ -72,15 +72,11 @@ export const DealTicketFeeDetails = ({ return ( + {t('Fees')} {totalDiscountFactor ? ( - + - {formatNumberPercentage( new BigNumber(totalDiscountFactor).multipliedBy(100), @@ -88,10 +84,16 @@ export const DealTicketFeeDetails = ({ )} ) : null} - {totalDiscountedFeeAmount && - `~${formatValue(totalDiscountedFeeAmount, assetDecimals, quantum)}`} } + value={ + totalDiscountedFeeAmount && + `~${formatValue(totalDiscountedFeeAmount, assetDecimals)}` + } + formattedValue={ + totalDiscountedFeeAmount && + `~${formatValue(totalDiscountedFeeAmount, assetDecimals, quantum)}` + } labelDescription={

diff --git a/libs/deal-ticket/src/components/fees-breakdown/fees-breakdown.tsx b/libs/deal-ticket/src/components/fees-breakdown/fees-breakdown.tsx index c001ffb00..ec9855e4e 100644 --- a/libs/deal-ticket/src/components/fees-breakdown/fees-breakdown.tsx +++ b/libs/deal-ticket/src/components/fees-breakdown/fees-breakdown.tsx @@ -79,7 +79,11 @@ export const FeesBreakdown = ({ volumeDiscountFactor ); - const { volumeDiscount, referralDiscount } = getDiscountedFee( + const { + discountedFee: discountedTotalFeeAmount, + volumeDiscount, + referralDiscount, + } = getDiscountedFee( totalFeeAmount, referralDiscountFactor, volumeDiscountFactor @@ -131,7 +135,7 @@ export const FeesBreakdown = ({ diff --git a/libs/fills/src/lib/fills-table.spec.tsx b/libs/fills/src/lib/fills-table.spec.tsx index dd3b4b78a..8c0d395ab 100644 --- a/libs/fills/src/lib/fills-table.spec.tsx +++ b/libs/fills/src/lib/fills-table.spec.tsx @@ -289,17 +289,30 @@ describe('FeesDiscountBreakdownTooltip', () => { const { container } = render(); const dt = container.querySelectorAll('dt'); const dd = container.querySelectorAll('dd'); - const expected = [ - { label: 'Infrastructure Fee Referral Discount', value: '0.05 BTC' }, - { label: 'Infrastructure Fee Volume Discount', value: '0.06 BTC' }, - { label: 'Liquidity Fee Referral Discount', value: '0.01 BTC' }, - { label: 'Liquidity Fee Volume Discount', value: '0.02 BTC' }, - { label: 'Maker Fee Referral Discount', value: '0.03 BTC' }, - { label: 'Maker Fee Volume Discount', value: '0.04 BTC' }, + const expectedDt = [ + 'Infrastructure Fee', + 'Referral Discount', + 'Volume Discount', + 'Liquidity Fee', + 'Referral Discount', + 'Volume Discount', + 'Maker Fee', + 'Referral Discount', + 'Volume Discount', ]; - expected.forEach(({ label, value }, i) => { + const expectedDD = [ + '0.05 BTC', + '0.06 BTC', + '0.01 BTC', + '0.02 BTC', + '0.03 BTC', + '0.04 BTC', + ]; + expectedDt.forEach((label, i) => { expect(dt[i]).toHaveTextContent(label); - expect(dd[i]).toHaveTextContent(value); + }); + expectedDD.forEach((label, i) => { + expect(dd[i]).toHaveTextContent(label); }); }); }); diff --git a/libs/fills/src/lib/fills-table.tsx b/libs/fills/src/lib/fills-table.tsx index 9c47a057c..718207f4f 100644 --- a/libs/fills/src/lib/fills-table.tsx +++ b/libs/fills/src/lib/fills-table.tsx @@ -391,7 +391,7 @@ const FeesDiscountBreakdownTooltipItem = ({ label: string; asset: ReturnType; }) => - value ? ( + value && value !== '0' ? ( <>

{label}
@@ -418,34 +418,47 @@ export const FeesDiscountBreakdownTooltip = ({ className="max-w-sm bg-vega-light-100 dark:bg-vega-dark-100 border border-vega-light-200 dark:border-vega-dark-200 px-4 py-2 z-20 rounded text-sm break-word text-black dark:text-white" >
+ {(fees.infrastructureFeeReferralDiscount || '0') !== '0' || + (fees.infrastructureFeeVolumeDiscount || '0') !== '0' ? ( +
{t('Infrastructure Fee')}
+ ) : null} + {(fees.liquidityFeeReferralDiscount || '0') !== '0' || + (fees.liquidityFeeVolumeDiscount || '0') !== '0' ? ( +
{t('Liquidity Fee')}
+ ) : null} + + {(fees.makerFeeReferralDiscount || '0') !== '0' || + (fees.makerFeeVolumeDiscount || '0') !== '0' ? ( +
{t('Maker Fee')}
+ ) : null}