diff --git a/src/common/layouts/Root/Root.jsx b/src/common/layouts/Root/Root.jsx index 9a04e9c..60dde8d 100644 --- a/src/common/layouts/Root/Root.jsx +++ b/src/common/layouts/Root/Root.jsx @@ -1,15 +1,28 @@ import Navigation from "@components/Navigation"; -import {Outlet} from "react-router-dom"; +import {Outlet, useLocation} from "react-router-dom"; import {Box, Toolbar} from "@mui/material"; import Footer from "@components/Footer"; +import {useEffect} from "react"; +import routes from "@/common/routes"; +import footerRoutes from "@/common/routes/footer.jsx"; -export const Root = () => <> - <Navigation/> +export const Root = () => { + const location = useLocation(); - <Box height="100vh" display="flex" flexDirection="column" sx={{ml: 5, mr: 5}}> - <Toolbar/> - <Outlet/> + useEffect(() => { + [...routes, ...footerRoutes].forEach(route => { + if (route.path === location.pathname) document.title = `LicenseAPI - ${route.name}`; + }); + }, [location]); - <Footer/> - </Box> -</> \ No newline at end of file + return (<> + <Navigation/> + + <Box height="100vh" display="flex" flexDirection="column" sx={{ml: 5, mr: 5}}> + <Toolbar/> + <Outlet/> + + <Footer/> + </Box> + </>); +} \ No newline at end of file