aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-06-07 09:06:03 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-06-07 09:06:03 +0800
commitcbe5438a31a54a92a198b2cc5ad8a5d5feb033b4 (patch)
tree69859892a8be12cc531fbd2e79976db3c2b2fa88 /packages/website/ts
parent612cc96e417c1397e1874be22208864f12acbda3 (diff)
downloaddexon-sol-tools-cbe5438a31a54a92a198b2cc5ad8a5d5feb033b4.tar
dexon-sol-tools-cbe5438a31a54a92a198b2cc5ad8a5d5feb033b4.tar.gz
dexon-sol-tools-cbe5438a31a54a92a198b2cc5ad8a5d5feb033b4.tar.bz2
dexon-sol-tools-cbe5438a31a54a92a198b2cc5ad8a5d5feb033b4.tar.lz
dexon-sol-tools-cbe5438a31a54a92a198b2cc5ad8a5d5feb033b4.tar.xz
dexon-sol-tools-cbe5438a31a54a92a198b2cc5ad8a5d5feb033b4.tar.zst
dexon-sol-tools-cbe5438a31a54a92a198b2cc5ad8a5d5feb033b4.zip
Render TokenAllowance
Diffstat (limited to 'packages/website/ts')
-rw-r--r--packages/website/ts/components/onboarding/portal_onboarding_flow.tsx21
-rw-r--r--packages/website/ts/containers/inputs/allowance_toggle.ts4
2 files changed, 20 insertions, 5 deletions
diff --git a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx
index 55d89d61e..78592c67f 100644
--- a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx
+++ b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx
@@ -4,7 +4,7 @@ import * as React from 'react';
import { BigNumber } from '@0xproject/utils';
import { Blockchain } from 'ts/blockchain';
import { OnboardingFlow, Step } from 'ts/components/onboarding/onboarding_flow';
-import { ProviderType, TokenByAddress, TokenStateByAddress } from 'ts/types';
+import { ProviderType, Token, TokenByAddress, TokenStateByAddress } from 'ts/types';
import { utils } from 'ts/utils/utils';
import { AllowanceToggle } from 'ts/containers/inputs/allowance_toggle';
@@ -83,7 +83,8 @@ export class PortalOnboardingFlow extends React.Component<PortalOnboardingFlowPr
},
{
target: '.weth-row',
- content: 'Unlock your tokens for trading. You only need to do this once for each token.',
+ // content: <div> Unlock your tokens for trading. You only need to do this once for each token. {this._renderEthAllowanceToggle()}</div>,
+ content: 'blah',
placement: 'right',
continueButtonDisplay: 'disabled',
},
@@ -135,9 +136,23 @@ export class PortalOnboardingFlow extends React.Component<PortalOnboardingFlowPr
this.props.updateIsRunning(true);
}
}
- private _renderAllowanceToggle(): React.ReactNode {
+ private _renderZrxAllowanceToggle(): React.ReactNode {
+ const zrxToken = utils.getZrxToken(this.props.tokenByAddress)
+ return this._renderAllowanceToggle(zrxToken);
+ }
+ private _renderEthAllowanceToggle(): React.ReactNode {
+ const ethToken = utils.getEthToken(this.props.tokenByAddress);
+ return this._renderAllowanceToggle(ethToken);
+ }
+ private _renderAllowanceToggle(token: Token): React.ReactNode {
+ if (!token) {
+ return null;
+ }
+ const tokenState = this.props.trackedTokenStateByAddress[token.address];
return (
<AllowanceToggle
+ token={token}
+ tokenState={tokenState}
blockchain={this.props.blockchain}
refetchTokenStateAsync={this.props.refetchTokenStateAsync}
/>
diff --git a/packages/website/ts/containers/inputs/allowance_toggle.ts b/packages/website/ts/containers/inputs/allowance_toggle.ts
index 1dd7b2101..6f50072ca 100644
--- a/packages/website/ts/containers/inputs/allowance_toggle.ts
+++ b/packages/website/ts/containers/inputs/allowance_toggle.ts
@@ -14,8 +14,8 @@ interface AllowanceToggleProps {
onErrorOccurred?: (errType: BalanceErrs) => void;
token: Token;
tokenState: TokenState;
- isDisabled: boolean;
- refetchTokenStateAsync: () => Promise<void>;
+ isDisabled?: boolean;
+ refetchTokenStateAsync: (tokenAddress: string) => Promise<void>;
}
interface ConnectedState {