@@ -18,9 +18,6 @@ import {
18
18
Link
19
19
} from 'brave-ui/features/sync'
20
20
21
- // Dialogs
22
- import CancelDeviceSyncingDialog from '../commonDialogs/cancelDeviceSyncing'
23
-
24
21
// Utils
25
22
import { getLocale } from '../../../../common/locale'
26
23
@@ -33,15 +30,13 @@ interface Props {
33
30
}
34
31
35
32
interface State {
36
- willCancelViewCode : boolean
37
33
newDeviceFound : boolean
38
34
}
39
35
40
36
export default class ViewSyncCodeModal extends React . PureComponent < Props , State > {
41
37
constructor ( props : Props ) {
42
38
super ( props )
43
39
this . state = {
44
- willCancelViewCode : false ,
45
40
newDeviceFound : false
46
41
}
47
42
}
@@ -57,11 +52,11 @@ export default class ViewSyncCodeModal extends React.PureComponent<Props, State>
57
52
const { newDeviceFound } = this . state
58
53
// when a device is found, self-close this modal
59
54
if ( newDeviceFound ) {
60
- this . dismissAllModals ( )
55
+ this . onDismissAllModals ( )
61
56
}
62
57
}
63
58
64
- dismissAllModals = ( ) => {
59
+ onDismissAllModals = ( ) => {
65
60
this . props . onClose ( )
66
61
if ( this . props . onCloseDeviceTypeModal ) {
67
62
this . props . onCloseDeviceTypeModal ( )
@@ -72,44 +67,12 @@ export default class ViewSyncCodeModal extends React.PureComponent<Props, State>
72
67
this . props . onClickScanCodeInstead ( )
73
68
}
74
69
75
- onDismissModal = ( ) => {
76
- const { isSyncConfigured } = this . props . syncData
77
- // if user is still trying to build a sync chain,
78
- // open the confirmation modal. otherwise close it
79
- isSyncConfigured
80
- ? this . setState ( { willCancelViewCode : true } )
81
- : this . dismissAllModals ( )
82
- }
83
-
84
- onDismissDialog = ( ) => {
85
- this . setState ( { willCancelViewCode : false } )
86
- }
87
-
88
- onConfirmDismissModal = ( ) => {
89
- const { isSyncConfigured } = this . props . syncData
90
- // sync is enabled when at least 2 devices are in the chain.
91
- // this modal works both with sync enabled and disabled states.
92
- // in case user opens it in the enabled content screen,
93
- // check there are 2 devices in chain before reset
94
- if ( isSyncConfigured ) {
95
- this . props . actions . onSyncReset ( )
96
- this . dismissAllModals ( )
97
- }
98
- this . setState ( { willCancelViewCode : false } )
99
- this . props . onClose ( )
100
- }
101
-
102
70
render ( ) {
103
71
const { syncData } = this . props
104
- const { willCancelViewCode , newDeviceFound } = this . state
72
+ const { newDeviceFound } = this . state
105
73
106
74
return (
107
75
< Modal id = 'viewSyncCodeModal' displayCloseButton = { false } size = 'small' >
108
- {
109
- willCancelViewCode
110
- ? < CancelDeviceSyncingDialog onClickCancel = { this . onDismissDialog } onClickOk = { this . onConfirmDismissModal } />
111
- : null
112
- }
113
76
< ModalHeader >
114
77
< div >
115
78
< Title level = { 1 } > { getLocale ( 'chainCode' ) } </ Title >
@@ -132,7 +95,7 @@ export default class ViewSyncCodeModal extends React.PureComponent<Props, State>
132
95
}
133
96
< ThreeColumnButtonGrid >
134
97
< div >
135
- < Link onClick = { this . onDismissModal } > { getLocale ( 'cancel' ) } </ Link >
98
+ < Link onClick = { this . onDismissAllModals } > { getLocale ( 'cancel' ) } </ Link >
136
99
</ div >
137
100
< div >
138
101
< Button
@@ -147,7 +110,7 @@ export default class ViewSyncCodeModal extends React.PureComponent<Props, State>
147
110
level = 'primary'
148
111
type = 'accent'
149
112
size = 'medium'
150
- onClick = { this . onDismissModal }
113
+ onClick = { this . onDismissAllModals }
151
114
disabled = { newDeviceFound === false }
152
115
text = {
153
116
newDeviceFound === false
0 commit comments