File tree Expand file tree Collapse file tree 2 files changed +49
-9
lines changed Expand file tree Collapse file tree 2 files changed +49
-9
lines changed Original file line number Diff line number Diff line change
1
+ <script >
2
+ export let description
3
+ </script >
4
+
1
5
<style >
6
+ .bn-onboard-loading-container {
7
+ display : flex ;
8
+ flex-direction : column ;
9
+ align-items : center ;
10
+ justify-content : center ;
11
+ font-family : inherit ;
12
+ font-size : inherit ;
13
+ color : inherit ;
14
+ }
15
+
16
+ span {
17
+ font-family : inherit ;
18
+ font-size : 0.889em ;
19
+ margin-top : 1rem ;
20
+ }
21
+
2
22
:global(.bn-onboard-loading ) {
3
23
display : inline-block ;
4
24
position : relative ;
36
56
}
37
57
</style >
38
58
39
- <div class =" bn-onboard-custom bn-onboard-loading" >
40
- <div class =" bn-onboard-loading-first" />
41
- <div class =" bn-onboard-loading-second" />
42
- <div class =" bn-onboard-loading-third" />
59
+ <div class =" bn-onboard-loading-container" >
60
+ <div class =" bn-onboard-custom bn-onboard-loading" >
61
+ <div class =" bn-onboard-loading-first" />
62
+ <div class =" bn-onboard-loading-second" />
63
+ <div class =" bn-onboard-loading-third" />
64
+ </div >
65
+ {#if description }
66
+ <span >{description }</span >
67
+ {/if }
43
68
</div >
Original file line number Diff line number Diff line change 186
186
}
187
187
188
188
function runModules(modules : WalletCheckModule []) {
189
- loadingModal = true
190
189
return new Promise (
191
190
async (
192
191
resolve : (result : {
198
197
const result = await invalidState (module , currentState )
199
198
200
199
if (result ) {
201
- loadingModal = false
202
200
return resolve (result )
203
201
}
204
202
}
205
203
206
- loadingModal = false
207
204
return resolve ({ modal: undefined , module: undefined })
208
205
}
209
206
)
238
235
}
239
236
} else {
240
237
// module returned a promise, so await it for val
241
- const modal = await result
238
+ // show loading spinner if promise doesn't resolve within 150ms
239
+ let modal
240
+ await new Promise (resolve => {
241
+ let completed: boolean = false
242
+
243
+ result .then (res => {
244
+ loadingModal = false
245
+ completed = true
246
+ modal = res
247
+ resolve ()
248
+ })
249
+
250
+ setTimeout (() => {
251
+ if (! completed ) {
252
+ loadingModal = true
253
+ }
254
+ }, 150 )
255
+ })
256
+
242
257
if (modal ) {
243
258
validateModal (modal )
244
259
return {
294
309
295
310
{#if loadingModal }
296
311
<Modal closeable ={false }>
297
- <Spinner />
312
+ <Spinner description = " Checking wallet " />
298
313
</Modal >
299
314
{/if }
300
315
You can’t perform that action at this time.
0 commit comments