A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
ciphermask/ui/app/pages/send/send-content/send-content.component.js

68 lines
1.9 KiB

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,
to: PropTypes.string,
ownedAccounts: PropTypes.array,
addressBook: PropTypes.array,
}
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 { to, addressBook = [], ownedAccounts = [], showAddToAddressBookModal } = this.props
const isOwnedAccount = !!ownedAccounts.find(({ address }) => address === to)
const contact = addressBook.find(({ address }) => address === to) || {}
if (isOwnedAccount || contact.name) {
return
}
return (
<Dialog
type="message"
className="send__dialog"
onClick={showAddToAddressBookModal}
>
{t('newAccountDetectedDialogMessage')}
</Dialog>
)
}
}