-
Notifications
You must be signed in to change notification settings - Fork 295
/
GeneralSettingsPage.js
47 lines (43 loc) · 1.49 KB
/
GeneralSettingsPage.js
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// @flow
import React, { Component } from 'react';
import { observer, inject } from 'mobx-react';
import GeneralSettings from '../../../components/settings/categories/GeneralSettings';
import { rebuildApplicationMenu } from '../../../ipc/rebuild-application-menu';
import type { InjectedProps } from '../../../types/injectedPropsType';
@inject('stores', 'actions')
@observer
export default class GeneralSettingsPage extends Component<InjectedProps> {
static defaultProps = { actions: null, stores: null };
handleSelectItem = async (param: string, value: string) => {
const { actions, stores } = this.props;
const { isUpdateAvailable } = stores.appUpdate;
const { areTermsOfUseAccepted: isNavigationEnabled } = stores.profile;
const { updateUserLocalSetting } = actions.profile;
updateUserLocalSetting.trigger({ param, value });
if (param === 'locale') {
await rebuildApplicationMenu.send({
isUpdateAvailable,
isNavigationEnabled,
});
}
};
render() {
const {
setProfileLocaleRequest,
currentLocale,
currentNumberFormat,
currentDateFormat,
currentTimeFormat,
} = this.props.stores.profile;
return (
<GeneralSettings
onChangeItem={this.handleSelectItem}
currentLocale={currentLocale}
currentNumberFormat={currentNumberFormat}
currentDateFormat={currentDateFormat}
currentTimeFormat={currentTimeFormat}
error={setProfileLocaleRequest.error}
/>
);
}
}