2021-04-21 00:23:35 +02:00
|
|
|
import classNames from "classnames"
|
|
|
|
import Style from "./App.module.css"
|
2021-04-21 15:08:54 +02:00
|
|
|
import Layout from "./components/Layout"
|
2021-04-21 15:37:12 +02:00
|
|
|
import ContextTheme from "./contexts/ContextTheme"
|
2021-04-21 18:00:21 +02:00
|
|
|
import { BrowserRouter } from "react-router-dom"
|
2021-04-21 18:21:30 +02:00
|
|
|
import { Route, Switch } from "react-router"
|
2021-04-25 17:22:52 +02:00
|
|
|
import PageDashboard from "./routes/PageDashboard"
|
2021-04-21 18:21:30 +02:00
|
|
|
import PageRepositories from "./routes/PageRepositories"
|
|
|
|
import PageAlerts from "./routes/PageAlerts"
|
|
|
|
import PageSettings from "./routes/PageSettings"
|
2021-04-22 18:06:50 +02:00
|
|
|
import PageSandbox from "./routes/PageSandbox"
|
2021-04-23 01:29:51 +02:00
|
|
|
import useSavedTheme from "./hooks/useSavedTheme"
|
2021-04-25 17:22:52 +02:00
|
|
|
import PageLogin from "./routes/PageLogin"
|
|
|
|
import useSavedLogin from "./hooks/useSavedLogin"
|
|
|
|
import ContextLogin from "./contexts/ContextLogin"
|
|
|
|
import PageRoot from "./routes/PageRoot"
|
2021-04-21 00:09:13 +02:00
|
|
|
|
2021-04-21 00:07:39 +02:00
|
|
|
|
2021-04-23 02:18:06 +02:00
|
|
|
/**
|
|
|
|
* The main component of the webapp, the root of the render tree, what is displayed when the web page is visited.
|
|
|
|
*
|
|
|
|
* @returns {JSX.Element}
|
|
|
|
* @constructor
|
|
|
|
*/
|
2021-04-21 00:23:35 +02:00
|
|
|
export default function App() {
|
2021-04-25 17:22:52 +02:00
|
|
|
const theme = useSavedTheme();
|
|
|
|
const login = useSavedLogin();
|
2021-04-21 00:23:35 +02:00
|
|
|
|
2021-04-21 00:09:13 +02:00
|
|
|
return (
|
2021-04-25 17:22:52 +02:00
|
|
|
<ContextTheme.Provider value={theme}>
|
|
|
|
<ContextLogin.Provider value={login}>
|
2021-04-21 18:00:21 +02:00
|
|
|
<BrowserRouter>
|
|
|
|
|
2021-04-21 15:37:12 +02:00
|
|
|
<div className={classNames(Style.App, theme)}>
|
|
|
|
<Layout>
|
2021-04-21 18:21:30 +02:00
|
|
|
<Switch>
|
2021-04-25 17:22:52 +02:00
|
|
|
<Route path={"/login"} exact={true}>
|
|
|
|
<PageLogin/>
|
|
|
|
</Route>
|
2021-04-22 18:06:50 +02:00
|
|
|
<Route path={"/repositories"} exact={true}>
|
2021-04-21 18:21:30 +02:00
|
|
|
<PageRepositories/>
|
|
|
|
</Route>
|
2021-04-22 18:06:50 +02:00
|
|
|
<Route path={"/alerts"} exact={true}>
|
2021-04-21 18:21:30 +02:00
|
|
|
<PageAlerts/>
|
|
|
|
</Route>
|
2021-04-22 18:06:50 +02:00
|
|
|
<Route path={"/settings"} exact={true}>
|
2021-04-21 18:21:30 +02:00
|
|
|
<PageSettings/>
|
|
|
|
</Route>
|
2021-04-22 18:06:50 +02:00
|
|
|
<Route path={"/sandbox"} exact={true}>
|
|
|
|
<PageSandbox/>
|
|
|
|
</Route>
|
2021-04-25 17:22:52 +02:00
|
|
|
<Route path={"/dashboard"} exact={true}>
|
|
|
|
<PageDashboard/>
|
|
|
|
</Route>
|
|
|
|
<Route path={"/"}>
|
|
|
|
<PageRoot/>
|
2021-04-21 18:32:05 +02:00
|
|
|
</Route>
|
2021-04-21 18:21:30 +02:00
|
|
|
</Switch>
|
2021-04-21 15:37:12 +02:00
|
|
|
</Layout>
|
|
|
|
</div>
|
2021-04-21 18:00:21 +02:00
|
|
|
|
|
|
|
</BrowserRouter>
|
2021-04-25 17:22:52 +02:00
|
|
|
</ContextLogin.Provider>
|
2021-04-21 15:37:12 +02:00
|
|
|
</ContextTheme.Provider>
|
2021-04-21 00:09:13 +02:00
|
|
|
)
|
2021-04-21 00:07:39 +02:00
|
|
|
}
|