show loader in send funds modal when lazy loading screens
This commit is contained in:
parent
033284d835
commit
18945205d3
|
@ -1,6 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React, { useState, useEffect } from 'react'
|
import React, { useState, useEffect, Suspense } from 'react'
|
||||||
import { List } from 'immutable'
|
import { List } from 'immutable'
|
||||||
|
import CircularProgress from '@material-ui/core/CircularProgress'
|
||||||
import cn from 'classnames'
|
import cn from 'classnames'
|
||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
import { type Token } from '~/logic/tokens/store/model/token'
|
import { type Token } from '~/logic/tokens/store/model/token'
|
||||||
|
@ -29,7 +30,7 @@ type Props = {
|
||||||
tokens: List<Token>,
|
tokens: List<Token>,
|
||||||
selectedToken: string,
|
selectedToken: string,
|
||||||
createTransaction: Function,
|
createTransaction: Function,
|
||||||
activeScreenType: ActiveScreen
|
activeScreenType: ActiveScreen,
|
||||||
}
|
}
|
||||||
|
|
||||||
type TxStateType =
|
type TxStateType =
|
||||||
|
@ -51,6 +52,14 @@ const styles = () => ({
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const loaderStyle = {
|
||||||
|
height: '500px',
|
||||||
|
width: '100%',
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
}
|
||||||
|
|
||||||
const Send = ({
|
const Send = ({
|
||||||
onClose,
|
onClose,
|
||||||
isOpen,
|
isOpen,
|
||||||
|
@ -90,11 +99,15 @@ const Send = ({
|
||||||
description="Send Tokens Form"
|
description="Send Tokens Form"
|
||||||
handleClose={onClose}
|
handleClose={onClose}
|
||||||
open={isOpen}
|
open={isOpen}
|
||||||
paperClassName={cn(
|
paperClassName={cn(scalableModalSize ? classes.scalableStaticModalWindow : classes.scalableModalWindow)}
|
||||||
scalableModalSize ? classes.scalableStaticModalWindow : classes.scalableModalWindow,
|
>
|
||||||
|
<Suspense
|
||||||
|
fallback={(
|
||||||
|
<div style={loaderStyle}>
|
||||||
|
<CircularProgress size={40} />
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<>
|
|
||||||
{activeScreen === 'chooseTxType' && <ChooseTxType onClose={onClose} setActiveScreen={setActiveScreen} />}
|
{activeScreen === 'chooseTxType' && <ChooseTxType onClose={onClose} setActiveScreen={setActiveScreen} />}
|
||||||
{activeScreen === 'sendFunds' && (
|
{activeScreen === 'sendFunds' && (
|
||||||
<SendFunds
|
<SendFunds
|
||||||
|
@ -144,7 +157,7 @@ const Send = ({
|
||||||
createTransaction={createTransaction}
|
createTransaction={createTransaction}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</Suspense>
|
||||||
</Modal>
|
</Modal>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue