lbry-desktop/ui/page/settings/view.jsx

63 lines
1.6 KiB
React
Raw Permalink Normal View History

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