fix some tests
fix merge issues
This commit is contained in:
@ -3,59 +3,44 @@ import MovieSettings from './MovieSettings';
|
||||
import GeneralSettings from './GeneralSettings';
|
||||
import style from './SettingsPage.module.css';
|
||||
import GlobalInfos from '../../utils/GlobalInfos';
|
||||
|
||||
type SettingsPageState = {
|
||||
currentpage: string
|
||||
}
|
||||
import {NavLink, Redirect, Route, Switch} from 'react-router-dom';
|
||||
|
||||
/**
|
||||
* The Settingspage handles all kinds of settings for the mediacenter
|
||||
* and is basically a wrapper for child-tabs
|
||||
*/
|
||||
class SettingsPage extends React.Component<{}, SettingsPageState> {
|
||||
constructor(props: Readonly<{}> | {}, context?: any) {
|
||||
super(props, context);
|
||||
|
||||
this.state = {
|
||||
currentpage: 'general'
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* load the selected tab
|
||||
* @returns {JSX.Element|string} the jsx element of the selected tab
|
||||
*/
|
||||
getContent(): JSX.Element | string {
|
||||
switch (this.state.currentpage) {
|
||||
case 'general':
|
||||
return <GeneralSettings/>;
|
||||
case 'movies':
|
||||
return <MovieSettings/>;
|
||||
case 'tv':
|
||||
return <span/>; // todo this page
|
||||
default:
|
||||
return 'unknown button clicked';
|
||||
}
|
||||
}
|
||||
|
||||
render() : JSX.Element {
|
||||
class SettingsPage extends React.Component {
|
||||
render(): JSX.Element {
|
||||
const themestyle = GlobalInfos.getThemeStyle();
|
||||
return (
|
||||
<div>
|
||||
<div className={style.SettingsSidebar + ' ' + themestyle.secbackground}>
|
||||
<div className={style.SettingsSidebarTitle + ' ' + themestyle.lighttextcolor}>Settings</div>
|
||||
<div onClick={() => this.setState({currentpage: 'general'})}
|
||||
className={style.SettingSidebarElement}>General
|
||||
</div>
|
||||
<div onClick={() => this.setState({currentpage: 'movies'})}
|
||||
className={style.SettingSidebarElement}>Movies
|
||||
</div>
|
||||
<div onClick={() => this.setState({currentpage: 'tv'})}
|
||||
className={style.SettingSidebarElement}>TV Shows
|
||||
</div>
|
||||
<NavLink to='/settings/general'>
|
||||
<div className={style.SettingSidebarElement}>General</div>
|
||||
</NavLink>
|
||||
<NavLink to='/settings/movies'>
|
||||
<div className={style.SettingSidebarElement}>Movies</div>
|
||||
</NavLink>
|
||||
<NavLink to='/settings/tv'>
|
||||
<div className={style.SettingSidebarElement}>TV Shows</div>
|
||||
</NavLink>
|
||||
</div>
|
||||
<div className={style.SettingsContent}>
|
||||
{this.getContent()}
|
||||
<Switch>
|
||||
<Route path="/settings/general">
|
||||
<GeneralSettings/>
|
||||
</Route>
|
||||
<Route path="/settings/movies">
|
||||
<MovieSettings/>
|
||||
</Route>
|
||||
<Route path="/settings/tv">
|
||||
<span/>
|
||||
</Route>
|
||||
<Route path="/settings">
|
||||
<Redirect to='/settings/general'/>
|
||||
</Route>
|
||||
</Switch>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
Reference in New Issue
Block a user