Merge branch 'disableableTVShowNav' into 'master'
tVShows navlink and pages optionally disabled See merge request lukas/openmediacenter!48
This commit is contained in:
@ -18,6 +18,11 @@ describe('<App/>', function () {
|
||||
it('are navlinks correct', function () {
|
||||
const wrapper = shallow(<App/>);
|
||||
wrapper.setState({password: false});
|
||||
expect(wrapper.find('.navitem')).toHaveLength(4);
|
||||
|
||||
GlobalInfos.setTVShowsEnabled(true);
|
||||
|
||||
wrapper.instance().forceUpdate();
|
||||
expect(wrapper.find('.navitem')).toHaveLength(5);
|
||||
});
|
||||
|
||||
|
31
src/App.tsx
31
src/App.tsx
@ -86,6 +86,8 @@ class App extends React.Component<{}, state> {
|
||||
|
||||
GlobalInfos.setVideoPaths(result.VideoPath, result.TVShowPath);
|
||||
|
||||
GlobalInfos.setTVShowsEnabled(result.TVShowEnabled);
|
||||
|
||||
this.setState({
|
||||
mediacentername: result.MediacenterName
|
||||
});
|
||||
@ -146,9 +148,13 @@ class App extends React.Component<{}, state> {
|
||||
<NavLink className={[style.navitem, themeStyle.navitem].join(' ')} to={'/categories'} activeStyle={{opacity: '0.85'}}>
|
||||
Categories
|
||||
</NavLink>
|
||||
<NavLink className={[style.navitem, themeStyle.navitem].join(' ')} to={'/tvshows'} activeStyle={{opacity: '0.85'}}>
|
||||
TV Shows
|
||||
</NavLink>
|
||||
|
||||
{GlobalInfos.isTVShowEnabled() ? (
|
||||
<NavLink className={[style.navitem, themeStyle.navitem].join(' ')} to={'/tvshows'} activeStyle={{opacity: '0.85'}}>
|
||||
TV Shows
|
||||
</NavLink>
|
||||
) : null}
|
||||
|
||||
<NavLink className={[style.navitem, themeStyle.navitem].join(' ')} to={'/settings'} activeStyle={{opacity: '0.85'}}>
|
||||
Settings
|
||||
</NavLink>
|
||||
@ -168,24 +174,31 @@ class App extends React.Component<{}, state> {
|
||||
<Route path='/categories'>
|
||||
<CategoryPage />
|
||||
</Route>
|
||||
<Route path='/tvshows'>
|
||||
<TVShowPage />
|
||||
</Route>
|
||||
<Route path='/settings'>
|
||||
<SettingsPage />
|
||||
</Route>
|
||||
<Route exact path='/player/:id'>
|
||||
<Player />
|
||||
</Route>
|
||||
<Route exact path='/tvplayer/:id'>
|
||||
<TVPlayer />
|
||||
</Route>
|
||||
<Route exact path='/actors'>
|
||||
<ActorOverviewPage />
|
||||
</Route>
|
||||
<Route path='/actors/:id'>
|
||||
<ActorPage />
|
||||
</Route>
|
||||
|
||||
{GlobalInfos.isTVShowEnabled() ? (
|
||||
<Route path='/tvshows'>
|
||||
<TVShowPage />
|
||||
</Route>
|
||||
) : null}
|
||||
|
||||
{GlobalInfos.isTVShowEnabled() ? (
|
||||
<Route exact path='/tvplayer/:id'>
|
||||
<TVPlayer />
|
||||
</Route>
|
||||
) : null}
|
||||
|
||||
<Route path='/'>
|
||||
<HomePage />
|
||||
</Route>
|
||||
|
@ -22,9 +22,11 @@ class SettingsPage extends React.Component {
|
||||
<NavLink to='/settings/movies'>
|
||||
<div className={style.SettingSidebarElement}>Movies</div>
|
||||
</NavLink>
|
||||
<NavLink to='/settings/tv'>
|
||||
<div className={style.SettingSidebarElement}>TV Shows</div>
|
||||
</NavLink>
|
||||
{GlobalInfos.isTVShowEnabled() ? (
|
||||
<NavLink to='/settings/tv'>
|
||||
<div className={style.SettingSidebarElement}>TV Shows</div>
|
||||
</NavLink>
|
||||
) : null}
|
||||
</div>
|
||||
<div className={style.SettingsContent}>
|
||||
<Switch>
|
||||
@ -34,9 +36,11 @@ class SettingsPage extends React.Component {
|
||||
<Route path='/settings/movies'>
|
||||
<MovieSettings />
|
||||
</Route>
|
||||
<Route path='/settings/tv'>
|
||||
<span />
|
||||
</Route>
|
||||
{GlobalInfos.isTVShowEnabled() ? (
|
||||
<Route path='/settings/tv'>
|
||||
<span />
|
||||
</Route>
|
||||
) : null}
|
||||
<Route path='/settings'>
|
||||
<Redirect to='/settings/general' />
|
||||
</Route>
|
||||
|
@ -36,6 +36,7 @@ export namespace SettingsTypes {
|
||||
MediacenterName: string;
|
||||
VideoPath: string;
|
||||
TVShowPath: string;
|
||||
TVShowEnabled: boolean;
|
||||
}
|
||||
|
||||
export interface loadGeneralSettingsType {
|
||||
|
@ -9,6 +9,7 @@ class StaticInfos {
|
||||
private darktheme: boolean = true;
|
||||
private videopath: string = '';
|
||||
private tvshowpath: string = '';
|
||||
private TVShowsEnabled: boolean = false;
|
||||
|
||||
/**
|
||||
* check if the current theme is the dark theme
|
||||
@ -71,6 +72,14 @@ class StaticInfos {
|
||||
* load the Password page manually
|
||||
*/
|
||||
loadPasswordPage: ((callback?: () => void) => void) | undefined = undefined;
|
||||
|
||||
setTVShowsEnabled(TVShowEnabled: boolean): void {
|
||||
this.TVShowsEnabled = TVShowEnabled;
|
||||
}
|
||||
|
||||
isTVShowEnabled(): boolean {
|
||||
return this.TVShowsEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
export default new StaticInfos();
|
||||
|
Reference in New Issue
Block a user