aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/components
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-05-26 02:36:07 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-05-26 03:03:18 +0800
commite575323c6013b89873b698a7f34da135a4b2c51f (patch)
tree43ff4bed7fdf007936fc1ba3ee3d113f884dd842 /packages/website/ts/components
parent809ac3340cb477d4b46e24d4bad028568beeec06 (diff)
downloaddexon-sol-tools-e575323c6013b89873b698a7f34da135a4b2c51f.tar
dexon-sol-tools-e575323c6013b89873b698a7f34da135a4b2c51f.tar.gz
dexon-sol-tools-e575323c6013b89873b698a7f34da135a4b2c51f.tar.bz2
dexon-sol-tools-e575323c6013b89873b698a7f34da135a4b2c51f.tar.lz
dexon-sol-tools-e575323c6013b89873b698a7f34da135a4b2c51f.tar.xz
dexon-sol-tools-e575323c6013b89873b698a7f34da135a4b2c51f.tar.zst
dexon-sol-tools-e575323c6013b89873b698a7f34da135a4b2c51f.zip
Auto-show onboarding flow on first page view
Diffstat (limited to 'packages/website/ts/components')
-rw-r--r--packages/website/ts/components/onboarding/portal_onboarding_flow.tsx17
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);
+ }
+ }
}