diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-05-26 02:36:07 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-05-26 03:03:18 +0800 |
commit | e575323c6013b89873b698a7f34da135a4b2c51f (patch) | |
tree | 43ff4bed7fdf007936fc1ba3ee3d113f884dd842 /packages/website/ts/components/onboarding/portal_onboarding_flow.tsx | |
parent | 809ac3340cb477d4b46e24d4bad028568beeec06 (diff) | |
download | dexon-0x-contracts-e575323c6013b89873b698a7f34da135a4b2c51f.tar dexon-0x-contracts-e575323c6013b89873b698a7f34da135a4b2c51f.tar.gz dexon-0x-contracts-e575323c6013b89873b698a7f34da135a4b2c51f.tar.bz2 dexon-0x-contracts-e575323c6013b89873b698a7f34da135a4b2c51f.tar.lz dexon-0x-contracts-e575323c6013b89873b698a7f34da135a4b2c51f.tar.xz dexon-0x-contracts-e575323c6013b89873b698a7f34da135a4b2c51f.tar.zst dexon-0x-contracts-e575323c6013b89873b698a7f34da135a4b2c51f.zip |
Auto-show onboarding flow on first page view
Diffstat (limited to 'packages/website/ts/components/onboarding/portal_onboarding_flow.tsx')
-rw-r--r-- | packages/website/ts/components/onboarding/portal_onboarding_flow.tsx | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx index c80d1dd6e..ab9d58415 100644 --- a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx +++ b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx @@ -14,7 +14,8 @@ export interface PortalOnboardingFlowProps { providerType: ProviderType; injectedProviderName: string; blockchainIsLoaded: boolean; - onClose: () => void; + hasBeenSeen: boolean; + setIsRunning: (isRunning: boolean) => void; setOnboardingStep: (stepIndex: number) => void; } @@ -42,6 +43,12 @@ const steps: Step[] = [ ]; export class PortalOnboardingFlow extends React.Component<PortalOnboardingFlowProps> { + public componentDidMount(): void { + this._autoStartOnboardingIfShould(); + } + public componentDidUpdate(): void { + this._autoStartOnboardingIfShould(); + } public render(): React.ReactNode { return ( <OnboardingFlow @@ -49,7 +56,7 @@ export class PortalOnboardingFlow extends React.Component<PortalOnboardingFlowPr blacklistedStepIndices={this._getBlacklistedStepIndices()} stepIndex={this.props.stepIndex} isRunning={this.props.isRunning} - onClose={this.props.onClose} + onClose={this.props.setIsRunning.bind(this, false)} setOnboardingStep={this.props.setOnboardingStep} /> ); @@ -73,4 +80,10 @@ export class PortalOnboardingFlow extends React.Component<PortalOnboardingFlowPr } return twoAndOn; } + + private _autoStartOnboardingIfShould(): void { + if (!this.props.isRunning && !this.props.hasBeenSeen && this.props.blockchainIsLoaded) { + this.props.setIsRunning(true); + } + } } |