2022-04-06 16:37:23 +02:00
|
|
|
import './style/main.sass';
|
|
|
|
import './style/sb-admin-2.css'
|
|
|
|
import './style/style.css';
|
|
|
|
|
|
|
|
import {BrowserRouter, Navigate, Route, Routes} from "react-router-dom";
|
|
|
|
import React from "react";
|
|
|
|
import {ThemeContextProvider} from "./hooks/themeHook";
|
|
|
|
import axios from "axios";
|
|
|
|
import ErrorView from "./views/ErrorView";
|
|
|
|
import {faMapSigns} from "@fortawesome/free-solid-svg-icons";
|
|
|
|
import {MetadataContextProvider} from "./hooks/metadataHook";
|
|
|
|
import {AuthenticationContextProvider} from "./hooks/authenticationHook";
|
|
|
|
import {NavigationContextProvider} from "./hooks/navigationHook";
|
|
|
|
import MainPageRedirect from "./components/navigation/MainPageRedirect";
|
|
|
|
|
2022-09-01 18:50:16 +02:00
|
|
|
const PlayerPage = React.lazy(() => import("./views/layout/PlayerPage"));
|
|
|
|
const PlayerOverview = React.lazy(() => import("./views/player/PlayerOverview"));
|
|
|
|
const PlayerSessions = React.lazy(() => import("./views/player/PlayerSessions"));
|
|
|
|
const PlayerPvpPve = React.lazy(() => import("./views/player/PlayerPvpPve"));
|
|
|
|
const PlayerServers = React.lazy(() => import("./views/player/PlayerServers"));
|
|
|
|
const PlayerPluginData = React.lazy(() => import("./views/player/PlayerPluginData"));
|
|
|
|
|
|
|
|
const ServerPage = React.lazy(() => import("./views/layout/ServerPage"));
|
|
|
|
const ServerOverview = React.lazy(() => import("./views/server/ServerOverview"));
|
|
|
|
const OnlineActivity = React.lazy(() => import("./views/server/OnlineActivity"));
|
|
|
|
const ServerSessions = React.lazy(() => import("./views/server/ServerSessions"));
|
|
|
|
const ServerPvpPve = React.lazy(() => import("./views/server/ServerPvpPve"));
|
|
|
|
const PlayerbaseOverview = React.lazy(() => import("./views/server/PlayerbaseOverview"));
|
|
|
|
const ServerPlayers = React.lazy(() => import("./views/server/ServerPlayers"));
|
|
|
|
const ServerGeolocations = React.lazy(() => import("./views/server/ServerGeolocations"));
|
|
|
|
const LoginPage = React.lazy(() => import("./views/layout/LoginPage"));
|
|
|
|
const ServerPerformance = React.lazy(() => import("./views/server/ServerPerformance"));
|
|
|
|
const ServerPluginData = React.lazy(() => import("./views/server/ServerPluginData"));
|
|
|
|
const ServerWidePluginData = React.lazy(() => import("./views/server/ServerWidePluginData"));
|
2022-09-05 15:56:59 +02:00
|
|
|
const ServerJoinAddresses = React.lazy(() => import("./views/server/ServerJoinAddresses"));
|
2022-09-01 18:50:16 +02:00
|
|
|
|
2022-09-03 13:01:15 +02:00
|
|
|
const NetworkPage = React.lazy(() => import("./views/layout/NetworkPage"));
|
2022-09-04 08:40:17 +02:00
|
|
|
const NetworkOverview = React.lazy(() => import("./views/network/NetworkOverview"));
|
2022-09-09 18:10:06 +02:00
|
|
|
const NetworkServers = React.lazy(() => import("./views/network/NetworkServers"));
|
2022-09-10 08:38:25 +02:00
|
|
|
const NetworkSessions = React.lazy(() => import("./views/network/NetworkSessions"));
|
2022-09-10 09:45:03 +02:00
|
|
|
const NetworkJoinAddresses = React.lazy(() => import("./views/network/NetworkJoinAddresses"));
|
2022-09-11 08:30:33 +02:00
|
|
|
const NetworkGeolocations = React.lazy(() => import("./views/network/NetworkGeolocations"));
|
2022-09-11 08:42:03 +02:00
|
|
|
const NetworkPlayerbaseOverview = React.lazy(() => import("./views/network/NetworkPlayerbaseOverview"));
|
2022-09-03 13:01:15 +02:00
|
|
|
|
2022-09-01 18:50:16 +02:00
|
|
|
const PlayersPage = React.lazy(() => import("./views/layout/PlayersPage"));
|
|
|
|
const AllPlayers = React.lazy(() => import("./views/players/AllPlayers"));
|
|
|
|
|
|
|
|
const ErrorsPage = React.lazy(() => import("./views/layout/ErrorsPage"));
|
2022-07-13 20:21:20 +02:00
|
|
|
const SwaggerView = React.lazy(() => import("./views/SwaggerView"));
|
|
|
|
|
2022-04-06 16:37:23 +02:00
|
|
|
const OverviewRedirect = () => {
|
|
|
|
return (<Navigate to={"overview"} replace={true}/>)
|
|
|
|
}
|
|
|
|
|
|
|
|
const ContextProviders = ({children}) => (
|
|
|
|
<AuthenticationContextProvider>
|
|
|
|
<MetadataContextProvider>
|
|
|
|
<ThemeContextProvider>
|
|
|
|
<NavigationContextProvider>
|
|
|
|
{children}
|
|
|
|
</NavigationContextProvider>
|
|
|
|
</ThemeContextProvider>
|
|
|
|
</MetadataContextProvider>
|
|
|
|
</AuthenticationContextProvider>
|
|
|
|
)
|
|
|
|
|
2022-09-01 18:50:16 +02:00
|
|
|
const Lazy = ({children}) => (
|
|
|
|
<React.Suspense fallback={<></>}>
|
|
|
|
{children}
|
|
|
|
</React.Suspense>
|
|
|
|
)
|
|
|
|
|
2022-04-06 16:37:23 +02:00
|
|
|
function App() {
|
|
|
|
axios.defaults.withCredentials = true;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="App">
|
|
|
|
<ContextProviders>
|
|
|
|
<div id="wrapper">
|
|
|
|
<BrowserRouter>
|
|
|
|
<Routes>
|
|
|
|
<Route path="" element={<MainPageRedirect/>}/>
|
2022-08-18 17:27:11 +02:00
|
|
|
<Route path="/" element={<MainPageRedirect/>}/>
|
2022-09-01 18:50:16 +02:00
|
|
|
<Route path="/login" element={<Lazy><LoginPage/></Lazy>}/>
|
|
|
|
<Route path="/player/:identifier" element={<Lazy><PlayerPage/></Lazy>}>
|
|
|
|
<Route path="" element={<Lazy><OverviewRedirect/></Lazy>}/>
|
|
|
|
<Route path="overview" element={<Lazy><PlayerOverview/></Lazy>}/>
|
|
|
|
<Route path="sessions" element={<Lazy><PlayerSessions/></Lazy>}/>
|
|
|
|
<Route path="pvppve" element={<Lazy><PlayerPvpPve/></Lazy>}/>
|
|
|
|
<Route path="servers" element={<Lazy><PlayerServers/></Lazy>}/>
|
|
|
|
<Route path="plugins/:serverName" element={<Lazy><PlayerPluginData/></Lazy>}/>
|
2022-04-06 16:37:23 +02:00
|
|
|
<Route path="*" element={<ErrorView error={{
|
|
|
|
message: 'Unknown tab address, please correct the address',
|
|
|
|
title: 'No such tab',
|
|
|
|
icon: faMapSigns
|
|
|
|
}}/>}/>
|
|
|
|
</Route>
|
2022-09-01 18:50:16 +02:00
|
|
|
<Route path="/players" element={<Lazy><PlayersPage/></Lazy>}>
|
|
|
|
<Route path="" element={<Lazy><AllPlayers/></Lazy>}/>
|
|
|
|
<Route path="*" element={<Lazy><AllPlayers/></Lazy>}/>
|
2022-06-05 21:09:46 +02:00
|
|
|
</Route>
|
2022-09-01 18:50:16 +02:00
|
|
|
<Route path="/server/:identifier" element={<Lazy><ServerPage/></Lazy>}>
|
|
|
|
<Route path="" element={<Lazy><OverviewRedirect/></Lazy>}/>
|
|
|
|
<Route path="overview" element={<Lazy><ServerOverview/></Lazy>}/>
|
|
|
|
<Route path="online-activity" element={<Lazy><OnlineActivity/></Lazy>}/>
|
|
|
|
<Route path="sessions" element={<Lazy><ServerSessions/></Lazy>}/>
|
|
|
|
<Route path="pvppve" element={<Lazy><ServerPvpPve/></Lazy>}/>
|
|
|
|
<Route path="playerbase" element={<Lazy><PlayerbaseOverview/></Lazy>}/>
|
2022-09-05 15:56:59 +02:00
|
|
|
<Route path="join-addresses" element={<Lazy><ServerJoinAddresses/></Lazy>}/>
|
2022-05-22 09:57:06 +02:00
|
|
|
<Route path="retention" element={<></>}/>
|
2022-09-01 18:50:16 +02:00
|
|
|
<Route path="players" element={<Lazy><ServerPlayers/></Lazy>}/>
|
|
|
|
<Route path="geolocations" element={<Lazy><ServerGeolocations/></Lazy>}/>
|
|
|
|
<Route path="performance" element={<Lazy><ServerPerformance/></Lazy>}/>
|
|
|
|
<Route path="plugins-overview" element={<Lazy><ServerPluginData/></Lazy>}/>
|
|
|
|
<Route path="plugins/:plugin" element={<Lazy><ServerWidePluginData/></Lazy>}/>
|
2022-08-18 17:27:11 +02:00
|
|
|
<Route path="*" element={<ErrorView error={{
|
|
|
|
message: 'Unknown tab address, please correct the address',
|
|
|
|
title: 'No such tab',
|
|
|
|
icon: faMapSigns
|
|
|
|
}}/>}/>
|
2022-04-06 16:37:23 +02:00
|
|
|
</Route>
|
2022-09-03 13:01:15 +02:00
|
|
|
<Route path="/network" element={<Lazy><NetworkPage/></Lazy>}>
|
|
|
|
<Route path="" element={<Lazy><OverviewRedirect/></Lazy>}/>
|
2022-09-04 08:40:17 +02:00
|
|
|
<Route path="overview" element={<Lazy><NetworkOverview/></Lazy>}/>
|
2022-09-09 18:10:06 +02:00
|
|
|
<Route path="serversOverview" element={<Lazy><NetworkServers/></Lazy>}/>
|
2022-09-10 08:38:25 +02:00
|
|
|
<Route path="sessions" element={<Lazy><NetworkSessions/></Lazy>}/>
|
2022-09-11 08:42:03 +02:00
|
|
|
<Route path="playerbase" element={<Lazy><NetworkPlayerbaseOverview/></Lazy>}/>
|
2022-09-10 09:45:03 +02:00
|
|
|
<Route path="join-addresses" element={<Lazy><NetworkJoinAddresses/></Lazy>}/>
|
2022-09-03 13:01:15 +02:00
|
|
|
<Route path="players" element={<Lazy><AllPlayers/></Lazy>}/>
|
2022-09-11 08:30:33 +02:00
|
|
|
<Route path="geolocations" element={<Lazy><NetworkGeolocations/></Lazy>}/>
|
2022-09-03 13:01:15 +02:00
|
|
|
<Route path="plugins-overview" element={<Lazy><ServerPluginData/></Lazy>}/>
|
|
|
|
<Route path="plugins/:plugin" element={<Lazy><ServerWidePluginData/></Lazy>}/>
|
|
|
|
<Route path="*" element={<ErrorView error={{
|
|
|
|
message: 'Unknown tab address, please correct the address',
|
|
|
|
title: 'No such tab',
|
|
|
|
icon: faMapSigns
|
|
|
|
}}/>}/>
|
|
|
|
</Route>
|
2022-09-01 18:50:16 +02:00
|
|
|
<Route path="/errors" element={<Lazy><ErrorsPage/></Lazy>}/>
|
|
|
|
<Route path="/docs" element={<Lazy><SwaggerView/></Lazy>}/>
|
2022-04-06 16:37:23 +02:00
|
|
|
</Routes>
|
|
|
|
</BrowserRouter>
|
|
|
|
</div>
|
|
|
|
</ContextProviders>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default App;
|