diff --git a/src/components/ReceiveBox.js b/src/components/ReceiveBox.js index 9e81c88c..23248a6a 100644 --- a/src/components/ReceiveBox.js +++ b/src/components/ReceiveBox.js @@ -10,6 +10,7 @@ import CopyToClipboard from 'components/base/CopyToClipboard' import Text from 'components/base/Text' type Props = { + amount?: string, address: string, } @@ -41,10 +42,10 @@ const Action = styled(Box).attrs({ } ` -const ReceiveBox = ({ address }: Props) => ( +const ReceiveBox = ({ amount, address }: Props) => ( - + {'Current address'} @@ -72,4 +73,8 @@ const ReceiveBox = ({ address }: Props) => ( ) +ReceiveBox.defaultProps = { + amount: undefined, +} + export default ReceiveBox diff --git a/src/components/modals/Receive.js b/src/components/modals/Receive.js index d94fb65a..6abc24cf 100644 --- a/src/components/modals/Receive.js +++ b/src/components/modals/Receive.js @@ -1,14 +1,19 @@ // @flow -import React, { PureComponent } from 'react' +import React, { PureComponent, Fragment } from 'react' import { translate } from 'react-i18next' import get from 'lodash/get' import { MODAL_RECEIVE } from 'constants' +import Box from 'components/base/Box' +import Button from 'components/base/Button' +import Input from 'components/base/Input' +import Label from 'components/base/Label' import Modal, { ModalBody } from 'components/base/Modal' -import Text from 'components/base/Text' +import ReceiveBox from 'components/ReceiveBox' import SelectAccount from 'components/SelectAccount' +import Text from 'components/base/Text' import type { Account as AccountType, T } from 'types/common' @@ -18,10 +23,12 @@ type Props = { type State = { account: AccountType | null, + amount: string, } const defaultState = { account: null, + amount: '', } class ReceiveModal extends PureComponent { @@ -29,34 +36,64 @@ class ReceiveModal extends PureComponent { ...defaultState, } - handleChangeAccount = account => { - this.setState({ account }) + getAccount(data) { + const { account } = this.state + + return account || get(data, 'account') } + handleChangeInput = key => value => + this.setState({ + [key]: value, + }) + handleClose = () => this.setState({ ...defaultState, }) render() { - const { account } = this.state + const { amount } = this.state const { t } = this.props return ( ( - - - {t('receive.modalTitle')} - - - - )} + render={({ data, onClose }) => { + const account = this.getAccount(data) + return ( + + + {t('receive.modalTitle')} + + + + + + {account && + account.data && ( + + + + + + + + )} + + + + + ) + }} /> ) }