@@ -223,6 +223,7 @@ export const IconPicker = (props: {
223
223
} ) => {
224
224
const [ visible , setVisible ] = useState ( false )
225
225
const [ loading , setLoading ] = useState ( false )
226
+ const [ downloading , setDownloading ] = useState ( false )
226
227
const [ searchText , setSearchText ] = useState < string > ( '' )
227
228
const [ searchResults , setSearchResults ] = useState < Array < any > > ( [ ] ) ;
228
229
@@ -268,20 +269,24 @@ export const IconPicker = (props: {
268
269
}
269
270
} catch ( error ) {
270
271
console . error ( error ) ;
272
+ setDownloading ( false ) ;
271
273
}
272
274
}
273
275
274
276
const fetchDownloadUrl = async ( uuid : string , preview : string ) => {
275
277
try {
278
+ setDownloading ( true ) ;
276
279
const result = await IconscoutApi . download ( uuid , {
277
280
format : props . assetType === AssetType . LOTTIE ? 'lottie' : 'svg' ,
278
281
} ) ;
279
282
280
283
downloadAsset ( uuid , result . download_url , ( assetUrl : string ) => {
284
+ setDownloading ( false ) ;
281
285
onChangeIcon ( uuid , assetUrl , preview ) ;
282
286
} ) ;
283
287
} catch ( error ) {
284
288
console . error ( error ) ;
289
+ setDownloading ( false ) ;
285
290
}
286
291
}
287
292
@@ -383,24 +388,26 @@ export const IconPicker = (props: {
383
388
< Spin indicator = { < LoadingOutlined style = { { fontSize : 25 } } spin /> } />
384
389
</ Flex >
385
390
) }
386
- { ! loading && Boolean ( searchText ) && ! searchResults ?. length && (
387
- < Flex align = "center" justify = "center" style = { { flex : 1 } } >
388
- < Typography . Text type = "secondary" >
389
- { trans ( "iconScout.noResults" ) }
390
- </ Typography . Text >
391
- </ Flex >
392
- ) }
393
- { ! loading && Boolean ( searchText ) && searchResults ?. length && (
394
- < IconListWrapper >
395
- < IconList
396
- width = { 550 }
397
- height = { 400 }
398
- rowHeight = { 80 }
399
- rowCount = { Math . ceil ( searchResults . length / columnNum ) }
400
- rowRenderer = { rowRenderer }
401
- />
402
- </ IconListWrapper >
403
- ) }
391
+ < Spin spinning = { downloading } indicator = { < LoadingOutlined style = { { fontSize : 25 } } /> } >
392
+ { ! loading && Boolean ( searchText ) && ! searchResults ?. length && (
393
+ < Flex align = "center" justify = "center" style = { { flex : 1 } } >
394
+ < Typography . Text type = "secondary" >
395
+ { trans ( "iconScout.noResults" ) }
396
+ </ Typography . Text >
397
+ </ Flex >
398
+ ) }
399
+ { ! loading && Boolean ( searchText ) && searchResults ?. length && (
400
+ < IconListWrapper >
401
+ < IconList
402
+ width = { 550 }
403
+ height = { 400 }
404
+ rowHeight = { 80 }
405
+ rowCount = { Math . ceil ( searchResults . length / columnNum ) }
406
+ rowRenderer = { rowRenderer }
407
+ />
408
+ </ IconListWrapper >
409
+ ) }
410
+ </ Spin >
404
411
</ PopupContainer >
405
412
</ Draggable >
406
413
}
0 commit comments