From efeb16d987b12a0da2061bcfe9775c5e5b74a3c6 Mon Sep 17 00:00:00 2001 From: Anastasia Poupeney Date: Mon, 11 Jun 2018 17:34:09 +0200 Subject: [PATCH] remove unnecessary compexity from footer definition in onboarding --- src/components/Onboarding/OnboardingFooter.js | 13 ++----------- src/components/Onboarding/steps/SelectDevice.js | 15 +++++++++++---- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/components/Onboarding/OnboardingFooter.js b/src/components/Onboarding/OnboardingFooter.js index c2658001..bab707fd 100644 --- a/src/components/Onboarding/OnboardingFooter.js +++ b/src/components/Onboarding/OnboardingFooter.js @@ -22,8 +22,6 @@ type Props = { t: T, nextStep: () => void, prevStep: () => void, - jumpStep?: string => void, - jumpTo?: string, isContinueDisabled?: boolean, } @@ -32,21 +30,14 @@ const OnboardingFooter = ({ nextStep, prevStep, isContinueDisabled, - jumpStep, - jumpTo, + ...props }: Props) => ( - diff --git a/src/components/Onboarding/steps/SelectDevice.js b/src/components/Onboarding/steps/SelectDevice.js index 217fe574..7ae50a18 100644 --- a/src/components/Onboarding/steps/SelectDevice.js +++ b/src/components/Onboarding/steps/SelectDevice.js @@ -22,8 +22,17 @@ class SelectDevice extends PureComponent { handleIsLedgerNano = (isLedgerNano: boolean) => { this.props.isLedgerNano(isLedgerNano) } + + handleContinue = () => { + const { nextStep, jumpStep, onboarding } = this.props + if (onboarding.flowType === 'initializedDevice') { + jumpStep('genuineCheck') + } else { + nextStep() + } + } render() { - const { t, onboarding, nextStep, prevStep, jumpStep } = this.props + const { t, onboarding, prevStep } = this.props return ( @@ -59,11 +68,9 @@ class SelectDevice extends PureComponent { horizontal flow={2} t={t} - nextStep={nextStep} + nextStep={this.handleContinue} prevStep={prevStep} - jumpStep={jumpStep} isContinueDisabled={onboarding.isLedgerNano === null} - jumpTo={onboarding.flowType === 'initializedDevice' ? 'genuineCheck' : undefined} /> )