2020-10-25 18:48:23 +00:00
|
|
|
import React from 'react';
|
|
|
|
import MovieSettings from './MovieSettings';
|
|
|
|
import GeneralSettings from './GeneralSettings';
|
|
|
|
import style from './SettingsPage.module.css';
|
2020-12-17 20:53:22 +00:00
|
|
|
import GlobalInfos from '../../utils/GlobalInfos';
|
|
|
|
|
|
|
|
type SettingsPageState = {
|
|
|
|
currentpage: string
|
|
|
|
}
|
2020-06-04 22:19:18 +02:00
|
|
|
|
2020-08-12 17:50:25 +00:00
|
|
|
/**
|
|
|
|
* The Settingspage handles all kinds of settings for the mediacenter
|
|
|
|
* and is basically a wrapper for child-tabs
|
|
|
|
*/
|
2020-12-17 20:53:22 +00:00
|
|
|
class SettingsPage extends React.Component<{}, SettingsPageState> {
|
|
|
|
constructor(props: Readonly<{}> | {}, context?: any) {
|
2020-06-04 22:19:18 +02:00
|
|
|
super(props, context);
|
2020-06-25 22:43:26 +02:00
|
|
|
|
2020-06-04 22:19:18 +02:00
|
|
|
this.state = {
|
2020-10-25 18:48:23 +00:00
|
|
|
currentpage: 'general'
|
2020-06-04 22:19:18 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-08-12 17:50:25 +00:00
|
|
|
/**
|
|
|
|
* load the selected tab
|
|
|
|
* @returns {JSX.Element|string} the jsx element of the selected tab
|
|
|
|
*/
|
2020-12-17 20:53:22 +00:00
|
|
|
getContent(): JSX.Element | string {
|
2020-06-25 22:43:26 +02:00
|
|
|
switch (this.state.currentpage) {
|
2020-10-25 18:48:23 +00:00
|
|
|
case 'general':
|
2020-06-25 22:43:26 +02:00
|
|
|
return <GeneralSettings/>;
|
2020-10-25 18:48:23 +00:00
|
|
|
case 'movies':
|
2020-06-25 22:43:26 +02:00
|
|
|
return <MovieSettings/>;
|
2020-10-25 18:48:23 +00:00
|
|
|
case 'tv':
|
2020-06-29 21:34:43 +02:00
|
|
|
return <span/>; // todo this page
|
2020-06-25 22:43:26 +02:00
|
|
|
default:
|
2020-10-25 18:48:23 +00:00
|
|
|
return 'unknown button clicked';
|
2020-06-04 22:19:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-17 20:53:22 +00:00
|
|
|
render() : JSX.Element {
|
2020-08-05 22:00:55 +02:00
|
|
|
const themestyle = GlobalInfos.getThemeStyle();
|
2020-06-04 22:19:18 +02:00
|
|
|
return (
|
|
|
|
<div>
|
2020-08-04 18:53:11 +02:00
|
|
|
<div className={style.SettingsSidebar + ' ' + themestyle.secbackground}>
|
|
|
|
<div className={style.SettingsSidebarTitle + ' ' + themestyle.lighttextcolor}>Settings</div>
|
2020-10-25 18:48:23 +00:00
|
|
|
<div onClick={() => this.setState({currentpage: 'general'})}
|
2020-07-08 19:33:23 +02:00
|
|
|
className={style.SettingSidebarElement}>General
|
2020-06-25 22:43:26 +02:00
|
|
|
</div>
|
2020-10-25 18:48:23 +00:00
|
|
|
<div onClick={() => this.setState({currentpage: 'movies'})}
|
2020-07-08 19:33:23 +02:00
|
|
|
className={style.SettingSidebarElement}>Movies
|
2020-06-25 22:43:26 +02:00
|
|
|
</div>
|
2020-10-25 18:48:23 +00:00
|
|
|
<div onClick={() => this.setState({currentpage: 'tv'})}
|
2020-07-08 19:33:23 +02:00
|
|
|
className={style.SettingSidebarElement}>TV Shows
|
2020-06-25 22:43:26 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-07-08 19:33:23 +02:00
|
|
|
<div className={style.SettingsContent}>
|
2020-06-25 22:43:26 +02:00
|
|
|
{this.getContent()}
|
|
|
|
</div>
|
2020-06-04 22:19:18 +02:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default SettingsPage;
|