blob: 1bd21c84dd292a882e3d427edde9abc380a72070 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
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)),
);
|