aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/pages/confirm-send-ether/confirm-send-ether.component.js
blob: 68280f62452f7ddc90e15213c0e52d7bfdc0a170 (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
        actionKey={'confirm'}
        hideData={hideData}
        onEdit={confirmTransactionData => this.handleEdit(confirmTransactionData)}
      />
    )
  }
}