2018-03-26 14:32:43 -07:00
|
|
|
// @flow
|
|
|
|
import * as React from 'react';
|
|
|
|
import Page from 'component/page';
|
2021-08-05 15:00:21 +08:00
|
|
|
import SettingAccount from 'component/settingAccount';
|
2021-08-05 17:18:16 +08:00
|
|
|
import SettingAppearance from 'component/settingAppearance';
|
2021-08-06 10:41:37 +08:00
|
|
|
import SettingContent from 'component/settingContent';
|
2021-08-05 16:41:45 +08:00
|
|
|
import SettingSystem from 'component/settingSystem';
|
2022-06-02 15:24:11 -04:00
|
|
|
import SettingStorage from 'component/settingStorage';
|
2019-11-18 10:30:15 -08:00
|
|
|
|
2018-03-26 14:32:43 -07:00
|
|
|
type DaemonSettings = {
|
2019-02-12 12:26:50 -05:00
|
|
|
download_dir: string,
|
2018-03-26 14:32:43 -07:00
|
|
|
share_usage_data: boolean,
|
|
|
|
};
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
daemonSettings: DaemonSettings,
|
2020-09-04 11:02:30 -04:00
|
|
|
enterSettings: () => void,
|
|
|
|
exitSettings: () => void,
|
2018-03-26 14:32:43 -07:00
|
|
|
};
|
|
|
|
|
2021-08-05 16:41:45 +08:00
|
|
|
class SettingsPage extends React.PureComponent<Props> {
|
2018-03-26 14:32:43 -07:00
|
|
|
componentDidMount() {
|
2021-08-05 15:00:21 +08:00
|
|
|
const { enterSettings } = this.props;
|
2020-09-04 11:02:30 -04:00
|
|
|
enterSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
|
const { exitSettings } = this.props;
|
|
|
|
exitSettings();
|
2017-05-17 04:10:25 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2022-01-07 14:02:33 -05:00
|
|
|
const { daemonSettings } = this.props;
|
2018-03-26 14:32:43 -07:00
|
|
|
const noDaemonSettings = !daemonSettings || Object.keys(daemonSettings).length === 0;
|
2019-02-12 12:26:50 -05:00
|
|
|
|
2021-08-09 09:08:36 +08:00
|
|
|
return (
|
2021-08-08 16:13:35 +08:00
|
|
|
<Page
|
|
|
|
noFooter
|
|
|
|
settingsPage
|
|
|
|
noSideNavigation
|
2021-08-19 09:36:43 +08:00
|
|
|
backout={{ title: __('Settings'), backLabel: __('Back') }}
|
2021-08-08 16:13:35 +08:00
|
|
|
className="card-stack"
|
|
|
|
>
|
2022-01-07 14:02:33 -05:00
|
|
|
{noDaemonSettings ? (
|
2021-08-19 09:36:43 +08:00
|
|
|
<section className="card card--section">
|
|
|
|
<div className="card__title card__title--deprecated">{__('Failed to load settings.')}</div>
|
|
|
|
</section>
|
|
|
|
) : (
|
2022-01-07 14:02:33 -05:00
|
|
|
<div className={'card-stack'}>
|
2021-08-19 09:36:43 +08:00
|
|
|
<SettingAppearance />
|
|
|
|
<SettingAccount />
|
|
|
|
<SettingContent />
|
|
|
|
<SettingSystem />
|
2022-06-02 15:24:11 -04:00
|
|
|
<SettingStorage />
|
2021-08-19 09:36:43 +08:00
|
|
|
</div>
|
|
|
|
)}
|
2018-03-26 14:32:43 -07:00
|
|
|
</Page>
|
2016-04-09 20:00:56 -04:00
|
|
|
);
|
|
|
|
}
|
2017-05-17 04:10:25 -04:00
|
|
|
}
|
2016-11-22 14:19:08 -06:00
|
|
|
|
2020-07-27 13:43:30 -04:00
|
|
|
export default SettingsPage;
|