1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 03:20:23 +01:00
metamask-extension/ui/app/pages/send/send-content/send-content.component.js
Erik Marks 76a2a9bb8b
@metamask/eslint config@5.0.0 (#10358)
* @metamask/eslint-config@5.0.0
* Update eslintrc and prettierrc
* yarn lint:fix
2021-02-04 10:15:23 -08:00

78 lines
1.9 KiB
JavaScript

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import PageContainerContent from '../../../components/ui/page-container/page-container-content.component';
import Dialog from '../../../components/ui/dialog';
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';
export default class SendContent extends Component {
static contextTypes = {
t: PropTypes.func,
};
static propTypes = {
updateGas: PropTypes.func,
showAddToAddressBookModal: PropTypes.func,
showHexData: PropTypes.bool,
contact: PropTypes.object,
isOwnedAccount: PropTypes.bool,
warning: PropTypes.string,
};
updateGas = (updateData) => this.props.updateGas(updateData);
render() {
const { warning } = this.props;
return (
<PageContainerContent>
<div className="send-v2__form">
{warning && this.renderWarning()}
{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 null;
}
return (
<Dialog
type="message"
className="send__dialog"
onClick={showAddToAddressBookModal}
>
{t('newAccountDetectedDialogMessage')}
</Dialog>
);
}
renderWarning() {
const { t } = this.context;
const { warning } = this.props;
return (
<Dialog type="warning" className="send__error-dialog">
{t(warning)}
</Dialog>
);
}
}