@@ -9,6 +9,7 @@ import { unless, when } from '../../../utils/react-conditionals'
9
9
import {
10
10
getTotalImportStatusAndResult ,
11
11
hideImportWizard ,
12
+ notifyImportStatusToDiscord ,
12
13
updateProjectImportStatus ,
13
14
} from '../../../core/shared/import/import-operation-service'
14
15
import { OperationLine } from './components'
@@ -45,11 +46,6 @@ export const ImportWizard = React.memo(() => {
45
46
e . stopPropagation ( )
46
47
} , [ ] )
47
48
48
- const totalImportResult : TotalImportResult = React . useMemo (
49
- ( ) => getTotalImportStatusAndResult ( importState ) ,
50
- [ importState ] ,
51
- )
52
-
53
49
if ( projectId == null ) {
54
50
return null
55
51
}
@@ -130,7 +126,7 @@ export const ImportWizard = React.memo(() => {
130
126
gap : 10 ,
131
127
} }
132
128
>
133
- < ActionButtons importResult = { totalImportResult } />
129
+ < ActionButtons />
134
130
</ div >
135
131
</ div > ,
136
132
) }
@@ -139,7 +135,23 @@ export const ImportWizard = React.memo(() => {
139
135
} )
140
136
ImportWizard . displayName = 'ImportWizard'
141
137
142
- function ActionButtons ( { importResult } : { importResult : TotalImportResult } ) {
138
+ function ActionButtons ( ) {
139
+ const importState = useEditorState (
140
+ Substores . github ,
141
+ ( store ) => store . editor . importState ,
142
+ 'ImportWizard importState' ,
143
+ )
144
+
145
+ const projectName = useEditorState (
146
+ Substores . restOfEditor ,
147
+ ( store ) => store . editor . projectName ,
148
+ 'ImportWizard projectName' ,
149
+ )
150
+
151
+ const importResult : TotalImportResult = React . useMemo (
152
+ ( ) => getTotalImportStatusAndResult ( importState ) ,
153
+ [ importState ] ,
154
+ )
143
155
const colorTheme = useColorTheme ( )
144
156
const dispatch = useDispatch ( )
145
157
const result = importResult . result
@@ -174,6 +186,10 @@ function ActionButtons({ importResult }: { importResult: TotalImportResult }) {
174
186
}
175
187
} , [ dispatch , hideWizard , importResult . importStatus ] )
176
188
const importADifferentProject = React . useCallback ( ( ) => {
189
+ if ( importResult . importStatus . status !== 'done' ) {
190
+ // force a notification to discord that the import was exited in the middle
191
+ notifyImportStatusToDiscord ( importState , projectName , true )
192
+ }
177
193
dispatch (
178
194
[
179
195
setImportWizardOpen ( false ) ,
@@ -182,7 +198,7 @@ function ActionButtons({ importResult }: { importResult: TotalImportResult }) {
182
198
] ,
183
199
'everyone' ,
184
200
)
185
- } , [ dispatch ] )
201
+ } , [ dispatch , importResult . importStatus . status , importState , projectName ] )
186
202
const textStyle = {
187
203
color : textColor ,
188
204
fontSize : 14 ,
0 commit comments