Skip to content

Commit 4d624d6

Browse files
authored
feat(swaps): update swap input cards and gas-included fee UI (#47725)
## **Description** Brings the Swap UI updates already shipped on Mobile to the Extension swap form, following the [Extension Swap Figma frame](https://www.figma.com/design/1F3yNWYLOVPFpTPeJugH20/SWAP?node-id=15624-32126). **Source and destination inputs** - Each input is now its own rounded card (`background-muted`, 12px padding, 16px radius), with an 8px gap between them. The old flat layout with a divider line is removed. - The flip button sits centred in the gap between the cards. It's a 28px muted circle with a straight down arrow (`Arrow2Down`), replacing the two-way arrow. It is anchored to the gap itself rather than to 50% of the input area, so it stays aligned when the two cards differ in height (the amount font scales independently per input). - The ring around the flip button is drawn as a small SVG cutout in the page background colour. Its 12px fillets, matching Mobile's `FlipQuoteButton`, round off the sharp points where the circle meets the card edges. - The token picker pill uses `background-muted` with no border, so it reads correctly on the new cards. It also gets muted hover and pressed colours, because the default hover colour is identical to muted in dark mode. **Gas-included network fee** - Previously: the fee struck through, followed by " Included". Now: the fee amount followed by a small tag with the source token's icon and symbol, per the design. - The unused `swapGasFeesIncluded` string is removed from all locales. - The sponsored ("Paid by MetaMask") and regular network fee cases are unchanged. **Unchanged:** flip button behaviour, disabled logic, analytics events and test IDs (including the ones used by E2E page objects). **For reviewers:** the gas-included tag always shows the **source** token, as in the design. Please flag it if gas-included quotes can deduct fees in a different token. ## **Changelog** CHANGELOG entry: Updated the Swap form with separate source and destination cards, a new flip button, and a token tag for gas-included network fees ## **Related issues** Fixes: [SWAPS-4840](https://consensyssoftware.atlassian.net/browse/SWAPS-4840) ## **Manual testing steps** 1. Run the extension and open Swap. Use dark theme first. 2. Verify the source and destination inputs appear as two separate rounded grey cards with a small gap between them, and no divider line. 3. Verify the flip button sits centred in the gap, shows a straight down arrow, and has a smooth rounded cutout into both cards with no sharp corners. 4. Hover and press the flip button and verify the highlight is a circle that fills the button exactly. Click it and verify the tokens swap and the arrow rotates. 5. Hover and press the token picker pills and verify they highlight. 6. Type a long amount in the source input so its font shrinks, and verify the flip button stays centred in the gap. 7. Get a gas-included quote (for example, a small ERC-20 swap on Mainnet with low ETH balance). Verify the network fee row shows the fee amount followed by a tag with the source token icon and symbol, with no strikethrough and no "Included" text. 8. Repeat steps 2–5 in light theme, and in the popup, side panel and full-screen views. ## **Screenshots/Recordings** ### **Before** <!-- [screenshots/recordings] --> ### **After** <img width="410" height="489" alt="Image" src="https://github.com/user-attachments/assets/e095e77c-a007-41a9-a068-e88c097ab8e5" /> <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. [SWAPS-4840]: https://consensyssoftware.atlassian.net/browse/SWAPS-4840?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Primarily UI, copy, and test updates on the swap/bridge flow; fee logic and sponsored-fee paths are unchanged. > > **Overview** > Aligns the Extension **Swap/bridge** form with Mobile: **source and destination** are separate muted rounded cards with an 8px gap; the flip control is a smaller centred down-arrow in a muted circle with an SVG background cutout instead of a divider and vertical swap icon. > > **Token picker** pills on the cards use muted fill, transparent border, and muted hover/pressed styles. **Gas-included** network fees no longer show strikethrough plus the “Included” label—they show the fee amount beside a muted tag with the **source** token icon and symbol. The `swapGasFeesIncluded` locale key is removed everywhere; E2E now targets `data-testid="network-fees-included"`. Snapshots and unit tests reflect the layout and fee row updates. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 5974c06. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 5e77e55 commit 4d624d6

26 files changed

Lines changed: 552 additions & 518 deletions

‎app/_locales/de/messages.json‎

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎app/_locales/el/messages.json‎

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎app/_locales/en/messages.json‎

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎app/_locales/en_GB/messages.json‎

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎app/_locales/es_419/messages.json‎

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎app/_locales/fr/messages.json‎

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎app/_locales/ga/messages.json‎

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎app/_locales/hi/messages.json‎

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎app/_locales/id/messages.json‎

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎app/_locales/ja/messages.json‎

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)