MCPcopy Create free account
hub / github.com/StevenLyt/mapf-visualizer / App

Function App

src/App.js:33–65  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31import "bootstrap/dist/css/bootstrap.css";
32
33export default function App() {
34 const { pathname } = useLocation();
35
36 // Setting page scroll to 0 when changing the route
37 useEffect(() => {
38 document.documentElement.scrollTop = 0;
39 document.scrollingElement.scrollTop = 0;
40 }, [pathname]);
41
42 const getRoutes = (allRoutes) =>
43 allRoutes.map((route) => {
44 if (route.collapse) {
45 return getRoutes(route.collapse);
46 }
47
48 if (route.route) {
49 return <Route exact path={route.route} element={route.component} key={route.key} />;
50 }
51
52 return null;
53 });
54
55 return (
56 <ThemeProvider theme={theme}>
57 <CssBaseline />
58 <Routes>
59 {getRoutes(routes)}
60 <Route path="/" element={<Presentation />} />
61 <Route path="*" element={<Navigate to="/" />} />
62 </Routes>
63 </ThemeProvider>
64 );
65}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected