@@ -4,7 +4,7 @@ import { WalletSetupConfirmationDialogProvider, WalletSetupFlow, WalletSetupFlow
4
4
import { useBackgroundPage } from '@providers/BackgroundPageProvider' ;
5
5
import { walletRoutePaths } from '@routes' ;
6
6
import { Modal } from 'antd' ;
7
- import React from 'react' ;
7
+ import React , { useCallback } from 'react' ;
8
8
import { useHistory } from 'react-router-dom' ;
9
9
import styles from './MultiWallet.module.scss' ;
10
10
import { WalletOnboardingFlows } from './WalletOnboardingFlows' ;
@@ -17,20 +17,32 @@ export const MultiWallet = (): JSX.Element => {
17
17
const posthogClient = usePostHogClientContext ( ) ;
18
18
const { page, setBackgroundPage } = useBackgroundPage ( ) ;
19
19
20
+ const handleOnCancel = useCallback (
21
+ ( withConfirmationDialog : ( callback : ( ) => void ) => ( ) => void ) => {
22
+ withConfirmationDialog ( ( ) => {
23
+ setBackgroundPage ( ) ;
24
+ history . push ( page ) ;
25
+ window . location . reload ( ) ;
26
+ } ) ( ) ;
27
+ } ,
28
+ [ history , page , setBackgroundPage ]
29
+ ) ;
30
+
20
31
return (
21
32
< WalletSetupFlowProvider flow = { WalletSetupFlow . ADD_WALLET } >
22
33
< WalletSetupConfirmationDialogProvider >
23
34
{ ( { isDialogOpen, withConfirmationDialog, shouldShowDialog$ } ) => (
24
- < Modal centered closable = { false } footer = { null } open = { ! isDialogOpen } width = "100%" className = { styles . modal } >
35
+ < Modal
36
+ centered
37
+ closable
38
+ footer = { null }
39
+ open = { ! isDialogOpen }
40
+ width = "100%"
41
+ className = { styles . modal }
42
+ onCancel = { ( ) => handleOnCancel ( withConfirmationDialog ) }
43
+ >
25
44
< div className = { styles . closeButton } >
26
- < NavigationButton
27
- icon = "cross"
28
- onClick = { withConfirmationDialog ( ( ) => {
29
- setBackgroundPage ( ) ;
30
- history . push ( page ) ;
31
- window . location . reload ( ) ;
32
- } ) }
33
- />
45
+ < NavigationButton icon = "cross" onClick = { ( ) => handleOnCancel ( withConfirmationDialog ) } />
34
46
</ div >
35
47
< WalletOnboardingFlows
36
48
mergeEventRequired
0 commit comments