2018-04-11 16:21:54 +02:00
|
|
|
import React, { Component } from 'react'
|
2018-05-23 18:43:25 +02:00
|
|
|
import PropTypes from 'prop-types'
|
2019-04-17 21:15:13 +02:00
|
|
|
import PageContainerContent from '../../../components/ui/page-container/page-container-content.component'
|
2020-08-18 21:18:25 +02:00
|
|
|
import Dialog from '../../../components/ui/dialog'
|
2019-03-22 00:03:30 +01:00
|
|
|
import SendAmountRow from './send-amount-row'
|
|
|
|
import SendGasRow from './send-gas-row'
|
2018-07-16 22:51:02 +02:00
|
|
|
import SendHexDataRow from './send-hex-data-row'
|
2019-04-17 21:15:13 +02:00
|
|
|
import SendAssetRow from './send-asset-row'
|
2018-04-11 16:21:54 +02:00
|
|
|
|
|
|
|
export default class SendContent extends Component {
|
|
|
|
|
2019-07-31 21:56:44 +02:00
|
|
|
static contextTypes = {
|
|
|
|
t: PropTypes.func,
|
|
|
|
}
|
|
|
|
|
2018-05-23 18:43:25 +02:00
|
|
|
static propTypes = {
|
|
|
|
updateGas: PropTypes.func,
|
2019-07-31 21:56:44 +02:00
|
|
|
showAddToAddressBookModal: PropTypes.func,
|
2018-08-16 09:43:13 +02:00
|
|
|
showHexData: PropTypes.bool,
|
2019-08-14 01:13:05 +02:00
|
|
|
contact: PropTypes.object,
|
|
|
|
isOwnedAccount: PropTypes.bool,
|
2020-08-28 17:27:07 +02:00
|
|
|
warning: PropTypes.string,
|
2018-12-14 03:19:36 +01:00
|
|
|
}
|
2018-05-23 18:43:25 +02:00
|
|
|
|
2018-09-27 15:46:24 +02:00
|
|
|
updateGas = (updateData) => this.props.updateGas(updateData)
|
|
|
|
|
2018-04-11 16:21:54 +02:00
|
|
|
render () {
|
2020-08-28 17:27:07 +02:00
|
|
|
const { warning } = this.props
|
2018-04-11 16:21:54 +02:00
|
|
|
return (
|
|
|
|
<PageContainerContent>
|
2018-04-30 18:09:05 +02:00
|
|
|
<div className="send-v2__form">
|
2020-08-28 17:27:07 +02:00
|
|
|
{ warning && this.renderWarning() }
|
2019-07-31 21:56:44 +02:00
|
|
|
{ this.maybeRenderAddContact() }
|
2019-04-17 21:15:13 +02:00
|
|
|
<SendAssetRow />
|
2018-09-27 15:46:24 +02:00
|
|
|
<SendAmountRow updateGas={this.updateGas} />
|
2018-04-11 16:21:54 +02:00
|
|
|
<SendGasRow />
|
2019-07-31 21:56:44 +02:00
|
|
|
{
|
|
|
|
this.props.showHexData && (
|
|
|
|
<SendHexDataRow
|
|
|
|
updateGas={this.updateGas}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|
2018-04-11 16:21:54 +02:00
|
|
|
</div>
|
|
|
|
</PageContainerContent>
|
2018-04-27 02:38:14 +02:00
|
|
|
)
|
2018-04-11 16:21:54 +02:00
|
|
|
}
|
|
|
|
|
2019-07-31 21:56:44 +02:00
|
|
|
maybeRenderAddContact () {
|
|
|
|
const { t } = this.context
|
2019-08-14 01:13:05 +02:00
|
|
|
const { isOwnedAccount, showAddToAddressBookModal, contact = {} } = this.props
|
2019-07-31 21:56:44 +02:00
|
|
|
|
|
|
|
if (isOwnedAccount || contact.name) {
|
2020-08-12 21:06:57 +02:00
|
|
|
return null
|
2019-07-31 21:56:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Dialog
|
|
|
|
type="message"
|
|
|
|
className="send__dialog"
|
|
|
|
onClick={showAddToAddressBookModal}
|
|
|
|
>
|
|
|
|
{t('newAccountDetectedDialogMessage')}
|
|
|
|
</Dialog>
|
|
|
|
)
|
|
|
|
}
|
2020-08-28 17:27:07 +02:00
|
|
|
|
|
|
|
renderWarning () {
|
|
|
|
const { t } = this.context
|
|
|
|
const { warning } = this.props
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Dialog
|
|
|
|
type="warning"
|
|
|
|
className="send__error-dialog"
|
|
|
|
>
|
|
|
|
{t(warning)}
|
|
|
|
</Dialog>
|
|
|
|
)
|
|
|
|
}
|
2018-04-11 16:21:54 +02:00
|
|
|
}
|