2021-02-04 19:15:23 +01:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { withRouter } from 'react-router-dom';
|
|
|
|
import { compose } from 'redux';
|
2022-11-16 18:41:15 +01:00
|
|
|
import {
|
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(flask)
|
|
|
|
getUnreadNotificationsCount,
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(beta)
|
|
|
|
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;
|
2021-02-23 20:11:40 +01:00
|
|
|
const { selectedAddress, isUnlocked, isAccountMenuOpen } = metamask;
|
2018-05-11 01:51:26 +02:00
|
|
|
|
2022-06-01 19:09:13 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(flask)
|
|
|
|
const unreadNotificationsCount = getUnreadNotificationsCount(state);
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
|
|
|
|
2022-11-16 18:41:15 +01:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(beta)
|
|
|
|
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,
|
2022-06-01 19:09:13 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(flask)
|
|
|
|
unreadNotificationsCount,
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
2022-11-16 18:41:15 +01:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(beta)
|
|
|
|
showBetaHeader,
|
|
|
|
///: 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);
|