11import React , { useContext , useEffect , useState } from 'react' ;
22import { useDispatch , useSelector } from 'react-redux' ;
33import { Route , Switch , useHistory } from 'react-router-dom' ;
4- import { UnifiedSwapBridgeEventName } from '@metamask/bridge-controller' ;
4+ import {
5+ BridgeAppState ,
6+ UnifiedSwapBridgeEventName ,
7+ } from '@metamask/bridge-controller' ;
58import { I18nContext } from '../../contexts/i18n' ;
69import { clearSwapsState } from '../../ducks/swaps/swaps' ;
710import {
@@ -16,7 +19,10 @@ import {
1619 ButtonIconSize ,
1720 IconName ,
1821} from '../../components/component-library' ;
19- import { getSelectedNetworkClientId } from '../../../shared/modules/selectors/networks' ;
22+ import {
23+ getSelectedNetworkClientId ,
24+ getCurrentChainId ,
25+ } from '../../../shared/modules/selectors/networks' ;
2026import useBridging from '../../hooks/bridge/useBridging' ;
2127import {
2228 Content ,
@@ -34,6 +40,7 @@ import { useBridgeExchangeRates } from '../../hooks/bridge/useBridgeExchangeRate
3440import { useQuoteFetchEvents } from '../../hooks/bridge/useQuoteFetchEvents' ;
3541import { TextVariant } from '../../helpers/constants/design-system' ;
3642import { useTxAlerts } from '../../hooks/bridge/useTxAlerts' ;
43+ import { getIsUnifiedUIEnabled } from '../../ducks/bridge/selectors' ;
3744import PrepareBridgePage from './prepare/prepare-bridge-page' ;
3845import AwaitingSignaturesCancelButton from './awaiting-signatures/awaiting-signatures-cancel-button' ;
3946import AwaitingSignatures from './awaiting-signatures/awaiting-signatures' ;
@@ -57,6 +64,10 @@ const CrossChainSwap = () => {
5764 } ;
5865
5966 const isSwap = useIsMultichainSwap ( ) ;
67+ const chainId = useSelector ( getCurrentChainId ) ;
68+ const isUnifiedUIEnabled = useSelector ( ( state : BridgeAppState ) =>
69+ getIsUnifiedUIEnabled ( state , chainId ) ,
70+ ) ;
6071
6172 useEffect ( ( ) => {
6273 dispatch (
@@ -120,7 +131,7 @@ const CrossChainSwap = () => {
120131 />
121132 }
122133 >
123- { isSwap ? t ( 'swap' ) : t ( 'bridge' ) }
134+ { isSwap || isUnifiedUIEnabled ? t ( 'swap' ) : t ( 'bridge' ) }
124135 </ Header >
125136 < Content padding = { 0 } >
126137 < Switch >
0 commit comments