2021-02-04 19:15:23 +01:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { withRouter } from 'react-router-dom';
|
|
|
|
import { compose } from 'redux';
|
2023-04-28 14:23:56 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
|
|
|
import { getCustodianIconForAddress } from '../../../selectors/institutional/selectors';
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
2022-11-16 18:41:15 +01:00
|
|
|
import {
|
2023-04-25 16:32:51 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(snaps)
|
2022-11-16 18:41:15 +01:00
|
|
|
getUnreadNotificationsCount,
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
2023-04-25 16:32:51 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-beta)
|
2022-11-16 18:41:15 +01:00
|
|
|
getShowBetaHeader,
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
|
|
|
} from '../../../selectors';
|
2018-05-11 01:51:26 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
import * as actions from '../../../store/actions';
|
|
|
|
import AppHeader from './app-header.component';
|
2018-05-11 01:51:26 +02:00
|
|
|
|
2020-02-15 21:34:12 +01:00
|
|
|
const mapStateToProps = (state) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
const { appState, metamask } = state;
|
|
|
|
const { networkDropdownOpen } = appState;
|
2023-02-23 17:39:48 +01:00
|
|
|
const {
|
|
|
|
selectedAddress,
|
|
|
|
isUnlocked,
|
|
|
|
isAccountMenuOpen,
|
2023-04-25 16:32:51 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(desktop)
|
2023-02-23 17:39:48 +01:00
|
|
|
desktopEnabled,
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
|
|
|
} = metamask;
|
2018-05-11 01:51:26 +02:00
|
|
|
|
2023-04-28 14:23:56 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
|
|
|
const custodianIcon = selectedAddress
|
|
|
|
? getCustodianIconForAddress(state, selectedAddress)
|
|
|
|
: null;
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
|
|
|
|
2023-04-25 16:32:51 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(snaps)
|
2022-06-01 19:09:13 +02:00
|
|
|
const unreadNotificationsCount = getUnreadNotificationsCount(state);
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
|
|
|
|
2023-04-25 16:32:51 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-beta)
|
2022-11-16 18:41:15 +01:00
|
|
|
const showBetaHeader = getShowBetaHeader(state);
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
|
|
|
|
2018-05-11 01:51:26 +02:00
|
|
|
return {
|
|
|
|
networkDropdownOpen,
|
|
|
|
selectedAddress,
|
|
|
|
isUnlocked,
|
2019-03-05 16:45:01 +01:00
|
|
|
isAccountMenuOpen,
|
2023-04-25 16:32:51 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(snaps)
|
2022-06-01 19:09:13 +02:00
|
|
|
unreadNotificationsCount,
|
2023-04-25 16:32:51 +02:00
|
|
|
///: END:ONLY_INCLUDE_IN
|
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(desktop)
|
2023-03-06 20:35:00 +01:00
|
|
|
desktopEnabled,
|
2022-06-01 19:09:13 +02:00
|
|
|
///: END:ONLY_INCLUDE_IN
|
2023-04-25 16:32:51 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-beta)
|
2022-11-16 18:41:15 +01:00
|
|
|
showBetaHeader,
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
2023-04-28 14:23:56 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
|
|
|
custodianIcon,
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
|
|
|
};
|
2018-05-11 01:51:26 +02:00
|
|
|
|
2020-02-15 21:34:12 +01:00
|
|
|
const mapDispatchToProps = (dispatch) => {
|
2018-05-11 01:51:26 +02:00
|
|
|
return {
|
|
|
|
showNetworkDropdown: () => dispatch(actions.showNetworkDropdown()),
|
|
|
|
hideNetworkDropdown: () => dispatch(actions.hideNetworkDropdown()),
|
|
|
|
toggleAccountMenu: () => dispatch(actions.toggleAccountMenu()),
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
|
|
|
};
|
2018-05-11 01:51:26 +02:00
|
|
|
|
|
|
|
export default compose(
|
|
|
|
withRouter,
|
2020-07-14 17:20:41 +02:00
|
|
|
connect(mapStateToProps, mapDispatchToProps),
|
2021-02-04 19:15:23 +01:00
|
|
|
)(AppHeader);
|