summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
authorHank <hank@mullvad.net>2022-10-07 15:29:13 +0200
committerHank <hank@mullvad.net>2022-10-10 16:08:21 +0200
commit800b37efdb2b663e4af5e6a01a063d6575235f1b (patch)
tree242b1c8024c2bb1295587ad87948b086703e7623 /gui
parent2d261d3d2bc70ecf1eff1603bf6a0e4e126f8a90 (diff)
downloadmullvadvpn-800b37efdb2b663e4af5e6a01a063d6575235f1b.tar.xz
mullvadvpn-800b37efdb2b663e4af5e6a01a063d6575235f1b.zip
Use SelectLanguage component
Bind this to setPreferredLocale Remove SelectLanguagePage.tsx
Diffstat (limited to 'gui')
-rw-r--r--gui/src/renderer/app.tsx2
-rw-r--r--gui/src/renderer/components/AppRouter.tsx4
-rw-r--r--gui/src/renderer/containers/SelectLanguagePage.tsx27
3 files changed, 4 insertions, 29 deletions
diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx
index c991e07104..6580c397bf 100644
--- a/gui/src/renderer/app.tsx
+++ b/gui/src/renderer/app.tsx
@@ -111,6 +111,8 @@ export default class AppRenderer {
log.addOutput(new ConsoleOutput(LogLevel.debug));
log.addOutput(new IpcOutput(LogLevel.debug));
+ this.setPreferredLocale = this.setPreferredLocale.bind(this);
+
IpcRendererEventChannel.window.listenShape((windowShapeParams) => {
if (typeof windowShapeParams.arrowPosition === 'number') {
this.reduxActions.userInterface.updateWindowArrowPosition(windowShapeParams.arrowPosition);
diff --git a/gui/src/renderer/components/AppRouter.tsx b/gui/src/renderer/components/AppRouter.tsx
index 05f3658605..dbc6f538e6 100644
--- a/gui/src/renderer/components/AppRouter.tsx
+++ b/gui/src/renderer/components/AppRouter.tsx
@@ -5,7 +5,6 @@ import { Route, Switch } from 'react-router';
import AccountPage from '../containers/AccountPage';
import LoginPage from '../containers/LoginPage';
import ProblemReportPage from '../containers/ProblemReportPage';
-import SelectLanguagePage from '../containers/SelectLanguagePage';
import SelectLocationPage from '../containers/SelectLocationPage';
import withAppContext, { IAppContext } from '../context';
import { IHistoryProps, ITransitionSpecification, transitions, withHistory } from '../lib/history';
@@ -22,6 +21,7 @@ import Focus, { IFocusHandle } from './Focus';
import Launch from './Launch';
import MainView from './MainView';
import OpenVpnSettings from './OpenVpnSettings';
+import SelectLanguage from './SelectLanguage';
import Settings from './Settings';
import SplitTunnelingSettings from './SplitTunnelingSettings';
import Support from './Support';
@@ -88,7 +88,7 @@ class AppRouter extends React.Component<IHistoryProps & IAppContext, IAppRoutesS
<Route exact path={RoutePath.timeAdded} component={TimeAdded} />
<Route exact path={RoutePath.setupFinished} component={SetupFinished} />
<Route exact path={RoutePath.settings} component={Settings} />
- <Route exact path={RoutePath.selectLanguage} component={SelectLanguagePage} />
+ <Route exact path={RoutePath.selectLanguage} component={SelectLanguage} />
<Route exact path={RoutePath.accountSettings} component={AccountPage} />
<Route
exact
diff --git a/gui/src/renderer/containers/SelectLanguagePage.tsx b/gui/src/renderer/containers/SelectLanguagePage.tsx
deleted file mode 100644
index 5a0f2f9d29..0000000000
--- a/gui/src/renderer/containers/SelectLanguagePage.tsx
+++ /dev/null
@@ -1,27 +0,0 @@
-import { connect } from 'react-redux';
-
-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: IHistoryProps & IAppContext) => {
- return {
- preferredLocalesList: props.app.getPreferredLocaleList(),
- async setPreferredLocale(locale: string) {
- await props.app.setPreferredLocale(locale);
- props.history.pop();
- },
- onClose() {
- props.history.pop();
- },
- };
-};
-
-export default withAppContext(
- withHistory(connect(mapStateToProps, mapDispatchToProps)(SelectLanguage)),
-);