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

Loading…
Cancel
Save