diff --git a/src/main/webui/src/components/AppRouter.test.tsx b/src/main/webui/src/components/AppRouter.test.tsx index e0c7a148..310bfec5 100644 --- a/src/main/webui/src/components/AppRouter.test.tsx +++ b/src/main/webui/src/components/AppRouter.test.tsx @@ -1,10 +1,15 @@ import React from "react"; import { render } from "@testing-library/react"; import AppRouter from "./AppRouter"; +import { BrowserRouter } from "react-router-dom"; describe(" spec", () => { it("renders the AppRouter", () => { - const view = render(); + const view = render( + + + + ); expect(view).toMatchSnapshot(); }); }); diff --git a/src/main/webui/src/components/AppRouter.tsx b/src/main/webui/src/components/AppRouter.tsx index 62922da3..7cd2bf8d 100644 --- a/src/main/webui/src/components/AppRouter.tsx +++ b/src/main/webui/src/components/AppRouter.tsx @@ -11,7 +11,6 @@ import NotFoundPage from "../views/404"; const AppRouter = () => { const { isAdmin } = useUserContext(); return ( - } /> } /> @@ -38,7 +37,6 @@ const AppRouter = () => { /> } /> - ); }; diff --git a/src/main/webui/src/components/nav/NavigationDrawer.test.tsx b/src/main/webui/src/components/nav/NavigationDrawer.test.tsx index fc5ea2b2..07fdf9ef 100644 --- a/src/main/webui/src/components/nav/NavigationDrawer.test.tsx +++ b/src/main/webui/src/components/nav/NavigationDrawer.test.tsx @@ -1,9 +1,14 @@ import { render } from "@testing-library/react"; import NavigationDrawer from "./NavigationDrawer"; +import { BrowserRouter } from "react-router-dom"; describe(" spec", () => { it("renders the NavigationDrawer", () => { - const view = render(); + const view = render( + + + + ); expect(view).toMatchSnapshot(); }); }); diff --git a/src/main/webui/src/components/nav/NavigationDrawer.tsx b/src/main/webui/src/components/nav/NavigationDrawer.tsx index af4985e4..cf4d94e9 100644 --- a/src/main/webui/src/components/nav/NavigationDrawer.tsx +++ b/src/main/webui/src/components/nav/NavigationDrawer.tsx @@ -7,12 +7,13 @@ import { ListItemButton, ListItemIcon, ListItemText, - Toolbar, + Toolbar } from "@mui/material"; import ViewModuleIcon from "@mui/icons-material/ViewModule"; import AppsIcon from "@mui/icons-material/Apps"; import KeyIcon from "@mui/icons-material/Key"; import { useUserContext } from "../context/UserContext"; +import { Link } from "react-router-dom"; const NavigationDrawer = () => { const { isAdmin } = useUserContext(); @@ -22,14 +23,14 @@ const NavigationDrawer = () => { width: 240, flexShrink: 0, "& .MuiDivider-root": { - display: "none", + display: "none" }, "& .MuiDrawer-paper": { width: 240, boxSizing: "border-box", backgroundColor: "transparent", - border: "none", - }, + border: "none" + } }} variant="permanent" anchor="left" @@ -39,8 +40,8 @@ const NavigationDrawer = () => { @@ -52,8 +53,8 @@ const NavigationDrawer = () => { @@ -66,8 +67,8 @@ const NavigationDrawer = () => { {isAdmin ? ( diff --git a/src/main/webui/src/index.tsx b/src/main/webui/src/index.tsx index b103ef1f..daf26b4b 100644 --- a/src/main/webui/src/index.tsx +++ b/src/main/webui/src/index.tsx @@ -12,6 +12,7 @@ import CssBaseline from "@mui/material/CssBaseline"; import { Box, Stack } from "@mui/material"; import NavigationDrawer from "./components/nav/NavigationDrawer"; import { UserProvider } from "./components/context/UserContext"; +import { BrowserRouter as Router } from "react-router-dom"; const fetchUser = async () => { const response = await fetch("/tapir/user"); @@ -21,7 +22,7 @@ const fetchUser = async () => { const user = await fetchUser(); const root = ReactDOM.createRoot( - document.getElementById("root") as HTMLElement, + document.getElementById("root") as HTMLElement ); root.render( @@ -29,12 +30,14 @@ root.render(
- - - - + + + + + +