diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index d801f3383..862ca35ce 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -3086,9 +3086,6 @@ "message": "You have (1) pending transaction.", "description": "$1 is count of pending transactions" }, - "percentage": { - "message": "$1%" - }, "permissionRequest": { "message": "Permission request" }, @@ -4469,6 +4466,10 @@ "message": "Includes a $1% MetaMask fee.", "description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number." }, + "swapIncludesMetaMaskFeeViewAllQuotes": { + "message": "Includes a $1% MetaMask fee – $2", + "description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number and $2 is a link to view all quotes." + }, "swapLearnMore": { "message": "Learn more about Swaps" }, @@ -5233,6 +5234,9 @@ "viewAllDetails": { "message": "View all details" }, + "viewAllQuotes": { + "message": "view all quotes" + }, "viewContact": { "message": "View contact" }, diff --git a/test/e2e/swaps/shared.js b/test/e2e/swaps/shared.js index 12fbe4ccb..efef3b4b0 100644 --- a/test/e2e/swaps/shared.js +++ b/test/e2e/swaps/shared.js @@ -173,9 +173,7 @@ const checkNotification = async (driver, options) => { }; const changeExchangeRate = async (driver) => { - await driver.clickElement( - '[data-testid="exchange-rate-display-base-symbol"]', - ); + await driver.clickElement('[data-testid="review-quote-view-all-quotes"]'); await driver.waitForSelector({ text: 'Quote details', tag: 'h2' }); const networkFees = await driver.findElements( diff --git a/ui/pages/swaps/exchange-rate-display/__snapshots__/exchange-rate-display.test.js.snap b/ui/pages/swaps/exchange-rate-display/__snapshots__/exchange-rate-display.test.js.snap index 7dc3b1256..bdd3b3dfa 100644 --- a/ui/pages/swaps/exchange-rate-display/__snapshots__/exchange-rate-display.test.js.snap +++ b/ui/pages/swaps/exchange-rate-display/__snapshots__/exchange-rate-display.test.js.snap @@ -6,7 +6,7 @@ exports[`ExchangeRateDisplay renders the component with initial props 1`] = ` class="exchange-rate-display" >
diff --git a/ui/pages/swaps/exchange-rate-display/exchange-rate-display.js b/ui/pages/swaps/exchange-rate-display/exchange-rate-display.js index 413730c28..12a38e12c 100644 --- a/ui/pages/swaps/exchange-rate-display/exchange-rate-display.js +++ b/ui/pages/swaps/exchange-rate-display/exchange-rate-display.js @@ -72,6 +72,13 @@ export default function ExchangeRateDisplay({ rateToDisplay = formatSwapsValueForDisplay(rate); } + const quoteRateClassName = onQuotesClick + ? 'exchange-rate-display__quote-rate' + : 'exchange-rate-display__quote-rate--no-link'; + const quoteRateColor = onQuotesClick + ? TextColor.primaryDefault + : TextColor.textDefault; + return (
1 diff --git a/ui/pages/swaps/exchange-rate-display/index.scss b/ui/pages/swaps/exchange-rate-display/index.scss index 9a397f982..f59713639 100644 --- a/ui/pages/swaps/exchange-rate-display/index.scss +++ b/ui/pages/swaps/exchange-rate-display/index.scss @@ -19,4 +19,8 @@ &__quote-rate { cursor: pointer; } + + &__quote-rate--no-link { + cursor: text; + } } diff --git a/ui/pages/swaps/loading-swaps-quotes/__snapshots__/loading-swaps-quotes-stories-metadata.test.js.snap b/ui/pages/swaps/loading-swaps-quotes/__snapshots__/loading-swaps-quotes-stories-metadata.test.js.snap index 6581c8123..66be56d52 100644 --- a/ui/pages/swaps/loading-swaps-quotes/__snapshots__/loading-swaps-quotes-stories-metadata.test.js.snap +++ b/ui/pages/swaps/loading-swaps-quotes/__snapshots__/loading-swaps-quotes-stories-metadata.test.js.snap @@ -27,4 +27,4 @@ exports[`storiesMetadata matches expected values for storiesMetadata 1`] = ` "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASkAAAB5CAYAAABlYNfBAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAlASURBVHgB7d3/eeO2GcDx1336f3UThNcF4g3KLNA4HaDnywC5Xgeo6Q5Q+zpAz+kCd+0AJyUDxNcFTsoCsbtA3gIVFL0CIRGgKMm2vp/nwWPxF0hT4isABCERAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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5z+rluIn29WAekwH2Zl2JJ1GKKioJaftHJKvC7eOOmtM1642j/ZzKnmi74+Ugv0Ic5T+OSh+jjm0oSeHp0cRzctsEGW0HuLEUyt2/zn/mXXcVKDYcn0/xD39mdc0o3EdRlY8ghSdJ24+vvI2nC/O7iLYvuni13b+q6Vj/uuRCHoKmx3+qZEDhwn4WnYsPGdsQpPD06ObOiFVBPnEpqnTc9FF0LP71KGMbW+3qPUZ45jGmRjzYSQlOC38tmCD1uNFwvtm6DpE3uf2iQmCIq3aNlIlHNWgybrv75X820/7xnr/JbtXmdc445n3Foynwa8E4XtpuB1ItG773Ntr2WgroFo31pSWObWiPBu0t9rWo8q2UFDvWpySFp0nn1aY40ExdeqHrG679NhfaHhDttvTC1XY1ryrYNlUF+6QDBw8dYHC7Hvv0QfEmusBrWX98BCk8XWsC1cJYzY9uhunUaI19AtRFlEfxnbLEheA1MiBN33H7UnZI02NEXWWuS5DC06Ttnui5/HalAcpX82ywu5UedFk1mu7qYtD2iAfZIxQMsN/OmwNKkHrUaDgv4Bqr/W3855LfIDxx6Qu/XY/ny3ypyW8zC+kr6cHt1//xA+t9bfL60aW/yAB0ObidmPx31WDe2r3Mf4B1FtK9rB95wZ5Ln0oHG9wVfxwzkxA5EfQSvrFrmT/Q618vRkvwAcA/VjPhwVcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwJH7H5NlZI/0GQ+cAAAAAElFTkSuQmCC", }, } -`; \ No newline at end of file +`; diff --git a/ui/pages/swaps/main-quote-summary/__snapshots__/main-quote-summary.test.js.snap b/ui/pages/swaps/main-quote-summary/__snapshots__/main-quote-summary.test.js.snap index 7b58f794f..b36e37007 100644 --- a/ui/pages/swaps/main-quote-summary/__snapshots__/main-quote-summary.test.js.snap +++ b/ui/pages/swaps/main-quote-summary/__snapshots__/main-quote-summary.test.js.snap @@ -81,7 +81,7 @@ exports[`MainQuoteSummary renders the component with initial props 4`] = ` class="exchange-rate-display main-quote-summary__exchange-rate-display" >
diff --git a/ui/pages/swaps/prepare-swap-page/prepare-swap-page.js b/ui/pages/swaps/prepare-swap-page/prepare-swap-page.js index f83ad4800..654d2b766 100644 --- a/ui/pages/swaps/prepare-swap-page/prepare-swap-page.js +++ b/ui/pages/swaps/prepare-swap-page/prepare-swap-page.js @@ -586,7 +586,10 @@ export default function PrepareSwapPage({ ); }; - const swapYourTokenBalance = `${t('balance')}: ${fromTokenString || '0'}`; + const yourTokenFromBalance = `${t('balance')}: ${fromTokenString || '0'}`; + const yourTokenToBalance = `${t('balance')}: ${ + selectedToToken?.string || '0' + }`; const isDirectWrappingEnabled = shouldEnableDirectWrapping( chainId, @@ -883,7 +886,7 @@ export default function PrepareSwapPage({ alignItems={AlignItems.stretch} >
- {fromTokenSymbol && swapYourTokenBalance} + {fromTokenSymbol && yourTokenFromBalance} {showMaxBalanceLink && (
+ +
+ {selectedToToken?.string && yourTokenToBalance} +
+
{!showReviewQuote && toTokenIsNotDefault && occurrences < 2 && ( diff --git a/ui/pages/swaps/prepare-swap-page/review-quote.js b/ui/pages/swaps/prepare-swap-page/review-quote.js index a363747b9..3e73d97ce 100644 --- a/ui/pages/swaps/prepare-swap-page/review-quote.js +++ b/ui/pages/swaps/prepare-swap-page/review-quote.js @@ -1047,7 +1047,6 @@ export default function ReviewQuote({ setReceiveToAmount }) { > @@ -1063,39 +1062,11 @@ export default function ReviewQuote({ setReceiveToAmount }) { secondaryTokenValue={destinationValue} secondaryTokenDecimals={destinationTokenDecimals} secondaryTokenSymbol={destinationTokenSymbol} - arrowColor="var(--color-primary-default)" boldSymbols={false} className="main-quote-summary__exchange-rate-display" - onQuotesClick={ - /* istanbul ignore next */ - () => { - trackAllAvailableQuotesOpened(); - setSelectQuotePopoverShown(true); - } - } showIconForSwappingTokens={false} /> - - - {t('swapMetaMaskFee')} - - - {t('percentage', [metaMaskFee])} - - )} + + + {t('swapIncludesMetaMaskFeeViewAllQuotes', [ + metaMaskFee, + { + trackAllAvailableQuotesOpened(); + setSelectQuotePopoverShown(true); + } + } + size={Size.inherit} + > + {t('viewAllQuotes')} + , + ])} + +
{ const { getByText } = renderWithProvider(, store); expect(getByText('New quotes in')).toBeInTheDocument(); expect(getByText('Quote rate')).toBeInTheDocument(); - expect(getByText('MetaMask fee')).toBeInTheDocument(); + expect(getByText('Includes a 1% MetaMask fee –')).toBeInTheDocument(); + expect(getByText('view all quotes')).toBeInTheDocument(); expect(getByText('Estimated gas fee')).toBeInTheDocument(); expect(getByText('0.00008 ETH')).toBeInTheDocument(); expect(getByText('Max fee:')).toBeInTheDocument(); @@ -71,7 +72,8 @@ describe('ReviewQuote', () => { const { getByText } = renderWithProvider(, store); expect(getByText('New quotes in')).toBeInTheDocument(); expect(getByText('Quote rate')).toBeInTheDocument(); - expect(getByText('MetaMask fee')).toBeInTheDocument(); + expect(getByText('Includes a 1% MetaMask fee –')).toBeInTheDocument(); + expect(getByText('view all quotes')).toBeInTheDocument(); expect(getByText('Estimated gas fee')).toBeInTheDocument(); expect(getByText('0.00008 ETH')).toBeInTheDocument(); expect(getByText('Max fee:')).toBeInTheDocument(); @@ -93,7 +95,8 @@ describe('ReviewQuote', () => { const { getByText } = renderWithProvider(, store); expect(getByText('New quotes in')).toBeInTheDocument(); expect(getByText('Quote rate')).toBeInTheDocument(); - expect(getByText('MetaMask fee')).toBeInTheDocument(); + expect(getByText('Includes a 1% MetaMask fee –')).toBeInTheDocument(); + expect(getByText('view all quotes')).toBeInTheDocument(); expect(getByText('Estimated gas fee')).toBeInTheDocument(); expect(getByText('0.00008 ETH')).toBeInTheDocument(); expect(getByText('Max fee:')).toBeInTheDocument(); diff --git a/ui/pages/swaps/view-quote/__snapshots__/view-quote.test.js.snap b/ui/pages/swaps/view-quote/__snapshots__/view-quote.test.js.snap index 9d8204c51..d9ed7df32 100644 --- a/ui/pages/swaps/view-quote/__snapshots__/view-quote.test.js.snap +++ b/ui/pages/swaps/view-quote/__snapshots__/view-quote.test.js.snap @@ -38,7 +38,7 @@ exports[`ViewQuote renders the component with EIP-1559 enabled 2`] = ` class="exchange-rate-display main-quote-summary__exchange-rate-display" >
@@ -110,7 +110,7 @@ exports[`ViewQuote renders the component with initial props 2`] = ` class="exchange-rate-display main-quote-summary__exchange-rate-display" >