2021-09-20 12:20:22 +02:00
|
|
|
import React, {useContext} from 'react';
|
2020-10-25 18:48:23 +00:00
|
|
|
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';
|
2021-09-19 23:20:37 +02:00
|
|
|
import {NavLink, Redirect, Route, Switch, useRouteMatch} from 'react-router-dom';
|
2021-09-20 12:20:22 +02:00
|
|
|
import {FeatureContext} from '../../utils/context/FeatureContext';
|
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
|
|
|
|
*/
|
2021-09-19 23:20:37 +02:00
|
|
|
const SettingsPage = (): JSX.Element => {
|
|
|
|
const themestyle = GlobalInfos.getThemeStyle();
|
|
|
|
const match = useRouteMatch();
|
2021-09-20 12:20:22 +02:00
|
|
|
const features = useContext(FeatureContext);
|
2021-09-19 23:20:37 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<div className={style.SettingsSidebar + ' ' + themestyle.secbackground}>
|
|
|
|
<div className={style.SettingsSidebarTitle + ' ' + themestyle.lighttextcolor}>Settings</div>
|
|
|
|
<NavLink to='/media/settings/general'>
|
|
|
|
<div className={style.SettingSidebarElement}>General</div>
|
|
|
|
</NavLink>
|
|
|
|
<NavLink to='/media/settings/movies'>
|
|
|
|
<div className={style.SettingSidebarElement}>Movies</div>
|
|
|
|
</NavLink>
|
2021-09-20 12:20:22 +02:00
|
|
|
{features.TVShowEnabled ? (
|
2021-09-19 23:20:37 +02:00
|
|
|
<NavLink to='/media/settings/tv'>
|
|
|
|
<div className={style.SettingSidebarElement}>TV Shows</div>
|
2020-12-29 19:39:30 +00:00
|
|
|
</NavLink>
|
2021-09-19 23:20:37 +02:00
|
|
|
) : null}
|
|
|
|
</div>
|
|
|
|
<div className={style.SettingsContent}>
|
|
|
|
<Switch>
|
|
|
|
<Route path={`${match.url}/general`}>
|
|
|
|
<GeneralSettings />
|
|
|
|
</Route>
|
|
|
|
<Route path={`${match.url}/movies`}>
|
|
|
|
<MovieSettings />
|
|
|
|
</Route>
|
2021-09-20 12:20:22 +02:00
|
|
|
{features.TVShowEnabled ? (
|
2021-09-19 23:20:37 +02:00
|
|
|
<Route path={`${match.url}/tv`}>
|
|
|
|
<span />
|
2020-12-29 19:39:30 +00:00
|
|
|
</Route>
|
2021-09-19 23:20:37 +02:00
|
|
|
) : null}
|
|
|
|
<Route path={`${match.url}/`}>
|
|
|
|
<Redirect to='/media/settings/general' />
|
|
|
|
</Route>
|
|
|
|
</Switch>
|
2020-06-04 22:19:18 +02:00
|
|
|
</div>
|
2021-09-19 23:20:37 +02:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
2020-06-04 22:19:18 +02:00
|
|
|
|
|
|
|
export default SettingsPage;
|