diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-06-29 08:20:05 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-06-29 08:20:05 +0800 |
commit | e235a63119216525815430832ebf88fbef5e9259 (patch) | |
tree | 8b62a0dbc9871988b31db4228e8f18a500212717 /packages/website/ts/components/onboarding | |
parent | c20549e88d710cb5b3577fae468545aa2d531370 (diff) | |
parent | 518a2da0275632a5dd61f99a105163ff5a074927 (diff) | |
download | dexon-sol-tools-e235a63119216525815430832ebf88fbef5e9259.tar dexon-sol-tools-e235a63119216525815430832ebf88fbef5e9259.tar.gz dexon-sol-tools-e235a63119216525815430832ebf88fbef5e9259.tar.bz2 dexon-sol-tools-e235a63119216525815430832ebf88fbef5e9259.tar.lz dexon-sol-tools-e235a63119216525815430832ebf88fbef5e9259.tar.xz dexon-sol-tools-e235a63119216525815430832ebf88fbef5e9259.tar.zst dexon-sol-tools-e235a63119216525815430832ebf88fbef5e9259.zip |
Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/website/portal-onboarding-polish
Diffstat (limited to 'packages/website/ts/components/onboarding')
-rw-r--r-- | packages/website/ts/components/onboarding/portal_onboarding_flow.tsx | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx index 6486bafcb..1850a0966 100644 --- a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx +++ b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx @@ -186,9 +186,11 @@ class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProp const ethToken = utils.getEthToken(this.props.tokenByAddress); const zrxToken = utils.getZrxToken(this.props.tokenByAddress); if (ethToken && zrxToken) { - const ethTokenAllowance = this.props.trackedTokenStateByAddress[ethToken.address].allowance; - const zrxTokenAllowance = this.props.trackedTokenStateByAddress[zrxToken.address].allowance; - return ethTokenAllowance > new BigNumber(0) && zrxTokenAllowance > new BigNumber(0); + const ethTokenState = this.props.trackedTokenStateByAddress[ethToken.address]; + const zrxTokenState = this.props.trackedTokenStateByAddress[zrxToken.address]; + if (ethTokenState && zrxTokenState) { + return ethTokenState.allowance.gt(0) && zrxTokenState.allowance.gt(0); + } } return false; } @@ -251,12 +253,15 @@ class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProp if (!token) { return null; } - const tokenState = this.props.trackedTokenStateByAddress[token.address]; + const tokenStateIfExists = this.props.trackedTokenStateByAddress[token.address]; + if (_.isUndefined(tokenStateIfExists)) { + return null; + } return ( <AllowanceToggle token={token} - tokenState={tokenState} - isDisabled={!tokenState.isLoaded} + tokenState={tokenStateIfExists} + isDisabled={!tokenStateIfExists.isLoaded} blockchain={this.props.blockchain} // tslint:disable-next-line:jsx-no-lambda refetchTokenStateAsync={async () => this.props.refetchTokenStateAsync(token.address)} |