From 1ad80f0ae8aa032ff4211b476c7f59b003062891 Mon Sep 17 00:00:00 2001 From: "Akintayo A. Olusegun" Date: Wed, 8 Sep 2021 02:40:47 +0400 Subject: [PATCH] Use variable to check if should display dialog and display dialog inline. Signed-off-by: Akintayo A. Olusegun --- .../confirm-page-container.component.js | 36 +++++++++---------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/ui/components/app/confirm-page-container/confirm-page-container.component.js b/ui/components/app/confirm-page-container/confirm-page-container.component.js index 852cfeee9..cb32c41fd 100644 --- a/ui/components/app/confirm-page-container/confirm-page-container.component.js +++ b/ui/components/app/confirm-page-container/confirm-page-container.component.js @@ -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 ( - showAddToAddressBookModal()} - > - {t('newAccountDetectedDialogMessage')} - - ); - } - 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 (
)} -
{this.maybeRenderAddContact()}
+
+ {showAddToAddressDialog && ( + showAddToAddressBookModal()} + > + {this.context.t('newAccountDetectedDialogMessage')} + + )} +
{contentComponent || (