aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/send/send-content/send-to-row/send-to-row.component.js
diff options
context:
space:
mode:
authorbrunobar79 <brunobar79@gmail.com>2018-07-17 00:55:13 +0800
committerbrunobar79 <brunobar79@gmail.com>2018-07-17 00:55:13 +0800
commitd05814a5ad375f21a0b3d72de1815764eb1da5a4 (patch)
tree50315015995fac6ab84f00e479d61710859ddb42 /ui/app/components/send/send-content/send-to-row/send-to-row.component.js
parent7f29b46d32b590ebc34c6f86360ef34e8bbb75fe (diff)
parentdb4469794e3e843f3cb08222d0a9b568c7816a85 (diff)
downloadtangerine-wallet-browser-d05814a5ad375f21a0b3d72de1815764eb1da5a4.tar
tangerine-wallet-browser-d05814a5ad375f21a0b3d72de1815764eb1da5a4.tar.gz
tangerine-wallet-browser-d05814a5ad375f21a0b3d72de1815764eb1da5a4.tar.bz2
tangerine-wallet-browser-d05814a5ad375f21a0b3d72de1815764eb1da5a4.tar.lz
tangerine-wallet-browser-d05814a5ad375f21a0b3d72de1815764eb1da5a4.tar.xz
tangerine-wallet-browser-d05814a5ad375f21a0b3d72de1815764eb1da5a4.tar.zst
tangerine-wallet-browser-d05814a5ad375f21a0b3d72de1815764eb1da5a4.zip
Merge branch 'develop' into initial-trezor-support
Diffstat (limited to 'ui/app/components/send/send-content/send-to-row/send-to-row.component.js')
-rw-r--r--ui/app/components/send/send-content/send-to-row/send-to-row.component.js69
1 files changed, 69 insertions, 0 deletions
diff --git a/ui/app/components/send/send-content/send-to-row/send-to-row.component.js b/ui/app/components/send/send-content/send-to-row/send-to-row.component.js
new file mode 100644
index 000000000..892ad5d67
--- /dev/null
+++ b/ui/app/components/send/send-content/send-to-row/send-to-row.component.js
@@ -0,0 +1,69 @@
+import React, { Component } from 'react'
+import PropTypes from 'prop-types'
+import SendRowWrapper from '../send-row-wrapper/'
+import EnsInput from '../../../ens-input'
+import { getToErrorObject } from './send-to-row.utils.js'
+
+export default class SendToRow extends Component {
+
+ static propTypes = {
+ closeToDropdown: PropTypes.func,
+ inError: PropTypes.bool,
+ network: PropTypes.string,
+ openToDropdown: PropTypes.func,
+ to: PropTypes.string,
+ toAccounts: PropTypes.array,
+ toDropdownOpen: PropTypes.bool,
+ updateGas: PropTypes.func,
+ updateSendTo: PropTypes.func,
+ updateSendToError: PropTypes.func,
+ };
+
+ static contextTypes = {
+ t: PropTypes.func,
+ };
+
+ handleToChange (to, nickname = '', toError) {
+ const { updateSendTo, updateSendToError, updateGas } = this.props
+ const toErrorObject = getToErrorObject(to, toError)
+ updateSendTo(to, nickname)
+ updateSendToError(toErrorObject)
+ if (toErrorObject.to === null) {
+ updateGas({ to })
+ }
+ }
+
+ render () {
+ const {
+ closeToDropdown,
+ inError,
+ network,
+ openToDropdown,
+ to,
+ toAccounts,
+ toDropdownOpen,
+ } = this.props
+
+ return (
+ <SendRowWrapper
+ errorType={'to'}
+ label={`${this.context.t('to')}`}
+ showError={inError}
+ >
+ <EnsInput
+ accounts={toAccounts}
+ closeDropdown={() => closeToDropdown()}
+ dropdownOpen={toDropdownOpen}
+ inError={inError}
+ name={'address'}
+ network={network}
+ onChange={({ toAddress, nickname, toError }) => this.handleToChange(toAddress, nickname, toError)}
+ openDropdown={() => openToDropdown()}
+ placeholder={this.context.t('recipientAddress')}
+ to={to}
+ />
+ </SendRowWrapper>
+ )
+ }
+
+}