1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Use variable to check if should display dialog and display dialog

inline.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
This commit is contained in:
Akintayo A. Olusegun 2021-09-08 02:40:47 +04:00
parent 409bb00748
commit 1ad80f0ae8

View File

@ -71,25 +71,6 @@ export default class ConfirmPageContainer extends Component {
contact: PropTypes.object,
};
maybeRenderAddContact() {
const { t } = this.context;
const { showAddToAddressBookModal, toAddress, contact = {} } = this.props;
if (contact.name || toAddress === undefined) {
return null;
}
return (
<Dialog
type="message"
className="send__dialog"
onClick={() => showAddToAddressBookModal()}
>
{t('newAccountDetectedDialogMessage')}
</Dialog>
);
}
render() {
const {
showEdit,
@ -136,9 +117,14 @@ export default class ConfirmPageContainer extends Component {
editingGas,
handleCloseEditGas,
currentTransaction,
showAddToAddressBookModal,
contact = {},
} = this.props;
const renderAssetImage = contentComponent || !identiconAddress;
const showAddToAddressDialog =
contact.name === undefined && toAddress !== undefined;
return (
<div className="page-container">
<ConfirmPageContainerNavigation
@ -171,7 +157,17 @@ export default class ConfirmPageContainer extends Component {
/>
)}
</ConfirmPageContainerHeader>
<div>{this.maybeRenderAddContact()}</div>
<div>
{showAddToAddressDialog && (
<Dialog
type="message"
className="send__dialog"
onClick={() => showAddToAddressBookModal()}
>
{this.context.t('newAccountDetectedDialogMessage')}
</Dialog>
)}
</div>
{contentComponent || (
<ConfirmPageContainerContent
action={action}