From 476b6456e2965dfe88b165cc1b34b6ca291e8aab Mon Sep 17 00:00:00 2001 From: Thibaut Boustany Date: Fri, 27 Apr 2018 16:12:16 +0200 Subject: [PATCH] [WIP] Send funds --- .../modals/Send/03-step-verification.js | 19 +++++++++++++++-- src/components/modals/Send/index.js | 21 ++++++++++++++++--- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/components/modals/Send/03-step-verification.js b/src/components/modals/Send/03-step-verification.js index 674c4d0e..d1cf93fb 100644 --- a/src/components/modals/Send/03-step-verification.js +++ b/src/components/modals/Send/03-step-verification.js @@ -6,9 +6,11 @@ import uniqueId from 'lodash/uniqueId' import Box from 'components/base/Box' import WarnBox from 'components/WarnBox' +import DeviceCheckAddress from 'components/DeviceCheckAddress' import DeviceConfirm from 'components/DeviceConfirm' -import type { T } from 'types/common' +import type { Account } from '@ledgerhq/wallet-common/lib/types' +import type { Device, T } from 'types/common' const Container = styled(Box).attrs({ alignItems: 'center', @@ -27,6 +29,9 @@ const Info = styled(Box).attrs({ ` type Props = { + account: ?Account, + device: ?Device, + onValidate: Function, t: T, } @@ -39,6 +44,16 @@ export default (props: Props) => ( .map(line =>

{line}

)} {props.t('send:steps.verification.body')} - + {// TODO: Actually create a tx + // DeviceCheckAddress used as a placeholder in the meantime + props.account && + props.device && ( + } + /> + )} ) diff --git a/src/components/modals/Send/index.js b/src/components/modals/Send/index.js index b90a839a..f7fa32ae 100644 --- a/src/components/modals/Send/index.js +++ b/src/components/modals/Send/index.js @@ -37,6 +37,7 @@ type State = { fees: number, isRBF: boolean, recipientAddress: string, + txValidated: null | boolean, stepIndex: number, } @@ -59,6 +60,7 @@ const INITIAL_STATE = { fees: 0, isRBF: false, recipientAddress: '', + txValidated: null, stepIndex: 0, } @@ -136,6 +138,16 @@ class SendModal extends PureComponent { }) } + handleValidate = isValidated => { + this.setState({ + txValidated: isValidated, + }) + + if (isValidated === true) { + this.handleNextStep() + } + } + createChangeHandler = key => value => { const patch = { [key]: value } // ensure max is always restecped when changing fees @@ -158,7 +170,7 @@ class SendModal extends PureComponent { renderStep = () => { const { t } = this.props - const { stepIndex, amount, deviceSelected, ...otherState } = this.state + const { stepIndex, deviceSelected, txValidated, ...otherState } = this.state const step = this._steps[stepIndex] if (!step) { return null @@ -170,7 +182,6 @@ class SendModal extends PureComponent { const stepProps = { ...otherState, t, - amount, account: this._account, ...props(stepIndex === 1, { accountName: this._account ? this._account.name : undefined, @@ -178,9 +189,13 @@ class SendModal extends PureComponent { onChangeDevice: this.handleChangeDevice, onStatusChange: this.handleChangeStatus, }), + ...props(stepIndex === 2, { + device: deviceSelected, + onValidate: this.handleValidate, + }), } - return + return } render() {