From 9ea7411c063712825780110c10252155ccb61e44 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Mon, 16 Jul 2018 20:13:32 -0230 Subject: [PATCH] Hook up send component w/ UPDATE_SEND_HEX_DATA action --- .../send-content/send-hex-data-row/index.js | 2 +- .../send-hex-data-row.component.js | 10 +++++---- .../send-hex-data-row.container.js | 21 +++++++++++++++++++ 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/ui/app/components/send/send-content/send-hex-data-row/index.js b/ui/app/components/send/send-content/send-hex-data-row/index.js index 4371ef83d..08c341067 100644 --- a/ui/app/components/send/send-content/send-hex-data-row/index.js +++ b/ui/app/components/send/send-content/send-hex-data-row/index.js @@ -1 +1 @@ -export { default } from './send-hex-data-row.component' +export { default } from './send-hex-data-row.container' diff --git a/ui/app/components/send/send-content/send-hex-data-row/send-hex-data-row.component.js b/ui/app/components/send/send-content/send-hex-data-row/send-hex-data-row.component.js index eaffce359..18d955c72 100644 --- a/ui/app/components/send/send-content/send-hex-data-row/send-hex-data-row.component.js +++ b/ui/app/components/send/send-content/send-hex-data-row/send-hex-data-row.component.js @@ -6,6 +6,7 @@ export default class SendHexDataRow extends Component { static propTypes = { data: PropTypes.string, inError: PropTypes.bool, + updateSendHexData: PropTypes.func.isRequired, }; static contextTypes = { @@ -13,17 +14,18 @@ export default class SendHexDataRow extends Component { }; onInput = (event) => { + const {updateSendHexData} = this.props event.target.value = event.target.value.replace(/\n/g, '') + updateSendHexData(event.target.value) } render () { - const { - inError, - } = this.props + const {inError} = this.props + const {t} = this.context return ( diff --git a/ui/app/components/send/send-content/send-hex-data-row/send-hex-data-row.container.js b/ui/app/components/send/send-content/send-hex-data-row/send-hex-data-row.container.js index e69de29bb..df554ca5f 100644 --- a/ui/app/components/send/send-content/send-hex-data-row/send-hex-data-row.container.js +++ b/ui/app/components/send/send-content/send-hex-data-row/send-hex-data-row.container.js @@ -0,0 +1,21 @@ +import { connect } from 'react-redux' +import { + updateSendHexData, +} from '../../../../actions' +import SendHexDataRow from './send-hex-data-row.component' + +export default connect(mapStateToProps, mapDispatchToProps)(SendHexDataRow) + +function mapStateToProps (state) { + return { + data: state.metamask.send.data, + } +} + +function mapDispatchToProps (dispatch) { + return { + updateSendHexData (data) { + return dispatch(updateSendHexData(data)) + }, + } +}