Browse Source

Merge pull request #800 from NastiaS/minorFixesBranch

Minor fixes branch
master
Gaëtan Renaudeau 7 years ago
committed by GitHub
parent
commit
c1bd4dd536
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      src/components/Onboarding/OnboardingBreadcrumb.js
  2. 96
      src/components/Onboarding/steps/GenuineCheck/GenuineCheckErrorPage.js
  3. 25
      src/components/Onboarding/steps/GenuineCheck/index.js
  4. 20
      static/i18n/en/onboarding.yml

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')

96
src/components/Onboarding/steps/GenuineCheck/GenuineCheckErrorPage.js

@ -1,6 +1,6 @@
// @flow // @flow
import React, { Fragment } from 'react' import React, { PureComponent, Fragment } from 'react'
import { i } from 'helpers/staticPath' import { i } from 'helpers/staticPath'
import type { T } from 'types/common' import type { T } from 'types/common'
@ -12,54 +12,80 @@ import TrackPage from 'analytics/TrackPage'
import { Title, Description, OnboardingFooterWrapper } from '../../helperComponents' import { Title, Description, OnboardingFooterWrapper } from '../../helperComponents'
export function GenuineCheckErrorPage({ type Props = {
redoGenuineCheck, t: T,
contactSupport,
onboarding,
t,
}: {
redoGenuineCheck: () => void, redoGenuineCheck: () => void,
contactSupport: () => void, contactSupport: () => void,
onboarding: OnboardingState, onboarding: OnboardingState,
t: T, }
}) {
return ( class GenuineCheckErrorPage extends PureComponent<Props, *> {
<Box sticky pt={50}> trackErrorPage = (page: string) => {
const { onboarding } = this.props
return (
<TrackPage <TrackPage
category="Onboarding" category="Onboarding"
name="Genuine Check Error Page" name={`Genuine Check Error Page - ${page}`}
flowType={onboarding.flowType} flowType={onboarding.flowType}
deviceType={onboarding.isLedgerNano ? 'Nano S' : 'Blue'} deviceType={onboarding.isLedgerNano ? 'Nano S' : 'Blue'}
/> />
<Box grow alignItems="center" justifyContent="center"> )
{onboarding.isLedgerNano ? ( }
renderErrorPage = () => {
const { onboarding, t } = this.props
return (
<Fragment>
{onboarding.genuine.isGenuineFail ? (
<Fragment> <Fragment>
<Title>{t('onboarding:genuineCheck.errorPage.ledgerNano.title')}</Title> {this.trackErrorPage('Not Genuine')}
<Description>{t('onboarding:genuineCheck.errorPage.ledgerNano.desc')}</Description> <Title>{t('onboarding:genuineCheck.errorPage.title.isGenuineFail')}</Title>
<Box mt={5} mr={7}> <Description>{t('onboarding:genuineCheck.errorPage.desc.isGenuineFail')}</Description>
<img alt="" src={i('nano-error-onb.svg')} /> </Fragment>
</Box> ) : !onboarding.genuine.pinStepPass ? (
<Fragment>
{this.trackErrorPage('PIN Step')}
<Title>{t('onboarding:genuineCheck.errorPage.title.pinFailed')}</Title>
<Description>{t('onboarding:genuineCheck.errorPage.desc.pinFailed')}</Description>
</Fragment> </Fragment>
) : ( ) : (
<Fragment> <Fragment>
<Title>{t('onboarding:genuineCheck.errorPage.ledgerBlue.title')}</Title> {this.trackErrorPage('Recovery Phase Step')}
<Description pb={5}> <Title>{t('onboarding:genuineCheck.errorPage.title.recoveryPhraseFailed')}</Title>
{t('onboarding:genuineCheck.errorPage.ledgerBlue.desc')} <Description>
{t('onboarding:genuineCheck.errorPage.desc.recoveryPhraseFailed')}
</Description> </Description>
<Box alignItems="center">
<img alt="" src={i('blue-error-onb.svg')} />
</Box>
</Fragment> </Fragment>
)} )}
<Box mt={5} mr={7}>
{onboarding.isLedgerNano ? (
<img alt="" src={i('nano-error-onb.svg')} />
) : (
<img alt="" src={i('blue-error-onb.svg')} />
)}
</Box>
</Fragment>
)
}
render() {
const { redoGenuineCheck, contactSupport, t } = this.props
return (
<Box sticky pt={50}>
<Box grow alignItems="center" justifyContent="center">
{this.renderErrorPage()}
</Box>
<OnboardingFooterWrapper>
<Button padded outlineGrey onClick={() => redoGenuineCheck()}>
{t('app:common.back')}
</Button>
<Button padded danger onClick={() => contactSupport()} ml="auto">
{t('onboarding:genuineCheck.buttons.contactSupport')}
</Button>
</OnboardingFooterWrapper>
</Box> </Box>
<OnboardingFooterWrapper> )
<Button padded outlineGrey onClick={() => redoGenuineCheck()}> }
{t('app:common.back')}
</Button>
<Button padded danger onClick={() => contactSupport()} ml="auto">
{t('onboarding:genuineCheck.buttons.contactSupport')}
</Button>
</OnboardingFooterWrapper>
</Box>
)
} }
export default GenuineCheckErrorPage

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

@ -26,7 +26,7 @@ import {
GenuineCheckCardWrapper, GenuineCheckCardWrapper,
} from '../../helperComponents' } from '../../helperComponents'
import { GenuineCheckErrorPage } from './GenuineCheckErrorPage' import GenuineCheckErrorPage from './GenuineCheckErrorPage'
import { import {
GenuineCheckUnavailableFooter, GenuineCheckUnavailableFooter,
GenuineCheckUnavailableMessage, GenuineCheckUnavailableMessage,
@ -81,14 +81,8 @@ class GenuineCheck extends PureComponent<StepProps, State> {
} }
if (!item.pass) { if (!item.pass) {
this.setState(INITIAL_STATE)
this.props.updateGenuineCheck({ this.props.updateGenuineCheck({
displayErrorScreen: true, displayErrorScreen: true,
pinStepPass: false,
recoveryStepPass: false,
isGenuineFail: false,
isDeviceGenuine: false,
genuineCheckUnavailable: null,
}) })
} }
} }
@ -137,7 +131,15 @@ class GenuineCheck extends PureComponent<StepProps, State> {
} }
redoGenuineCheck = () => { redoGenuineCheck = () => {
this.props.updateGenuineCheck({ displayErrorScreen: false }) this.setState(INITIAL_STATE)
this.props.updateGenuineCheck({
displayErrorScreen: false,
pinStepPass: false,
recoveryStepPass: false,
isGenuineFail: false,
isDeviceGenuine: false,
genuineCheckUnavailable: null,
})
} }
contactSupport = () => { contactSupport = () => {
@ -146,6 +148,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 +282,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}
/> />
)} )}

20
static/i18n/en/onboarding.yml

@ -107,18 +107,14 @@ genuineCheck:
genuineCheck: Check now genuineCheck: Check now
contactSupport: Contact us contactSupport: Contact us
errorPage: errorPage:
ledgerNano: title:
title: Oops, something went wrong... pinFailed: "Didn't choose your own PIN code?"
#PIN: Didn't choose your own PIN code? recoveryPhraseFailed: "Didn't save your own recovery phrase?"
#recoveryPhrase: Didn't save your own recovery phrase? isGenuineFail: Oops, your device does not seem genuine...
#Genuine: Oops, your device does not seem genuine... desc:
desc: Go back to the security checklist or request Ledger Support assistance pinFailed: Never use a device supplied with a PIN code. If your device was provided with a PIN code, please contact us.
#PIN: Never use a device supplied with a PIN code. If your device was provided with a PIN code, please contact us. recoveryPhraseFailed: Only save a recovery phrase that is displayed on your device. Please contact us in case of doubt. Otherwise, go back to the security checklist.
#recoveryPhrase: Only save a recovery phrase that is displayed on your device. Please contact us in case of doubt. Otherwise, go back to the security checklist. isGenuineFail: Your device did not pass the authenticity test required to connect to Ledger’s secure server. Please contact Ledger Support to get assistance.
#Genuine: Your device did not pass the authenticity test required to connect to Ledger’s secure server. Please contact Ledger Support to get assistance.
ledgerBlue:
title: Oops, something went wrong...
desc: Go back to the security checklist or request Ledger Support assistance
setPassword: setPassword:
title: Password lock (optional) title: Password lock (optional)
desc: Set a password to prevent unauthorized access to Ledger Live data stored on your computer, including account names, balances, transactions and public addresses. desc: Set a password to prevent unauthorized access to Ledger Live data stored on your computer, including account names, balances, transactions and public addresses.

Loading…
Cancel
Save