2020-03-26 17:18:50 +01:00
|
|
|
import { connect } from 'react-redux'
|
|
|
|
import { withRouter } from 'react-router-dom'
|
|
|
|
import { compose } from 'redux'
|
|
|
|
import {
|
|
|
|
getNetworkIdentifier,
|
2020-05-26 08:11:58 +02:00
|
|
|
getPreferences,
|
2020-05-02 21:41:17 +02:00
|
|
|
submittedPendingTransactionsSelector,
|
|
|
|
} from '../../selectors'
|
2020-03-26 17:18:50 +01:00
|
|
|
import {
|
|
|
|
hideSidebar,
|
|
|
|
lockMetamask,
|
|
|
|
setCurrentCurrency,
|
|
|
|
setLastActiveTime,
|
|
|
|
setMouseUserState,
|
|
|
|
} from '../../store/actions'
|
2020-06-01 19:54:32 +02:00
|
|
|
import { pageChanged } from '../../ducks/history/history'
|
2020-10-06 20:28:38 +02:00
|
|
|
import { prepareToLeaveSwaps } from '../../ducks/swaps/swaps'
|
2020-08-18 21:18:25 +02:00
|
|
|
import Routes from './routes.component'
|
2020-03-26 17:18:50 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
function mapStateToProps(state) {
|
2020-03-26 17:18:50 +01:00
|
|
|
const { appState } = state
|
|
|
|
const {
|
|
|
|
sidebar,
|
|
|
|
alertOpen,
|
|
|
|
alertMessage,
|
|
|
|
isLoading,
|
|
|
|
loadingMessage,
|
|
|
|
} = appState
|
2020-05-26 08:11:58 +02:00
|
|
|
const { autoLockTimeLimit = 0 } = getPreferences(state)
|
2020-03-26 17:18:50 +01:00
|
|
|
|
|
|
|
return {
|
|
|
|
sidebar,
|
|
|
|
alertOpen,
|
|
|
|
alertMessage,
|
|
|
|
textDirection: state.metamask.textDirection,
|
|
|
|
isLoading,
|
|
|
|
loadingMessage,
|
|
|
|
isUnlocked: state.metamask.isUnlocked,
|
|
|
|
submittedPendingTransactions: submittedPendingTransactionsSelector(state),
|
|
|
|
network: state.metamask.network,
|
|
|
|
provider: state.metamask.provider,
|
|
|
|
frequentRpcListDetail: state.metamask.frequentRpcListDetail || [],
|
|
|
|
currentCurrency: state.metamask.currentCurrency,
|
|
|
|
isMouseUser: state.appState.isMouseUser,
|
|
|
|
providerId: getNetworkIdentifier(state),
|
|
|
|
autoLockTimeLimit,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
function mapDispatchToProps(dispatch) {
|
2020-03-26 17:18:50 +01:00
|
|
|
return {
|
|
|
|
lockMetaMask: () => dispatch(lockMetamask(false)),
|
|
|
|
hideSidebar: () => dispatch(hideSidebar()),
|
|
|
|
setCurrentCurrencyToUSD: () => dispatch(setCurrentCurrency('usd')),
|
2020-11-03 00:41:28 +01:00
|
|
|
setMouseUserState: (isMouseUser) =>
|
|
|
|
dispatch(setMouseUserState(isMouseUser)),
|
2020-03-26 17:18:50 +01:00
|
|
|
setLastActiveTime: () => dispatch(setLastActiveTime()),
|
2020-06-01 19:54:32 +02:00
|
|
|
pageChanged: (path) => dispatch(pageChanged(path)),
|
2020-10-06 20:28:38 +02:00
|
|
|
prepareToLeaveSwaps: () => dispatch(prepareToLeaveSwaps()),
|
2020-03-26 17:18:50 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
export default compose(
|
|
|
|
withRouter,
|
|
|
|
connect(mapStateToProps, mapDispatchToProps),
|
|
|
|
)(Routes)
|