()
| 31 | import "bootstrap/dist/css/bootstrap.css"; |
| 32 | |
| 33 | export 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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected