import React, {useContext} from 'react'; import HomePage from './pages/HomePage/HomePage'; import RandomPage from './pages/RandomPage/RandomPage'; import GlobalInfos from './utils/GlobalInfos'; // include bootstraps css import 'bootstrap/dist/css/bootstrap.min.css'; import style from './App.module.css'; import SettingsPage from './pages/SettingsPage/SettingsPage'; import CategoryPage from './pages/CategoryPage/CategoryPage'; import {NavLink, Route, Switch, useRouteMatch} from 'react-router-dom'; import Player from './pages/Player/Player'; import ActorOverviewPage from './pages/ActorOverviewPage/ActorOverviewPage'; import ActorPage from './pages/ActorPage/ActorPage'; import AuthenticationPage from './pages/AuthenticationPage/AuthenticationPage'; import TVShowPage from './pages/TVShowPage/TVShowPage'; import TVPlayer from './pages/TVShowPage/TVPlayer'; import {LoginContextProvider} from './utils/context/LoginContextProvider'; import {FeatureContext} from './utils/context/FeatureContext'; interface state { mediacentername: string; } /** * The main App handles the main tabs and which content to show */ class App extends React.Component<{}, state> { constructor(props: {}) { super(props); this.state = { mediacentername: 'OpenMediaCenter' }; // force an update on theme change GlobalInfos.onThemeChange(() => { this.forceUpdate(); }); } render(): JSX.Element { // add the main theme to the page body document.body.className = GlobalInfos.getThemeStyle().backgroundcolor; return ( {this.navBar()} ); } static contextType = FeatureContext; /** * render the top navigation bar */ navBar(): JSX.Element { const themeStyle = GlobalInfos.getThemeStyle(); return (
{this.state.mediacentername}
Home Random Video Categories Actors {this.context.TVShowEnabled ? ( TV Shows ) : null} Settings
); } } const MyRouter = (): JSX.Element => { const match = useRouteMatch(); const features = useContext(FeatureContext); return ( {features.TVShowEnabled ? ( ) : null} {features.TVShowEnabled ? ( ) : null} ); }; export default App;