From 423794294977680346946968729d3db48804f09d Mon Sep 17 00:00:00 2001 From: meriadec Date: Sun, 24 Jun 2018 20:19:37 +0200 Subject: [PATCH] Use GenuineCheck in GenuineCheckModal --- src/components/GenuineCheckModal.js | 37 ++++++++ src/components/GenuineCheckModal/index.js | 90 ------------------- .../Onboarding/steps/GenuineCheck/index.js | 6 +- 3 files changed, 40 insertions(+), 93 deletions(-) create mode 100644 src/components/GenuineCheckModal.js delete mode 100644 src/components/GenuineCheckModal/index.js diff --git a/src/components/GenuineCheckModal.js b/src/components/GenuineCheckModal.js new file mode 100644 index 00000000..d36c46d7 --- /dev/null +++ b/src/components/GenuineCheckModal.js @@ -0,0 +1,37 @@ +// @flow + +import React, { PureComponent } from 'react' +import { translate } from 'react-i18next' + +import type { T } from 'types/common' + +import Modal, { ModalBody, ModalTitle, ModalContent } from 'components/base/Modal' +import GenuineCheck from 'components/GenuineCheck' + +type Props = { + t: T, + onSuccess: void => void, + onFail: void => void, + onUnavailable: Error => void, +} + +class GenuineCheckModal extends PureComponent { + renderBody = ({ onClose }) => { + const { t, onSuccess, onFail, onUnavailable } = this.props + return ( + + {t('app:genuinecheck.modal.title')} + + + + + ) + } + + render() { + const { t, ...props } = this.props + return + } +} + +export default translate()(GenuineCheckModal) diff --git a/src/components/GenuineCheckModal/index.js b/src/components/GenuineCheckModal/index.js deleted file mode 100644 index 8afe0b3b..00000000 --- a/src/components/GenuineCheckModal/index.js +++ /dev/null @@ -1,90 +0,0 @@ -// @flow - -import React, { PureComponent, Fragment } from 'react' -import { translate } from 'react-i18next' - -import type { T } from 'types/common' - -import Modal, { ModalBody, ModalTitle, ModalContent } from 'components/base/Modal' -import Workflow from 'components/Workflow' -import WorkflowDefault from 'components/Workflow/WorkflowDefault' - -type Props = { - t: T, - onGenuineCheckPass: () => void, - onGenuineCheckFailed: () => void, - onGenuineCheckUnavailable: Error => void, -} - -type State = {} - -class GenuineCheckStatus extends PureComponent<*> { - componentDidUpdate() { - this.sideEffect() - } - sideEffect() { - const { - isGenuine, - error, - onGenuineCheckPass, - onGenuineCheckFailed, - onGenuineCheckUnavailable, - } = this.props - if (isGenuine !== null) { - if (isGenuine) { - onGenuineCheckPass() - } else { - onGenuineCheckFailed() - } - } else if (error) { - onGenuineCheckUnavailable(error) - } - } - render() { - return null - } -} - -/* eslint-disable react/no-multi-comp */ -class GenuineCheck extends PureComponent { - renderBody = ({ onClose }) => { - const { t, onGenuineCheckPass, onGenuineCheckFailed, onGenuineCheckUnavailable } = this.props - - // TODO: use the real devices list. for now we force choosing only - // the current device because we don't handle multi device in MVP - - return ( - - {t('app:genuinecheck.modal.title')} - - ( - - - - - )} - /> - - - ) - } - - render() { - const { ...props } = this.props - return this.renderBody({ onClose })} /> - } -} - -export default translate()(GenuineCheck) diff --git a/src/components/Onboarding/steps/GenuineCheck/index.js b/src/components/Onboarding/steps/GenuineCheck/index.js index d00ce863..2516d65c 100644 --- a/src/components/Onboarding/steps/GenuineCheck/index.js +++ b/src/components/Onboarding/steps/GenuineCheck/index.js @@ -263,9 +263,9 @@ class GenuineCheck extends PureComponent { )