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 9cc2e4286..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 @@ -4,6 +4,7 @@ import SenderToRecipient from '../../ui/sender-to-recipient'; import { PageContainerFooter } from '../../ui/page-container'; import EditGasPopover from '../edit-gas-popover'; import { EDIT_GAS_MODES } from '../../../../shared/constants/gas'; +import Dialog from '../../ui/dialog'; import { ConfirmPageContainerHeader, ConfirmPageContainerContent, @@ -66,6 +67,8 @@ export default class ConfirmPageContainer extends Component { handleCloseEditGas: PropTypes.func, // Gas Popover currentTransaction: PropTypes.object.isRequired, + showAddToAddressBookModal: PropTypes.func, + contact: PropTypes.object, }; render() { @@ -114,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 (
)} +
+ {showAddToAddressDialog && ( + showAddToAddressBookModal()} + > + {this.context.t('newAccountDetectedDialogMessage')} + + )} +
{contentComponent || ( + dispatch( + actions.showModal({ + name: 'ADD_TO_ADDRESSBOOK', + recipient, + }), + ), + }; +} + +function mergeProps(stateProps, dispatchProps, ownProps) { + const { to, ...restStateProps } = stateProps; + return { + ...ownProps, + ...restStateProps, + showAddToAddressBookModal: () => + dispatchProps.showAddToAddressBookModal(to), + }; +} + +export default connect( + mapStateToProps, + mapDispatchToProps, + mergeProps, +)(ConfirmPageContainer); diff --git a/ui/components/app/confirm-page-container/index.js b/ui/components/app/confirm-page-container/index.js index d9bc6f5a8..955ef1bb8 100644 --- a/ui/components/app/confirm-page-container/index.js +++ b/ui/components/app/confirm-page-container/index.js @@ -1,4 +1,4 @@ -export { default } from './confirm-page-container.component'; +export { default } from './confirm-page-container.container'; export { default as ConfirmPageContainerHeader } from './confirm-page-container-header'; export { default as ConfirmDetailRow } from './confirm-detail-row'; export { default as ConfirmPageContainerNavigation } from './confirm-page-container-navigation';