2022-09-29 14:58:16 -06:00
|
|
|
import React, {useContext} from 'react';
|
2021-11-01 16:42:52 -06:00
|
|
|
import './App.css';
|
|
|
|
|
import {NavBar} from "./components/Nav";
|
2022-09-29 14:58:16 -06:00
|
|
|
import {Route, Routes} from "react-router-dom";
|
2022-08-06 05:22:07 +00:00
|
|
|
import {VideosRoute, VideoWrapper} from "./components/Videos";
|
2022-09-29 12:02:09 -06:00
|
|
|
import Admin from "./components/admin/Admin";
|
2022-09-29 14:58:16 -06:00
|
|
|
import {Container} from "semantic-ui-react";
|
2021-11-01 16:42:52 -06:00
|
|
|
import 'semantic-ui-offline/semantic.min.css';
|
|
|
|
|
import {SemanticToastContainer} from 'react-semantic-toasts';
|
|
|
|
|
import 'react-semantic-toasts/styles/react-semantic-alert.css';
|
|
|
|
|
import {AppsRoute} from "./components/Apps";
|
|
|
|
|
import {InventoryRoute} from "./components/Inventory";
|
2022-08-06 05:22:07 +00:00
|
|
|
import {ArchiveRoute} from "./components/Archive";
|
2022-09-29 14:58:16 -06:00
|
|
|
import {FilesRoute} from "./components/Files";
|
|
|
|
|
import {useSettingsInterval} from "./hooks/customHooks";
|
2022-03-08 13:26:03 -07:00
|
|
|
import {MapRoute} from "./components/Map";
|
2022-09-28 09:38:05 -06:00
|
|
|
import {SettingsContext, ThemeContext} from "./contexts/contexts";
|
2022-09-29 14:58:16 -06:00
|
|
|
import {ThemeWrapper} from "./components/Theme";
|
|
|
|
|
import {Dashboard} from "./Dashboard";
|
2022-08-06 05:22:07 +00:00
|
|
|
|
2021-11-01 16:42:52 -06:00
|
|
|
function PageNotFound() {
|
|
|
|
|
return (
|
2022-01-04 09:07:28 -07:00
|
|
|
<Container fluid>
|
2021-11-01 16:42:52 -06:00
|
|
|
<h1 className="display-4">Page Not Found!</h1>
|
|
|
|
|
<p>The page you requested cannot be found</p>
|
|
|
|
|
</Container>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-30 16:59:26 -07:00
|
|
|
function Footer() {
|
2022-08-06 05:22:07 +00:00
|
|
|
const {t} = useContext(ThemeContext);
|
|
|
|
|
|
|
|
|
|
const {version} = useContext(SettingsContext);
|
2022-01-30 16:59:26 -07:00
|
|
|
return <Container textAlign='center' style={{marginTop: '1.5em', marginBottom: '1em'}}>
|
2022-08-06 05:22:07 +00:00
|
|
|
<span {...t}>WROLPi v{version} <a href='https://github.com/lrnselfreliance/wrolpi'>GitHub</a></span>
|
2022-01-30 16:59:26 -07:00
|
|
|
</Container>
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-01 16:42:52 -06:00
|
|
|
export default function App() {
|
2022-08-06 05:22:07 +00:00
|
|
|
const {settings} = useSettingsInterval();
|
|
|
|
|
|
2021-11-01 16:42:52 -06:00
|
|
|
return (
|
2022-09-28 09:38:05 -06:00
|
|
|
<ThemeWrapper>
|
2022-08-06 05:22:07 +00:00
|
|
|
<SettingsContext.Provider value={settings}>
|
|
|
|
|
<header>
|
|
|
|
|
<NavBar/>
|
|
|
|
|
</header>
|
|
|
|
|
<>
|
|
|
|
|
<Routes>
|
|
|
|
|
<Route path='/videos/video/:videoId' exact element={<VideoWrapper/>}/>
|
|
|
|
|
<Route path='/videos/channel/:channelId/video/:videoId' exact element={<VideoWrapper/>}/>
|
|
|
|
|
<Route path="/" exact element={<Dashboard/>}/>
|
|
|
|
|
<Route path="/videos/*" element={<VideosRoute/>}/>
|
|
|
|
|
<Route path="/admin/*" element={<Admin/>}/>
|
|
|
|
|
<Route path="/apps/*" element={<AppsRoute/>}/>
|
|
|
|
|
<Route path="/inventory/*" element={<InventoryRoute/>}/>
|
|
|
|
|
<Route path='/archive/*' element={<ArchiveRoute/>}/>
|
|
|
|
|
<Route path='/map/*' element={<MapRoute/>}/>
|
|
|
|
|
<Route path='/files/*' element={<FilesRoute/>}/>
|
|
|
|
|
<Route element={<PageNotFound/>}/>
|
|
|
|
|
</Routes>
|
|
|
|
|
</>
|
|
|
|
|
<SemanticToastContainer position="top-right"/>
|
|
|
|
|
<Footer/>
|
|
|
|
|
</SettingsContext.Provider>
|
2022-09-28 09:38:05 -06:00
|
|
|
</ThemeWrapper>
|
2021-11-01 16:42:52 -06:00
|
|
|
);
|
|
|
|
|
}
|