1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 02:10:12 +01:00
metamask-extension/ui/pages/settings/contact-list-tab/contact-list-tab.container.js
Nidhi Kumari 1cc78fa0b1
UI updates for contacts Page (#19646)
* updated contacts flow update

* json file updates

* updated contacts edit and view list

* keep contacts tab selected

* lint fix

* replaced hardcoded strings with constant

* updated padding in box
2023-06-26 22:38:42 +05:30

38 lines
1.1 KiB
JavaScript

import { compose } from 'redux';
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import { getAddressBook } from '../../../selectors';
import {
CONTACT_ADD_ROUTE,
CONTACT_EDIT_ROUTE,
CONTACT_VIEW_ROUTE,
} from '../../../helpers/constants/routes';
import ContactListTab from './contact-list-tab.component';
const mapStateToProps = (state, ownProps) => {
const { location } = ownProps;
const { pathname } = location;
const pathNameTail = pathname.match(/[^/]+$/u)[0];
const pathNameTailIsAddress = pathNameTail.includes('0x');
const viewingContact = Boolean(pathname.match(CONTACT_VIEW_ROUTE));
const editingContact = Boolean(pathname.match(CONTACT_EDIT_ROUTE));
const addingContact = Boolean(pathname.match(CONTACT_ADD_ROUTE));
const hideAddressBook = viewingContact || editingContact || addingContact;
return {
viewingContact,
editingContact,
addingContact,
addressBook: getAddressBook(state),
selectedAddress: pathNameTailIsAddress ? pathNameTail : '',
hideAddressBook,
currentPath: pathname,
};
};
export default compose(withRouter, connect(mapStateToProps))(ContactListTab);