Skip to content

Commit e61196a

Browse files
authored
fix: display network switch notification for bridge screen (#31037)
<!-- 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** This PR aims to display the network switch notification when users try to bridge a token on a network other than the current selected one, informing the user that a switch network hanppended. <!-- 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? --> [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/31037?quickstart=1) ## **Related issues** Fixes: #30925 ## **Manual testing steps** 1. Enable Popular network view 2. Select a token on a network other than the current selected one 3. Start Bridge ## **Screenshots/Recordings** [switch-notification.webm](https://github.com/user-attachments/assets/97285855-7d8a-419c-ae80-874e5f7c76b5) <!-- 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.
1 parent b6da134 commit e61196a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ui/components/app/toast-master/toast-master.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
SEND_ROUTE,
2626
SWAPS_ROUTE,
2727
PREPARE_SWAP_ROUTE,
28+
CROSS_CHAIN_SWAP_ROUTE,
2829
} from '../../../helpers/constants/routes';
2930
import { getURLHost } from '../../../helpers/utils/util';
3031
import { useI18nContext } from '../../../hooks/useI18nContext';
@@ -79,6 +80,8 @@ export function ToastMaster() {
7980
const onSwapsScreen =
8081
location.pathname === SWAPS_ROUTE ||
8182
location.pathname === PREPARE_SWAP_ROUTE;
83+
const onBridgeScreen =
84+
location.pathname === `${CROSS_CHAIN_SWAP_ROUTE}${PREPARE_SWAP_ROUTE}`;
8285

8386
if (onHomeScreen) {
8487
return (
@@ -99,7 +102,7 @@ export function ToastMaster() {
99102
);
100103
}
101104

102-
if (onSendScreen || onSwapsScreen) {
105+
if (onSendScreen || onSwapsScreen || onBridgeScreen) {
103106
return (
104107
<ToastContainer>
105108
<SwitchedNetworkToast />

0 commit comments

Comments
 (0)