2018-05-11 01:51:26 +02:00
|
|
|
import { connect } from 'react-redux'
|
|
|
|
import { withRouter } from 'react-router-dom'
|
2020-02-24 23:58:26 +01:00
|
|
|
import { compose } from 'redux'
|
2018-05-11 01:51:26 +02:00
|
|
|
|
2020-01-09 04:34:58 +01:00
|
|
|
import * as actions from '../../../store/actions'
|
2020-08-18 21:18:25 +02:00
|
|
|
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) => {
|
2018-05-11 01:51:26 +02:00
|
|
|
const { appState, metamask } = state
|
|
|
|
const { networkDropdownOpen } = appState
|
|
|
|
const {
|
|
|
|
network,
|
|
|
|
provider,
|
|
|
|
selectedAddress,
|
|
|
|
isUnlocked,
|
2019-03-05 16:45:01 +01:00
|
|
|
isAccountMenuOpen,
|
2018-05-11 01:51:26 +02:00
|
|
|
} = metamask
|
|
|
|
|
|
|
|
return {
|
|
|
|
networkDropdownOpen,
|
|
|
|
network,
|
|
|
|
provider,
|
|
|
|
selectedAddress,
|
|
|
|
isUnlocked,
|
2019-03-05 16:45:01 +01:00
|
|
|
isAccountMenuOpen,
|
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()),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default compose(
|
|
|
|
withRouter,
|
2020-07-14 17:20:41 +02:00
|
|
|
connect(mapStateToProps, mapDispatchToProps),
|
2018-05-11 01:51:26 +02:00
|
|
|
)(AppHeader)
|