11import React , { PureComponent } from 'react' ;
22import PropTypes from 'prop-types' ;
3- import { Route } from 'react-router-dom' ;
4- import { Navigate } from 'react-router-dom-v5-compat' ;
3+ import { Redirect , Route } from 'react-router-dom' ;
54import { Text , TextVariant , TextColor } from '@metamask/design-system-react' ;
65import { COHORT_NAMES } from '@metamask/subscription-controller' ;
76import {
@@ -65,11 +64,10 @@ import {
6564 SUPPORT_LINK ,
6665 ///: END:ONLY_INCLUDE_IF
6766} from '../../../shared/lib/ui-utils' ;
68- import { AccountOverview } from '../../components/multichain' ;
67+ import { AccountOverview } from '../../components/multichain/account-overview ' ;
6968import { setEditedNetwork } from '../../store/actions' ;
7069import { navigateToConfirmation } from '../confirmations/hooks/useConfirmationNavigation' ;
7170import PasswordOutdatedModal from '../../components/app/password-outdated-modal' ;
72- import ConnectionsRemovedModal from '../../components/app/connections-removed-modal' ;
7371import ShieldEntryModal from '../../components/app/shield-entry-modal' ;
7472///: BEGIN:ONLY_INCLUDE_IF(build-beta)
7573import BetaHomeFooter from './beta/beta-home-footer.component' ;
@@ -100,7 +98,7 @@ export default class Home extends PureComponent {
10098 } ;
10199
102100 static propTypes = {
103- navigate : PropTypes . func ,
101+ history : PropTypes . object ,
104102 forgottenPassword : PropTypes . bool ,
105103 setConnectedStatusPopoverHasBeenShown : PropTypes . func ,
106104 shouldShowSeedPhraseReminder : PropTypes . bool . isRequired ,
@@ -170,7 +168,6 @@ export default class Home extends PureComponent {
170168 setAccountDetailsAddress : PropTypes . func ,
171169 isSeedlessPasswordOutdated : PropTypes . bool ,
172170 isPrimarySeedPhraseBackedUp : PropTypes . bool ,
173- showConnectionsRemovedModal : PropTypes . bool ,
174171 showShieldEntryModal : PropTypes . bool ,
175172 isSocialLoginFlow : PropTypes . bool ,
176173 lookupSelectedNetworks : PropTypes . func . isRequired ,
@@ -224,7 +221,7 @@ export default class Home extends PureComponent {
224221
225222 checkStatusAndNavigate ( ) {
226223 const {
227- navigate ,
224+ history ,
228225 isNotification,
229226 haveSwapsQuotes,
230227 haveBridgeQuotes,
@@ -242,25 +239,25 @@ export default class Home extends PureComponent {
242239
243240 const canRedirect = ! isNotification && ! stayOnHomePage ;
244241 if ( canRedirect && showAwaitingSwapScreen ) {
245- navigate ( AWAITING_SWAP_ROUTE ) ;
242+ history . push ( AWAITING_SWAP_ROUTE ) ;
246243 } else if ( canRedirect && ( haveSwapsQuotes || swapsFetchParams ) ) {
247- navigate ( PREPARE_SWAP_ROUTE ) ;
244+ history . push ( PREPARE_SWAP_ROUTE ) ;
248245 } else if ( canRedirect && haveBridgeQuotes ) {
249- navigate ( CROSS_CHAIN_SWAP_ROUTE + PREPARE_SWAP_ROUTE ) ;
246+ history . push ( CROSS_CHAIN_SWAP_ROUTE + PREPARE_SWAP_ROUTE ) ;
250247 } else if ( pendingApprovals . length || hasApprovalFlows ) {
251248 navigateToConfirmation (
252249 pendingApprovals ?. [ 0 ] ?. id ,
253250 pendingApprovals ,
254251 hasApprovalFlows ,
255- navigate ,
252+ history ,
256253 ) ;
257254 }
258255 }
259256
260257 checkRedirectAfterDefaultPage ( ) {
261258 const {
262259 redirectAfterDefaultPage,
263- navigate ,
260+ history ,
264261 clearRedirectAfterDefaultPage,
265262 setAccountDetailsAddress,
266263 } = this . props ;
@@ -274,7 +271,7 @@ export default class Home extends PureComponent {
274271 setAccountDetailsAddress ( redirectAfterDefaultPage . address ) ;
275272 }
276273
277- navigate ( redirectAfterDefaultPage . path ) ;
274+ history . push ( redirectAfterDefaultPage . path ) ;
278275 clearRedirectAfterDefaultPage ( ) ;
279276 }
280277 }
@@ -398,7 +395,7 @@ export default class Home extends PureComponent {
398395 const { t } = this . context ;
399396
400397 const {
401- navigate ,
398+ history ,
402399 shouldShowSeedPhraseReminder,
403400 isPopup,
404401 shouldShowWeb3ShimUsageNotification,
@@ -661,7 +658,7 @@ export default class Home extends PureComponent {
661658 if ( isPopup ) {
662659 global . platform . openExtensionInBrowser ( backUpSRPRoute ) ;
663660 } else {
664- navigate ( backUpSRPRoute ) ;
661+ history . push ( backUpSRPRoute ) ;
665662 }
666663 } }
667664 infoText = { t ( 'backupApprovalInfo' ) }
@@ -867,13 +864,12 @@ export default class Home extends PureComponent {
867864 showUpdateModal,
868865 isSeedlessPasswordOutdated,
869866 isPrimarySeedPhraseBackedUp,
870- showConnectionsRemovedModal,
871867 showShieldEntryModal,
872868 isSocialLoginFlow,
873869 } = this . props ;
874870
875871 if ( forgottenPassword ) {
876- return < Navigate to = { RESTORE_VAULT_ROUTE } replace /> ;
872+ return < Redirect to = { { pathname : RESTORE_VAULT_ROUTE } } /> ;
877873 } else if ( this . state . notificationClosing || this . state . redirecting ) {
878874 return null ;
879875 }
@@ -935,7 +931,6 @@ export default class Home extends PureComponent {
935931 { showTermsOfUse ? (
936932 < TermsOfUsePopup onAccept = { this . onAcceptTermsOfUse } />
937933 ) : null }
938- { showConnectionsRemovedModal && < ConnectionsRemovedModal /> }
939934 { showShieldEntryModal && < ShieldEntryModal /> }
940935 { isPopup && ! connectedStatusPopoverHasBeenShown
941936 ? this . renderPopover ( )
0 commit comments