1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Hook up send component w/ UPDATE_SEND_HEX_DATA action

This commit is contained in:
Whymarrh Whitby 2018-07-16 20:13:32 -02:30
parent 25417fad26
commit 9ea7411c06
3 changed files with 28 additions and 5 deletions

View File

@ -1 +1 @@
export { default } from './send-hex-data-row.component'
export { default } from './send-hex-data-row.container'

View File

@ -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 (
<SendRowWrapper
label={`${this.context.t('hexData')}:`}
label={`${t('hexData')}:`}
showError={inError}
errorType={'amount'}
>

View File

@ -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))
},
}
}