1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-25 21:00:23 +02:00
metamask-extension/ui/app/pages/send/send-content/send-content.component.js
Dan J Miller 043920c9ff
Address book fixes (#6978)
* Ensure address book send flow correctly matches address book addresses to ens addresses

* Use nodify on background.setAddressBook to receive correct result in actions.js

* Better error handling for actions.js addToAddressBook

* Eliminate unnecessary data normalization and move more data manipluation to ens-input and send-content containers
2019-08-13 20:43:05 -02:30

68 lines
1.7 KiB
JavaScript

import React, { Component } from 'react'
import PropTypes from 'prop-types'
import PageContainerContent from '../../../components/ui/page-container/page-container-content.component'
import SendAmountRow from './send-amount-row'
import SendGasRow from './send-gas-row'
import SendHexDataRow from './send-hex-data-row'
import SendAssetRow from './send-asset-row'
import Dialog from '../../../components/ui/dialog'
export default class SendContent extends Component {
static contextTypes = {
t: PropTypes.func,
}
static propTypes = {
updateGas: PropTypes.func,
scanQrCode: PropTypes.func,
showAddToAddressBookModal: PropTypes.func,
showHexData: PropTypes.bool,
ownedAccounts: PropTypes.array,
addressBook: PropTypes.array,
contact: PropTypes.object,
isOwnedAccount: PropTypes.bool,
}
updateGas = (updateData) => this.props.updateGas(updateData)
render () {
return (
<PageContainerContent>
<div className="send-v2__form">
{ this.maybeRenderAddContact() }
<SendAssetRow />
<SendAmountRow updateGas={this.updateGas} />
<SendGasRow />
{
this.props.showHexData && (
<SendHexDataRow
updateGas={this.updateGas}
/>
)
}
</div>
</PageContainerContent>
)
}
maybeRenderAddContact () {
const { t } = this.context
const { isOwnedAccount, showAddToAddressBookModal, contact = {} } = this.props
if (isOwnedAccount || contact.name) {
return
}
return (
<Dialog
type="message"
className="send__dialog"
onClick={showAddToAddressBookModal}
>
{t('newAccountDetectedDialogMessage')}
</Dialog>
)
}
}