2021-02-04 19:15:23 +01:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { withRouter } from 'react-router-dom';
|
|
|
|
import { compose } from 'redux';
|
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
|
|
|
|
|
|
|
return {
|
|
|
|
networkDropdownOpen,
|
|
|
|
selectedAddress,
|
|
|
|
isUnlocked,
|
2019-03-05 16:45:01 +01:00
|
|
|
isAccountMenuOpen,
|
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);
|