Browse Source

onboarding breadcrumb adjustment for already initialized flow

master
Anastasia Poupeney 7 years ago
parent
commit
a0e3174545
  1. 11
      src/components/Onboarding/OnboardingBreadcrumb.js
  2. 7
      src/components/Onboarding/steps/GenuineCheck/index.js

11
src/components/Onboarding/OnboardingBreadcrumb.js

@ -21,10 +21,17 @@ type Props = {
function OnboardingBreadcrumb(props: Props) { function OnboardingBreadcrumb(props: Props) {
const { onboarding, t } = props const { onboarding, t } = props
const { stepName, genuine } = onboarding const { stepName, genuine } = onboarding
const isInitializedFlow = onboarding.flowType === 'initializedDevice'
const filteredSteps = onboarding.steps const regularFilteredSteps = onboarding.steps
.filter(step => !step.external) .filter(step => !step.external)
.map(step => ({ ...step, label: t(step.label) })) // TODO: translate .map(step => ({ ...step, label: t(step.label) }))
const alreadyInitializedSteps = onboarding.steps
.filter(step => !step.external && step.name !== 'writeSeed' && step.name !== 'selectPIN')
.map(step => ({ ...step, label: t(step.label) }))
const filteredSteps = isInitializedFlow ? alreadyInitializedSteps : regularFilteredSteps
const stepIndex = findIndex(filteredSteps, s => s.name === stepName) const stepIndex = findIndex(filteredSteps, s => s.name === stepName)
const genuineStepIndex = findIndex(filteredSteps, s => s.name === 'genuineCheck') const genuineStepIndex = findIndex(filteredSteps, s => s.name === 'genuineCheck')

7
src/components/Onboarding/steps/GenuineCheck/index.js

@ -146,6 +146,11 @@ class GenuineCheck extends PureComponent<StepProps, State> {
shell.openExternal(contactSupportUrl) shell.openExternal(contactSupportUrl)
} }
handlePrevStep = () => {
const { prevStep, onboarding, jumpStep } = this.props
onboarding.flowType === 'initializedDevice' ? jumpStep('selectDevice') : prevStep()
}
renderGenuineFail = () => ( renderGenuineFail = () => (
<GenuineCheckErrorPage <GenuineCheckErrorPage
redoGenuineCheck={this.redoGenuineCheck} redoGenuineCheck={this.redoGenuineCheck}
@ -275,7 +280,7 @@ class GenuineCheck extends PureComponent<StepProps, State> {
<OnboardingFooter <OnboardingFooter
t={t} t={t}
nextStep={nextStep} nextStep={nextStep}
prevStep={prevStep} prevStep={this.handlePrevStep}
isContinueDisabled={!genuine.isDeviceGenuine} isContinueDisabled={!genuine.isDeviceGenuine}
/> />
)} )}

Loading…
Cancel
Save