Files
OpenMediaCenter/src/pages/SettingsPage/SettingsPage.tsx
T

66 lines
2.1 KiB
TypeScript
Raw Normal View History

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-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 {
switch (this.state.currentpage) {
2020-10-25 18:48:23 +00:00
case 'general':
return <GeneralSettings/>;
2020-10-25 18:48:23 +00:00
case 'movies':
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
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 {
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
</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
</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
</div>
</div>
2020-07-08 19:33:23 +02:00
<div className={style.SettingsContent}>
{this.getContent()}
</div>
2020-06-04 22:19:18 +02:00
</div>
);
}
}
export default SettingsPage;