Skip to content

Commit 771ae71

Browse files
authored
fix: Update dapp swap comparison banner copy if rewards doesnt exist (#38317)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> This PR updates dapp swap comparison banner copy if rewards does not exists. Note: No changelog needed as this feature not released yet. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/38317?quickstart=1) ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Fixes: MetaMask/MetaMask-planning#6349 ## **Manual testing steps** 1. Trigger dapp swap comparison banner 2. See no "and earn" copy if points doesn't exist 3. See "and earn" copy if points exists ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [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 - [X] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [X] 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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Shows "Save with MetaMask Swaps" when rewards are absent, adding i18n keys and updating tests accordingly. > > - **UI (Confirmations)**: > - Update `dapp-swap-comparison-banner.tsx` to render `t('dappSwapAdvantage')` only when `rewards` exist; otherwise use `t('dappSwapAdvantageSaveOnly')`. > - **i18n**: > - Add `dappSwapAdvantageSaveOnly` locale string in `app/_locales/en/messages.json` and `app/_locales/en_GB/messages.json`. > - **Tests**: > - Adjust expectations in `dapp-swap-comparison-banner.test.tsx` to check for "Save with MetaMask Swaps" without rewards and "Save and earn with MetaMask Swaps" when rewards are provided. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 31dea0b. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 24ad418 commit 771ae71

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

app/_locales/en/messages.json

Lines changed: 3 additions & 0 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: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/pages/confirmations/components/confirm/dapp-swap-comparison-banner/dapp-swap-comparison-banner.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ describe('<DappSwapComparisonBanner />', () => {
131131
const { getByText } = render();
132132
expect(getByText('Market rate')).toBeInTheDocument();
133133
expect(getByText('MetaMask Swap')).toBeInTheDocument();
134-
expect(getByText('Save and earn with MetaMask Swaps')).toBeInTheDocument();
134+
expect(getByText('Save with MetaMask Swaps')).toBeInTheDocument();
135135
expect(getByText('Save $0.02')).toBeInTheDocument();
136136
expect(
137137
getByText('Network fees refunded on failed swaps'),
@@ -229,5 +229,6 @@ describe('<DappSwapComparisonBanner />', () => {
229229
});
230230
const { getByText } = render();
231231
expect(getByText(/Earn 100 points/u)).toBeInTheDocument();
232+
expect(getByText('Save and earn with MetaMask Swaps')).toBeInTheDocument();
232233
});
233234
});

ui/pages/confirmations/components/confirm/dapp-swap-comparison-banner/dapp-swap-comparison-banner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ const DappSwapComparisonInner = () => {
182182
color={TextColor.TextDefault}
183183
variant={TextVariant.BodySm}
184184
>
185-
{t('dappSwapAdvantage')}
185+
{rewards ? t('dappSwapAdvantage') : t('dappSwapAdvantageSaveOnly')}
186186
</Text>
187187
<Text
188188
className="dapp-swap_text-save"

0 commit comments

Comments
 (0)