aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/pages/confirm-send-ether/confirm-send-ether.component.js
blob: 8daad675e79405137433c18f0e38283107a278d8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import ConfirmTransactionBase from '../confirm-transaction-base'
import { SEND_ROUTE } from '../../helpers/constants/routes'

export default class ConfirmSendEther extends Component {
  static contextTypes = {
    t: PropTypes.func,
  }

  static propTypes = {
    editTransaction: PropTypes.func,
    history: PropTypes.object,
    txParams: PropTypes.object,
  }

  handleEdit ({ txData }) {
    const { editTransaction, history } = this.props
    editTransaction(txData)
    history.push(SEND_ROUTE)
  }

  shouldHideData () {
    const { txParams = {} } = this.props
    return !txParams.data
  }

  render () {
    const hideData = this.shouldHideData()

    return (
      <ConfirmTransactionBase
        action={this.context.t('confirm')}
        hideData={hideData}
        onEdit={confirmTransactionData => this.handleEdit(confirmTransactionData)}
      />
    )
  }
}