From c439953d947b5500b2f5b61416cc2adef7c7a6bb Mon Sep 17 00:00:00 2001 From: filipsekulic Date: Thu, 10 Mar 2022 17:33:53 +0100 Subject: [PATCH] Fixed issues in onboarding flow (#13826) --- .../app/step-progress-bar/index.scss | 3 +-- .../step-progress-bar/step-progress-bar.js | 17 ++++++++-------- ui/helpers/constants/onboarding.js | 6 ++++++ .../create-password/create-password.js | 20 +++++++++++++++---- 4 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 ui/helpers/constants/onboarding.js diff --git a/ui/components/app/step-progress-bar/index.scss b/ui/components/app/step-progress-bar/index.scss index 20292690b..3e5b12645 100644 --- a/ui/components/app/step-progress-bar/index.scss +++ b/ui/components/app/step-progress-bar/index.scss @@ -17,7 +17,6 @@ ul.two-steps { font-size: 12px; position: relative; text-align: center; - text-transform: uppercase; color: #7d7d7d; z-index: 2; } @@ -84,7 +83,7 @@ ul.two-steps { } } -.progressbar li.active + li::after { +.progressbar li.complete + li::after { background-color: var(--primary-blue); z-index: -1; diff --git a/ui/components/app/step-progress-bar/step-progress-bar.js b/ui/components/app/step-progress-bar/step-progress-bar.js index 1bc0f542c..88f49a826 100644 --- a/ui/components/app/step-progress-bar/step-progress-bar.js +++ b/ui/components/app/step-progress-bar/step-progress-bar.js @@ -1,6 +1,7 @@ import React from 'react'; import classnames from 'classnames'; import PropTypes from 'prop-types'; +import { capitalize } from 'lodash'; import { useI18nContext } from '../../../hooks/useI18nContext'; import Box from '../../ui/box'; import { BLOCK_SIZES } from '../../../helpers/constants/design-system'; @@ -26,26 +27,26 @@ export function ThreeStepProgressBar({ stage }) {
  • = 1, - complete: stage >= 1, + complete: stage > 1, })} > - {t('createPassword')} + {capitalize(t('createPassword'))}
  • = 2, - complete: stage >= 3, + complete: stage > 3, })} > - {t('secureWallet')} + {capitalize(t('secureWallet'))}
  • = 4, - complete: stage >= 5, + complete: stage > 5, })} > - {t('confirmRecoveryPhrase')} + {capitalize(t('confirmRecoveryPhrase'))}
  • @@ -63,7 +64,7 @@ export function TwoStepProgressBar({ stage }) { complete: stage > 1, })} > - {t('confirmRecoveryPhrase')} + {capitalize(t('confirmRecoveryPhrase'))}
  • 2, })} > - {t('createPassword')} + {capitalize(t('createPassword'))}
  • diff --git a/ui/helpers/constants/onboarding.js b/ui/helpers/constants/onboarding.js new file mode 100644 index 000000000..a637bac6c --- /dev/null +++ b/ui/helpers/constants/onboarding.js @@ -0,0 +1,6 @@ +const FIRST_TIME_FLOW_TYPES = { + IMPORT: 'import', + CREATE: 'create', +}; + +export { FIRST_TIME_FLOW_TYPES }; diff --git a/ui/pages/onboarding-flow/create-password/create-password.js b/ui/pages/onboarding-flow/create-password/create-password.js index 26a35c026..e91e31004 100644 --- a/ui/pages/onboarding-flow/create-password/create-password.js +++ b/ui/pages/onboarding-flow/create-password/create-password.js @@ -2,6 +2,7 @@ import React, { useState, useMemo } from 'react'; import PropTypes from 'prop-types'; import { useHistory } from 'react-router-dom'; import zxcvbn from 'zxcvbn'; +import { useSelector } from 'react-redux'; import { useNewMetricEvent } from '../../../hooks/useMetricEvent'; import { useI18nContext } from '../../../hooks/useI18nContext'; import Button from '../../../components/ui/button'; @@ -27,6 +28,8 @@ import { twoStepStages, } from '../../../components/app/step-progress-bar'; import ZENDESK_URLS from '../../../helpers/constants/zendesk-url'; +import { getFirstTimeFlowType } from '../../../selectors'; +import { FIRST_TIME_FLOW_TYPES } from '../../../helpers/constants/onboarding'; export default function CreatePassword({ createNewAccount, @@ -43,6 +46,7 @@ export default function CreatePassword({ const [termsChecked, setTermsChecked] = useState(false); const [showPassword, setShowPassword] = useState(false); const history = useHistory(); + const firstTimeFlowType = useSelector(getFirstTimeFlowType); const submitPasswordEvent = useNewMetricEvent({ event: 'Submit Password', @@ -126,7 +130,10 @@ export default function CreatePassword({ return; } // If secretRecoveryPhrase is defined we are in import wallet flow - if (secretRecoveryPhrase) { + if ( + secretRecoveryPhrase && + firstTimeFlowType === FIRST_TIME_FLOW_TYPES.IMPORT + ) { await importWithRecoveryPhrase(password, secretRecoveryPhrase); history.push(ONBOARDING_COMPLETION_ROUTE); } else { @@ -145,7 +152,8 @@ export default function CreatePassword({ return (
    - {secretRecoveryPhrase ? ( + {secretRecoveryPhrase && + firstTimeFlowType === FIRST_TIME_FLOW_TYPES.IMPORT ? ( ) : ( @@ -231,7 +239,8 @@ export default function CreatePassword({