1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00
metamask-extension/ui/pages/routes/routes.container.js
Olusegun Akintayo bc8d4a3a44
On send/edit page, disable app header so that networks can't be changed (#14115)
* On send/edit page, disable app header so that networks can't be changed
in the middle of a transaction.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Only disable header if we're in edit mode

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2022-03-24 13:21:22 -02:30

62 lines
1.9 KiB
JavaScript

import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import { compose } from 'redux';
import {
getNetworkIdentifier,
getPreferences,
isNetworkLoading,
getTheme,
} from '../../selectors';
import {
lockMetamask,
setCurrentCurrency,
setLastActiveTime,
setMouseUserState,
} from '../../store/actions';
import { pageChanged } from '../../ducks/history/history';
import { prepareToLeaveSwaps } from '../../ducks/swaps/swaps';
import { getSendStage } from '../../ducks/send';
import Routes from './routes.component';
function mapStateToProps(state) {
const { appState } = state;
const { alertOpen, alertMessage, isLoading, loadingMessage } = appState;
const { autoLockTimeLimit = 0 } = getPreferences(state);
return {
alertOpen,
alertMessage,
textDirection: state.metamask.textDirection,
isLoading,
loadingMessage,
isUnlocked: state.metamask.isUnlocked,
isNetworkLoading: isNetworkLoading(state),
currentCurrency: state.metamask.currentCurrency,
isMouseUser: state.appState.isMouseUser,
autoLockTimeLimit,
browserEnvironmentOs: state.metamask.browserEnvironment?.os,
browserEnvironmentContainter: state.metamask.browserEnvironment?.browser,
providerId: getNetworkIdentifier(state),
providerType: state.metamask.provider?.type,
theme: getTheme(state),
sendStage: getSendStage(state),
};
}
function mapDispatchToProps(dispatch) {
return {
lockMetaMask: () => dispatch(lockMetamask(false)),
setCurrentCurrencyToUSD: () => dispatch(setCurrentCurrency('usd')),
setMouseUserState: (isMouseUser) =>
dispatch(setMouseUserState(isMouseUser)),
setLastActiveTime: () => dispatch(setLastActiveTime()),
pageChanged: (path) => dispatch(pageChanged(path)),
prepareToLeaveSwaps: () => dispatch(prepareToLeaveSwaps()),
};
}
export default compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps),
)(Routes);