diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-06-01 02:40:21 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-06-01 02:54:25 +0800 |
commit | df27f4f1183e5d5879aa0768b2edfef091750ec5 (patch) | |
tree | 9b9ba591f9cc1cc34c56440e4368433150acb99d /packages/website/ts/components/wallet | |
parent | bee26daf0c2497a11dfe944d355c4958329d1f50 (diff) | |
download | dexon-sol-tools-df27f4f1183e5d5879aa0768b2edfef091750ec5.tar.gz dexon-sol-tools-df27f4f1183e5d5879aa0768b2edfef091750ec5.tar.zst dexon-sol-tools-df27f4f1183e5d5879aa0768b2edfef091750ec5.zip |
Change userEtherBalanceInWei to optional so we can know if its loading
Diffstat (limited to 'packages/website/ts/components/wallet')
-rw-r--r-- | packages/website/ts/components/wallet/wallet.tsx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/packages/website/ts/components/wallet/wallet.tsx b/packages/website/ts/components/wallet/wallet.tsx index 65d0ab235..85603c184 100644 --- a/packages/website/ts/components/wallet/wallet.tsx +++ b/packages/website/ts/components/wallet/wallet.tsx @@ -61,7 +61,7 @@ export interface WalletProps { dispatcher: Dispatcher; tokenByAddress: TokenByAddress; trackedTokens: Token[]; - userEtherBalanceInWei: BigNumber; + userEtherBalanceInWei?: BigNumber; lastForceTokenStateRefetch: number; injectedProviderName: string; providerType: ProviderType; @@ -335,16 +335,16 @@ export class Wallet extends React.Component<WalletProps, WalletState> { private _renderEthRows(): React.ReactNode { const icon = <img style={{ width: ICON_DIMENSION, height: ICON_DIMENSION }} src={ETHER_ICON_PATH} />; const primaryText = this._renderAmount( - true, - this.props.userEtherBalanceInWei, + !_.isUndefined(this.props.userEtherBalanceInWei), + this.props.userEtherBalanceInWei || new BigNumber(0), constants.DECIMAL_PLACES_ETH, constants.ETHER_SYMBOL, ); const etherToken = this._getEthToken(); const etherPrice = this.state.trackedTokenStateByAddress[etherToken.address].price; const secondaryText = this._renderValue( - true, - this.props.userEtherBalanceInWei, + !_.isUndefined(this.props.userEtherBalanceInWei) && !_.isUndefined(etherPrice), + this.props.userEtherBalanceInWei || new BigNumber(0), constants.DECIMAL_PLACES_ETH, etherPrice, ); @@ -407,7 +407,8 @@ export class Wallet extends React.Component<WalletProps, WalletState> { ): React.ReactNode { const shouldShowWrapEtherItem = !_.isUndefined(this.state.wrappedEtherDirection) && - this.state.wrappedEtherDirection === accessoryItemConfig.wrappedEtherDirection; + this.state.wrappedEtherDirection === accessoryItemConfig.wrappedEtherDirection && + !_.isUndefined(this.props.userEtherBalanceInWei); const additionalStyle = shouldShowWrapEtherItem ? walletItemStyles.focusedItem : styles.borderedItem; const style = { ...styles.tokenItem, ...additionalStyle }; const etherToken = this._getEthToken(); |