Use variable to check if should display dialog and display dialog

inline.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
feature/default_network_editable
Akintayo A. Olusegun 3 years ago
parent 409bb00748
commit 1ad80f0ae8
  1. 36
      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 (
<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}

Loading…
Cancel
Save