Browse Source

Merge pull request #613 from meriadec/onboarding-polishes

Onboarding polishes
master
Gaëtan Renaudeau 7 years ago
committed by GitHub
parent
commit
2ac06e9bf2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/components/GenuineCheckModal/index.js
  2. 3
      src/components/Onboarding/helperComponents.js
  3. 6
      src/components/Onboarding/steps/Analytics.js
  4. 34
      src/components/Onboarding/steps/GenuineCheck.js
  5. 6
      src/components/Onboarding/steps/SelectDevice.js
  6. 5
      src/components/Onboarding/steps/SetPassword.js
  7. 7
      src/components/Workflow/EnsureGenuine.js
  8. 7
      src/components/base/FakeLink.js
  9. 1
      static/i18n/en/onboarding.yml

5
src/components/GenuineCheckModal/index.js

@ -19,9 +19,6 @@ type Props = {
type State = {} type State = {}
class GenuineCheckStatus extends PureComponent<*> { class GenuineCheckStatus extends PureComponent<*> {
componentDidMount() {
this.sideEffect()
}
componentDidUpdate() { componentDidUpdate() {
this.sideEffect() this.sideEffect()
} }
@ -33,7 +30,7 @@ class GenuineCheckStatus extends PureComponent<*> {
onGenuineCheckFailed, onGenuineCheckFailed,
onGenuineCheckUnavailable, onGenuineCheckUnavailable,
} = this.props } = this.props
if (isGenuine !== undefined) { if (isGenuine !== null) {
if (isGenuine) { if (isGenuine) {
onGenuineCheckPass() onGenuineCheckPass()
} else { } else {

3
src/components/Onboarding/helperComponents.js

@ -4,6 +4,7 @@ import styled from 'styled-components'
import { radii } from 'styles/theme' import { radii } from 'styles/theme'
import Box from 'components/base/Box' import Box from 'components/base/Box'
import GrowScroll from 'components/base/GrowScroll'
import IconSensitiveOperationShield from 'icons/illustrations/SensitiveOperationShield' import IconSensitiveOperationShield from 'icons/illustrations/SensitiveOperationShield'
// GENERAL // GENERAL
@ -16,6 +17,8 @@ export const Title = styled(Box).attrs({
text-align: center; text-align: center;
` `
export const StepContainerInner = styled(GrowScroll).attrs({ pb: 6, align: 'center' })``
export const Description = styled(Box).attrs({ export const Description = styled(Box).attrs({
ff: 'Museo Sans|Light', ff: 'Museo Sans|Light',
fontSize: 5, fontSize: 5,

6
src/components/Onboarding/steps/Analytics.js

@ -6,7 +6,7 @@ import { connect } from 'react-redux'
import { saveSettings } from 'actions/settings' import { saveSettings } from 'actions/settings'
import Box from 'components/base/Box' import Box from 'components/base/Box'
import CheckBox from 'components/base/CheckBox' import CheckBox from 'components/base/CheckBox'
import { Title, Description, FixedTopContainer } from '../helperComponents' import { Title, Description, FixedTopContainer, StepContainerInner } from '../helperComponents'
import OnboardingFooter from '../OnboardingFooter' import OnboardingFooter from '../OnboardingFooter'
import type { StepProps } from '..' import type { StepProps } from '..'
@ -51,7 +51,7 @@ class Analytics extends PureComponent<StepProps, State> {
return ( return (
<FixedTopContainer> <FixedTopContainer>
<Box grow alignItems="center"> <StepContainerInner>
<Title>{t('onboarding:analytics.title')}</Title> <Title>{t('onboarding:analytics.title')}</Title>
<Description>{t('onboarding:analytics.desc')}</Description> <Description>{t('onboarding:analytics.desc')}</Description>
<Box mt={5}> <Box mt={5}>
@ -74,7 +74,7 @@ class Analytics extends PureComponent<StepProps, State> {
</Box> </Box>
</Container> </Container>
</Box> </Box>
</Box> </StepContainerInner>
<OnboardingFooter <OnboardingFooter
horizontal horizontal
align="center" align="center"

34
src/components/Onboarding/steps/GenuineCheck.js

@ -11,6 +11,7 @@ import type { T } from 'types/common'
import { updateGenuineCheck } from 'reducers/onboarding' import { updateGenuineCheck } from 'reducers/onboarding'
import Box from 'components/base/Box' import Box from 'components/base/Box'
import FakeLink from 'components/base/FakeLink'
import Button from 'components/base/Button' import Button from 'components/base/Button'
import RadioGroup from 'components/base/RadioGroup' import RadioGroup from 'components/base/RadioGroup'
import GenuineCheckModal from 'components/GenuineCheckModal' import GenuineCheckModal from 'components/GenuineCheckModal'
@ -18,12 +19,14 @@ import GenuineCheckModal from 'components/GenuineCheckModal'
import IconLedgerNanoError from 'icons/illustrations/LedgerNanoError' import IconLedgerNanoError from 'icons/illustrations/LedgerNanoError'
import IconLedgerBlueError from 'icons/illustrations/LedgerBlueError' import IconLedgerBlueError from 'icons/illustrations/LedgerBlueError'
import IconCheck from 'icons/Check' import IconCheck from 'icons/Check'
import IconCross from 'icons/Cross'
import { import {
Title, Title,
Description, Description,
IconOptionRow, IconOptionRow,
FixedTopContainer, FixedTopContainer,
StepContainerInner,
OnboardingFooterWrapper, OnboardingFooterWrapper,
} from '../helperComponents' } from '../helperComponents'
@ -88,7 +91,15 @@ class GenuineCheck extends PureComponent<StepProps, State> {
handleOpenGenuineCheckModal = () => this.setState({ isGenuineCheckModalOpened: true }) handleOpenGenuineCheckModal = () => this.setState({ isGenuineCheckModalOpened: true })
handleCloseGenuineCheckModal = (cb?: Function) => handleCloseGenuineCheckModal = (cb?: Function) =>
this.setState(state => ({ ...state, isGenuineCheckModalOpened: false }), () => cb && cb()) this.setState(
state => ({ ...state, isGenuineCheckModalOpened: false }),
() => {
// FIXME: meh
if (cb && typeof cb === 'function') {
cb()
}
},
)
handleGenuineCheckPass = () => { handleGenuineCheckPass = () => {
this.handleCloseGenuineCheckModal(() => { this.handleCloseGenuineCheckModal(() => {
@ -101,6 +112,7 @@ class GenuineCheck extends PureComponent<StepProps, State> {
handleGenuineCheckFailed = () => { handleGenuineCheckFailed = () => {
this.handleCloseGenuineCheckModal(() => { this.handleCloseGenuineCheckModal(() => {
this.props.updateGenuineCheck({ this.props.updateGenuineCheck({
isGenuineFail: true,
isDeviceGenuine: false, isDeviceGenuine: false,
genuineCheckUnavailable: null, genuineCheckUnavailable: null,
}) })
@ -146,7 +158,7 @@ class GenuineCheck extends PureComponent<StepProps, State> {
return ( return (
<FixedTopContainer> <FixedTopContainer>
<Box grow alignItems="center"> <StepContainerInner>
<Title>{t('onboarding:genuineCheck.title')}</Title> <Title>{t('onboarding:genuineCheck.title')}</Title>
{onboarding.isLedgerNano ? ( {onboarding.isLedgerNano ? (
<Description>{t('onboarding:genuineCheck.descNano')}</Description> <Description>{t('onboarding:genuineCheck.descNano')}</Description>
@ -211,6 +223,20 @@ class GenuineCheck extends PureComponent<StepProps, State> {
{t('onboarding:genuineCheck.isGenuinePassed')} {t('onboarding:genuineCheck.isGenuinePassed')}
</GenuineSuccessText> </GenuineSuccessText>
</Box> </Box>
) : genuine.genuineCheckUnavailable ? (
<Box horizontal align="center" flow={1} color={colors.alertRed}>
<IconCross size={16} />
<Box ff="Open Sans|Regular" fontSize={4}>
{t('onboarding:genuineCheck.isGenuineUnavailable')}
<FakeLink
color="alertRed"
underline
onClick={this.handleOpenGenuineCheckModal}
>
{t('app:common.retry')}
</FakeLink>
</Box>
</Box>
) : ( ) : (
<Button <Button
primary primary
@ -224,7 +250,7 @@ class GenuineCheck extends PureComponent<StepProps, State> {
)} )}
</CardWrapper> </CardWrapper>
</Box> </Box>
</Box> </StepContainerInner>
<OnboardingFooter <OnboardingFooter
horizontal horizontal
align="center" align="center"
@ -301,6 +327,7 @@ export const GenuineSuccessText = styled(Box).attrs({
ff: 'Open Sans|Regular', ff: 'Open Sans|Regular',
fontSize: 4, fontSize: 4,
})`` })``
export const CardTitle = styled(Box).attrs({ export const CardTitle = styled(Box).attrs({
ff: 'Open Sans|SemiBold', ff: 'Open Sans|SemiBold',
fontSize: 4, fontSize: 4,
@ -323,7 +350,6 @@ const CardWrapper = styled(Box).attrs({
background-color: ${p => (p.isDisabled ? p.theme.colors.lightGrey : p.theme.colors.white)}; background-color: ${p => (p.isDisabled ? p.theme.colors.lightGrey : p.theme.colors.white)};
opacity: ${p => (p.isDisabled ? 0.7 : 1)}; opacity: ${p => (p.isDisabled ? 0.7 : 1)};
&:hover { &:hover {
cursor: pointer;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.05); box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.05);
} }
` `

6
src/components/Onboarding/steps/SelectDevice.js

@ -11,7 +11,7 @@ import Box from 'components/base/Box'
import IconCheckCirle from 'icons/Check' import IconCheckCirle from 'icons/Check'
import IconLedgerNano from 'icons/illustrations/LedgerNano' import IconLedgerNano from 'icons/illustrations/LedgerNano'
import IconLedgerBlue from 'icons/illustrations/LedgerBlue' import IconLedgerBlue from 'icons/illustrations/LedgerBlue'
import { Title, Inner, FixedTopContainer } from '../helperComponents' import { Title, Inner, FixedTopContainer, StepContainerInner } from '../helperComponents'
import OnboardingFooter from '../OnboardingFooter' import OnboardingFooter from '../OnboardingFooter'
import type { StepProps } from '..' import type { StepProps } from '..'
@ -35,7 +35,7 @@ class SelectDevice extends PureComponent<StepProps, {}> {
const { t, onboarding, jumpStep } = this.props const { t, onboarding, jumpStep } = this.props
return ( return (
<FixedTopContainer> <FixedTopContainer>
<Box grow alignItems="center"> <StepContainerInner>
<Box mb={5}> <Box mb={5}>
<Title>{t('onboarding:selectDevice.title')}</Title> <Title>{t('onboarding:selectDevice.title')}</Title>
</Box> </Box>
@ -63,7 +63,7 @@ class SelectDevice extends PureComponent<StepProps, {}> {
</DeviceContainer> </DeviceContainer>
</Inner> </Inner>
</Box> </Box>
</Box> </StepContainerInner>
<OnboardingFooter <OnboardingFooter
horizontal horizontal
t={t} t={t}

5
src/components/Onboarding/steps/SetPassword.js

@ -20,6 +20,7 @@ import {
DisclaimerBox, DisclaimerBox,
FixedTopContainer, FixedTopContainer,
OnboardingFooterWrapper, OnboardingFooterWrapper,
StepContainerInner,
} from '../helperComponents' } from '../helperComponents'
type State = { type State = {
@ -96,7 +97,7 @@ class SetPassword extends PureComponent<StepProps, State> {
return ( return (
<FixedTopContainer> <FixedTopContainer>
<Box grow alignItems="center"> <StepContainerInner>
<Fragment> <Fragment>
<Box alignItems="center"> <Box alignItems="center">
<Title>{t('onboarding:setPassword.title')}</Title> <Title>{t('onboarding:setPassword.title')}</Title>
@ -120,7 +121,7 @@ class SetPassword extends PureComponent<StepProps, State> {
<DisclaimerBox mt={7} disclaimerNotes={disclaimerNotes} /> <DisclaimerBox mt={7} disclaimerNotes={disclaimerNotes} />
</Box> </Box>
</Fragment> </Fragment>
</Box> </StepContainerInner>
<OnboardingFooterWrapper> <OnboardingFooterWrapper>
<Button padded outlineGrey onClick={() => prevStep()}> <Button padded outlineGrey onClick={() => prevStep()}>

7
src/components/Workflow/EnsureGenuine.js

@ -61,13 +61,14 @@ class EnsureGenuine extends PureComponent<Props, State> {
const res = await getIsGenuine const res = await getIsGenuine
.send({ devicePath: device.path, targetId: infos.targetId }) .send({ devicePath: device.path, targetId: infos.targetId })
.toPromise() .toPromise()
if (this._unmounting) return
const isGenuine = res === '0000' const isGenuine = res === '0000'
if ((!this.state.genuine || this.state.error) && isGenuine) { if (!this.state.genuine || this.state.error) {
!this._unmounting && this.setState({ genuine: isGenuine, error: null }) this.setState({ genuine: isGenuine, error: null })
} }
} catch (err) { } catch (err) {
if (!isEqual(this.state.error, err)) { if (!isEqual(this.state.error, err)) {
!this._unmounting && this.setState({ genuine: false, error: err }) this.setState({ genuine: null, error: err })
} }
} }
this._checking = false this._checking = false

7
src/components/base/FakeLink.js

@ -5,14 +5,15 @@ import { darken, lighten } from 'styles/helpers'
export default styled(Box).attrs({ export default styled(Box).attrs({
cursor: 'pointer', cursor: 'pointer',
color: 'wallet', color: p => p.color || 'wallet',
})` })`
text-decoration: ${p => (p.underline ? 'underline' : 'none')};
&:hover { &:hover {
text-decoration: underline; text-decoration: underline;
color: ${p => lighten(p.theme.colors.wallet, 0.05)}; color: ${p => lighten(p.theme.colors[p.color] || p.color || p.theme.colors.wallet, 0.05)};
} }
&:active { &:active {
color: ${p => darken(p.theme.colors.wallet, 0.1)}; color: ${p => darken(p.theme.colors[p.color] || p.color || p.theme.colors.wallet, 0.1)};
} }
` `

1
static/i18n/en/onboarding.yml

@ -87,6 +87,7 @@ genuineCheck:
title: Check if your Ledger device is genuine title: Check if your Ledger device is genuine
desc: This is a long text, please replace it with the final wording once it’s done. Lorem ipsum dolor amet ledger lorem dolor desc: This is a long text, please replace it with the final wording once it’s done. Lorem ipsum dolor amet ledger lorem dolor
isGenuinePassed: Your Nano S is genuine isGenuinePassed: Your Nano S is genuine
isGenuineUnavailable: Server problem
buttons: buttons:
genuineCheck: Genuine check genuineCheck: Genuine check
contactSupport: Contact Support contactSupport: Contact Support

Loading…
Cancel
Save