summaryrefslogtreecommitdiffhomepage
path: root/gui/src/renderer/containers
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2021-06-29 14:51:55 +0200
committerOskar Nyberg <oskar@mullvad.net>2021-07-01 11:37:59 +0200
commit93f6361d14031d9644d6677c8eb51bf67e288666 (patch)
tree0e2a3c4ac9efa179a7b3383b4104c705675578ac /gui/src/renderer/containers
parent7b8697683a00a2a1dff9ad68e1b4d500f1d02a80 (diff)
downloadmullvadvpn-93f6361d14031d9644d6677c8eb51bf67e288666.tar.xz
mullvadvpn-93f6361d14031d9644d6677c8eb51bf67e288666.zip
Adjust all uses of history to use the new methods
Diffstat (limited to 'gui/src/renderer/containers')
-rw-r--r--gui/src/renderer/containers/AccountPage.tsx8
-rw-r--r--gui/src/renderer/containers/AdvancedSettingsPage.tsx8
-rw-r--r--gui/src/renderer/containers/ConnectPage.tsx8
-rw-r--r--gui/src/renderer/containers/ExpiredAccountErrorViewContainer.tsx6
-rw-r--r--gui/src/renderer/containers/PreferencesPage.tsx8
-rw-r--r--gui/src/renderer/containers/SelectLanguagePage.tsx10
-rw-r--r--gui/src/renderer/containers/SelectLocationPage.tsx14
-rw-r--r--gui/src/renderer/containers/SettingsPage.tsx8
-rw-r--r--gui/src/renderer/containers/SupportPage.tsx8
-rw-r--r--gui/src/renderer/containers/WireguardKeysPage.tsx8
10 files changed, 43 insertions, 43 deletions
diff --git a/gui/src/renderer/containers/AccountPage.tsx b/gui/src/renderer/containers/AccountPage.tsx
index accd4287b2..985161c838 100644
--- a/gui/src/renderer/containers/AccountPage.tsx
+++ b/gui/src/renderer/containers/AccountPage.tsx
@@ -1,10 +1,10 @@
import { connect } from 'react-redux';
-import { RouteComponentProps, withRouter } from 'react-router';
import { links } from '../../config.json';
import consumePromise from '../../shared/promise';
import Account from '../components/Account';
import withAppContext, { IAppContext } from '../context';
+import { IHistoryProps, withHistory } from '../lib/history';
import { IReduxState, ReduxDispatch } from '../redux/store';
const mapStateToProps = (state: IReduxState) => ({
@@ -13,16 +13,16 @@ const mapStateToProps = (state: IReduxState) => ({
expiryLocale: state.userInterface.locale,
isOffline: state.connection.isBlocked,
});
-const mapDispatchToProps = (_dispatch: ReduxDispatch, props: RouteComponentProps & IAppContext) => {
+const mapDispatchToProps = (_dispatch: ReduxDispatch, props: IHistoryProps & IAppContext) => {
return {
onLogout: () => {
consumePromise(props.app.logout());
},
onClose: () => {
- props.history.goBack();
+ props.history.pop();
},
onBuyMore: () => props.app.openLinkWithAuth(links.purchase),
};
};
-export default withAppContext(withRouter(connect(mapStateToProps, mapDispatchToProps)(Account)));
+export default withAppContext(withHistory(connect(mapStateToProps, mapDispatchToProps)(Account)));
diff --git a/gui/src/renderer/containers/AdvancedSettingsPage.tsx b/gui/src/renderer/containers/AdvancedSettingsPage.tsx
index 0aaa4ee3f4..a9e603718b 100644
--- a/gui/src/renderer/containers/AdvancedSettingsPage.tsx
+++ b/gui/src/renderer/containers/AdvancedSettingsPage.tsx
@@ -1,5 +1,4 @@
import { connect } from 'react-redux';
-import { RouteComponentProps, withRouter } from 'react-router';
import {
BridgeState,
IDnsOptions,
@@ -11,6 +10,7 @@ import RelaySettingsBuilder from '../../shared/relay-settings-builder';
import AdvancedSettings from '../components/AdvancedSettings';
import withAppContext, { IAppContext } from '../context';
+import { IHistoryProps, withHistory } from '../lib/history';
import { RelaySettingsRedux } from '../redux/settings/reducers';
import { IReduxState, ReduxDispatch } from '../redux/store';
@@ -56,10 +56,10 @@ const mapRelaySettingsToProtocolAndPort = (relaySettings: RelaySettingsRedux) =>
}
};
-const mapDispatchToProps = (_dispatch: ReduxDispatch, props: RouteComponentProps & IAppContext) => {
+const mapDispatchToProps = (_dispatch: ReduxDispatch, props: IHistoryProps & IAppContext) => {
return {
onClose: () => {
- props.history.goBack();
+ props.history.pop();
},
setOpenVpnRelayProtocolAndPort: async (protocol?: RelayProtocol, port?: number) => {
const relayUpdate = RelaySettingsBuilder.normal()
@@ -169,5 +169,5 @@ const mapDispatchToProps = (_dispatch: ReduxDispatch, props: RouteComponentProps
};
export default withAppContext(
- withRouter(connect(mapStateToProps, mapDispatchToProps)(AdvancedSettings)),
+ withHistory(connect(mapStateToProps, mapDispatchToProps)(AdvancedSettings)),
);
diff --git a/gui/src/renderer/containers/ConnectPage.tsx b/gui/src/renderer/containers/ConnectPage.tsx
index 99882bf8b1..d7197095f1 100644
--- a/gui/src/renderer/containers/ConnectPage.tsx
+++ b/gui/src/renderer/containers/ConnectPage.tsx
@@ -1,10 +1,10 @@
import { connect } from 'react-redux';
-import { RouteComponentProps, withRouter } from 'react-router';
import { sprintf } from 'sprintf-js';
import { messages } from '../../shared/gettext';
import log from '../../shared/logging';
import Connect from '../components/Connect';
import withAppContext, { IAppContext } from '../context';
+import { IHistoryProps, withHistory } from '../lib/history';
import { IRelayLocationRedux, RelaySettingsRedux } from '../redux/settings/reducers';
import { IReduxState, ReduxDispatch } from '../redux/store';
@@ -71,10 +71,10 @@ const mapStateToProps = (state: IReduxState) => {
};
};
-const mapDispatchToProps = (_dispatch: ReduxDispatch, props: RouteComponentProps & IAppContext) => {
+const mapDispatchToProps = (_dispatch: ReduxDispatch, props: IHistoryProps & IAppContext) => {
return {
onSelectLocation: () => {
- props.history.push('/select-location');
+ props.history.show('/select-location');
},
onConnect: async () => {
try {
@@ -100,4 +100,4 @@ const mapDispatchToProps = (_dispatch: ReduxDispatch, props: RouteComponentProps
};
};
-export default withAppContext(withRouter(connect(mapStateToProps, mapDispatchToProps)(Connect)));
+export default withAppContext(withHistory(connect(mapStateToProps, mapDispatchToProps)(Connect)));
diff --git a/gui/src/renderer/containers/ExpiredAccountErrorViewContainer.tsx b/gui/src/renderer/containers/ExpiredAccountErrorViewContainer.tsx
index 6297a17f42..372f9607c9 100644
--- a/gui/src/renderer/containers/ExpiredAccountErrorViewContainer.tsx
+++ b/gui/src/renderer/containers/ExpiredAccountErrorViewContainer.tsx
@@ -1,7 +1,7 @@
import { connect } from 'react-redux';
-import { RouteComponentProps, withRouter } from 'react-router';
import log from '../../shared/logging';
import ExpiredAccountErrorView from '../components/ExpiredAccountErrorView';
+import { IHistoryProps, withHistory } from '../lib/history';
import withAppContext, { IAppContext } from '../context';
import { IReduxState, ReduxDispatch } from '../redux/store';
@@ -13,7 +13,7 @@ const mapStateToProps = (state: IReduxState) => ({
isBlocked: state.connection.isBlocked,
blockWhenDisconnected: state.settings.blockWhenDisconnected,
});
-const mapDispatchToProps = (_dispatch: ReduxDispatch, props: RouteComponentProps & IAppContext) => {
+const mapDispatchToProps = (_dispatch: ReduxDispatch, props: IHistoryProps & IAppContext) => {
return {
onExternalLinkWithAuth: (url: string) => props.app.openLinkWithAuth(url),
onDisconnect: async () => {
@@ -37,5 +37,5 @@ const mapDispatchToProps = (_dispatch: ReduxDispatch, props: RouteComponentProps
};
export default withAppContext(
- withRouter(connect(mapStateToProps, mapDispatchToProps)(ExpiredAccountErrorView)),
+ withHistory(connect(mapStateToProps, mapDispatchToProps)(ExpiredAccountErrorView)),
);
diff --git a/gui/src/renderer/containers/PreferencesPage.tsx b/gui/src/renderer/containers/PreferencesPage.tsx
index 3bd4a20e44..671ba33c26 100644
--- a/gui/src/renderer/containers/PreferencesPage.tsx
+++ b/gui/src/renderer/containers/PreferencesPage.tsx
@@ -1,10 +1,10 @@
import { connect } from 'react-redux';
-import { RouteComponentProps, withRouter } from 'react-router';
import { IDnsOptions } from '../../shared/daemon-rpc-types';
import log from '../../shared/logging';
import consumePromise from '../../shared/promise';
import Preferences from '../components/Preferences';
import withAppContext, { IAppContext } from '../context';
+import { IHistoryProps, withHistory } from '../lib/history';
import { IReduxState, ReduxDispatch } from '../redux/store';
const mapStateToProps = (state: IReduxState) => ({
@@ -20,10 +20,10 @@ const mapStateToProps = (state: IReduxState) => ({
dns: state.settings.dns,
});
-const mapDispatchToProps = (_dispatch: ReduxDispatch, props: RouteComponentProps & IAppContext) => {
+const mapDispatchToProps = (_dispatch: ReduxDispatch, props: IHistoryProps & IAppContext) => {
return {
onClose: () => {
- props.history.goBack();
+ props.history.pop();
},
setEnableSystemNotifications: (flag: boolean) => {
props.app.setEnableSystemNotifications(flag);
@@ -60,5 +60,5 @@ const mapDispatchToProps = (_dispatch: ReduxDispatch, props: RouteComponentProps
};
export default withAppContext(
- withRouter(connect(mapStateToProps, mapDispatchToProps)(Preferences)),
+ withHistory(connect(mapStateToProps, mapDispatchToProps)(Preferences)),
);
diff --git a/gui/src/renderer/containers/SelectLanguagePage.tsx b/gui/src/renderer/containers/SelectLanguagePage.tsx
index 5c073c22e1..1bd21c84dd 100644
--- a/gui/src/renderer/containers/SelectLanguagePage.tsx
+++ b/gui/src/renderer/containers/SelectLanguagePage.tsx
@@ -1,26 +1,26 @@
import { connect } from 'react-redux';
-import { RouteComponentProps, withRouter } from 'react-router';
import SelectLanguage from '../components/SelectLanguage';
import withAppContext, { IAppContext } from '../context';
+import { IHistoryProps, withHistory } from '../lib/history';
import { IReduxState, ReduxDispatch } from '../redux/store';
const mapStateToProps = (state: IReduxState) => ({
preferredLocale: state.settings.guiSettings.preferredLocale,
});
-const mapDispatchToProps = (_dispatch: ReduxDispatch, props: RouteComponentProps & IAppContext) => {
+const mapDispatchToProps = (_dispatch: ReduxDispatch, props: IHistoryProps & IAppContext) => {
return {
preferredLocalesList: props.app.getPreferredLocaleList(),
async setPreferredLocale(locale: string) {
await props.app.setPreferredLocale(locale);
- props.history.goBack();
+ props.history.pop();
},
onClose() {
- props.history.goBack();
+ props.history.pop();
},
};
};
export default withAppContext(
- withRouter(connect(mapStateToProps, mapDispatchToProps)(SelectLanguage)),
+ withHistory(connect(mapStateToProps, mapDispatchToProps)(SelectLanguage)),
);
diff --git a/gui/src/renderer/containers/SelectLocationPage.tsx b/gui/src/renderer/containers/SelectLocationPage.tsx
index fbad19285b..b3aab7eb69 100644
--- a/gui/src/renderer/containers/SelectLocationPage.tsx
+++ b/gui/src/renderer/containers/SelectLocationPage.tsx
@@ -1,5 +1,4 @@
import { connect } from 'react-redux';
-import { RouteComponentProps, withRouter } from 'react-router';
import { bindActionCreators } from 'redux';
import BridgeSettingsBuilder from '../../shared/bridge-settings-builder';
import { LiftedConstraint, RelayLocation } from '../../shared/daemon-rpc-types';
@@ -7,6 +6,7 @@ import log from '../../shared/logging';
import RelaySettingsBuilder from '../../shared/relay-settings-builder';
import SelectLocation from '../components/SelectLocation';
import withAppContext, { IAppContext } from '../context';
+import { IHistoryProps, withHistory } from '../lib/history';
import { IReduxState, ReduxDispatch } from '../redux/store';
import userInterfaceActions from '../redux/userinterface/actions';
import { LocationScope } from '../redux/userinterface/reducers';
@@ -40,17 +40,17 @@ const mapStateToProps = (state: IReduxState) => {
allowBridgeSelection,
};
};
-const mapDispatchToProps = (dispatch: ReduxDispatch, props: RouteComponentProps & IAppContext) => {
+const mapDispatchToProps = (dispatch: ReduxDispatch, props: IHistoryProps & IAppContext) => {
const userInterface = bindActionCreators(userInterfaceActions, dispatch);
return {
- onClose: () => props.history.goBack(),
+ onClose: () => props.history.dismiss(),
onChangeLocationScope: (scope: LocationScope) => {
userInterface.setLocationScope(scope);
},
onSelectExitLocation: async (relayLocation: RelayLocation) => {
// dismiss the view first
- props.history.goBack();
+ props.history.dismiss();
try {
const relayUpdate = RelaySettingsBuilder.normal().location.fromRaw(relayLocation).build();
@@ -63,7 +63,7 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, props: RouteComponentProps
},
onSelectBridgeLocation: async (bridgeLocation: RelayLocation) => {
// dismiss the view first
- props.history.goBack();
+ props.history.dismiss();
try {
await props.app.updateBridgeSettings(
@@ -75,7 +75,7 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, props: RouteComponentProps
},
onSelectClosestToExit: async () => {
// dismiss the view first
- props.history.goBack();
+ props.history.dismiss();
try {
await props.app.updateBridgeSettings(new BridgeSettingsBuilder().location.any().build());
@@ -87,5 +87,5 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, props: RouteComponentProps
};
export default withAppContext(
- withRouter(connect(mapStateToProps, mapDispatchToProps)(SelectLocation)),
+ withHistory(connect(mapStateToProps, mapDispatchToProps)(SelectLocation)),
);
diff --git a/gui/src/renderer/containers/SettingsPage.tsx b/gui/src/renderer/containers/SettingsPage.tsx
index 6985fd927c..97ff917e7e 100644
--- a/gui/src/renderer/containers/SettingsPage.tsx
+++ b/gui/src/renderer/containers/SettingsPage.tsx
@@ -1,7 +1,7 @@
import { connect } from 'react-redux';
-import { RouteComponentProps, withRouter } from 'react-router';
import Settings from '../components/Settings';
import withAppContext, { IAppContext } from '../context';
+import { IHistoryProps, withHistory } from '../lib/history';
import { IReduxState, ReduxDispatch } from '../redux/store';
const mapStateToProps = (state: IReduxState, props: IAppContext) => ({
@@ -16,10 +16,10 @@ const mapStateToProps = (state: IReduxState, props: IAppContext) => ({
suggestedIsBeta: state.version.suggestedIsBeta ?? false,
isOffline: state.connection.isBlocked,
});
-const mapDispatchToProps = (_dispatch: ReduxDispatch, props: RouteComponentProps & IAppContext) => {
+const mapDispatchToProps = (_dispatch: ReduxDispatch, props: IHistoryProps & IAppContext) => {
return {
onQuit: () => props.app.quit(),
- onClose: () => props.history.goBack(),
+ onClose: () => props.history.dismiss(),
onViewSelectLanguage: () => props.history.push('/settings/language'),
onViewAccount: () => props.history.push('/settings/account'),
onViewSupport: () => props.history.push('/settings/support'),
@@ -29,4 +29,4 @@ const mapDispatchToProps = (_dispatch: ReduxDispatch, props: RouteComponentProps
};
};
-export default withAppContext(withRouter(connect(mapStateToProps, mapDispatchToProps)(Settings)));
+export default withAppContext(withHistory(connect(mapStateToProps, mapDispatchToProps)(Settings)));
diff --git a/gui/src/renderer/containers/SupportPage.tsx b/gui/src/renderer/containers/SupportPage.tsx
index 1df4827223..a4bdbd4ac3 100644
--- a/gui/src/renderer/containers/SupportPage.tsx
+++ b/gui/src/renderer/containers/SupportPage.tsx
@@ -1,9 +1,9 @@
import { connect } from 'react-redux';
-import { RouteComponentProps, withRouter } from 'react-router';
import { bindActionCreators } from 'redux';
import consumePromise from '../../shared/promise';
import Support from '../components/Support';
import withAppContext, { IAppContext } from '../context';
+import { IHistoryProps, withHistory } from '../lib/history';
import { IReduxState, ReduxDispatch } from '../redux/store';
import supportActions from '../redux/support/actions';
@@ -16,12 +16,12 @@ const mapStateToProps = (state: IReduxState) => ({
suggestedIsBeta: state.version.suggestedIsBeta ?? false,
});
-const mapDispatchToProps = (dispatch: ReduxDispatch, props: IAppContext & RouteComponentProps) => {
+const mapDispatchToProps = (dispatch: ReduxDispatch, props: IAppContext & IHistoryProps) => {
const { saveReportForm, clearReportForm } = bindActionCreators(supportActions, dispatch);
return {
onClose() {
- props.history.goBack();
+ props.history.pop();
},
viewLog(id: string) {
consumePromise(props.app.viewLog(id));
@@ -34,4 +34,4 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, props: IAppContext & RouteC
};
};
-export default withAppContext(withRouter(connect(mapStateToProps, mapDispatchToProps)(Support)));
+export default withAppContext(withHistory(connect(mapStateToProps, mapDispatchToProps)(Support)));
diff --git a/gui/src/renderer/containers/WireguardKeysPage.tsx b/gui/src/renderer/containers/WireguardKeysPage.tsx
index e07e4718f2..b0c25e06a9 100644
--- a/gui/src/renderer/containers/WireguardKeysPage.tsx
+++ b/gui/src/renderer/containers/WireguardKeysPage.tsx
@@ -1,8 +1,8 @@
import { connect } from 'react-redux';
-import { RouteComponentProps, withRouter } from 'react-router';
import { links } from '../../config.json';
import WireguardKeys from '../components/WireguardKeys';
import withAppContext, { IAppContext } from '../context';
+import { IHistoryProps, withHistory } from '../lib/history';
import { IWgKey } from '../redux/settings/reducers';
import { IReduxState, ReduxDispatch } from '../redux/store';
@@ -12,9 +12,9 @@ const mapStateToProps = (state: IReduxState) => ({
tunnelState: state.connection.status,
windowFocused: state.userInterface.windowFocused,
});
-const mapDispatchToProps = (_dispatch: ReduxDispatch, props: RouteComponentProps & IAppContext) => {
+const mapDispatchToProps = (_dispatch: ReduxDispatch, props: IHistoryProps & IAppContext) => {
return {
- onClose: () => props.history.goBack(),
+ onClose: () => props.history.pop(),
onGenerateKey: () => props.app.generateWireguardKey(),
onReplaceKey: (oldKey: IWgKey) => props.app.replaceWireguardKey(oldKey),
onVerifyKey: (publicKey: IWgKey) => props.app.verifyWireguardKey(publicKey),
@@ -23,5 +23,5 @@ const mapDispatchToProps = (_dispatch: ReduxDispatch, props: RouteComponentProps
};
export default withAppContext(
- withRouter(connect(mapStateToProps, mapDispatchToProps)(WireguardKeys)),
+ withHistory(connect(mapStateToProps, mapDispatchToProps)(WireguardKeys)),
);