diff --git a/src/App.jsx b/src/App.jsx index 276f9dcc21a5..422ebac60c62 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,8 +1,8 @@ import React, { Suspense } from 'react' -import { BrowserRouter, Route, Routes, Navigate } from 'react-router-dom' +import { BrowserRouter, Route, Routes, Navigate, useLocation } from 'react-router-dom' import { PrivateRoute, FullScreenLoading, ErrorBoundary } from 'src/components/utilities' import 'src/scss/style.scss' -import { Helmet } from 'react-helmet-async' +import { Helmet, HelmetProvider } from 'react-helmet-async' import Skeleton from 'react-loading-skeleton' import TimeAgo from 'javascript-time-ago' import en from 'javascript-time-ago/locale/en.json' @@ -10,7 +10,6 @@ TimeAgo.addDefaultLocale(en) import { library } from '@fortawesome/fontawesome-svg-core' import { fas } from '@fortawesome/free-solid-svg-icons' import routes from 'src/routes' -import { useAuthCheck } from './components/utilities/CippauthCheck' import importsMap from './importsMap' library.add(fas) @@ -32,59 +31,58 @@ const Logout = React.lazy(() => import('./views/pages/login/Logout')) const App = () => { return ( - }> - - CIPP - - - } /> - } /> - } /> - } /> - } /> - } /> - } /> - - - - } - > - {routes.map((route, idx) => { - const allowedRoles = route.allowedRoles - const Routecomponent = dynamicImport(route.path) - //console.log('route', route) - //console.log('Routecomponent', Routecomponent) - return ( - route.component && ( - - }> - - CIPP - {route.name} - - - - - - - } - /> + + }> + + CIPP + + + } /> + } /> + } /> + } /> + } /> + } /> + } /> + + + + } + > + {routes.map((route, idx) => { + const allowedRoles = route.allowedRoles + const Routecomponent = dynamicImport(route.path) + //console.log('route', route) + //console.log('Routecomponent', Routecomponent) + return ( + route.component && ( + + }> + + + + + + } + /> + ) ) - ) - })} - } /> - - } /> - - + })} + } /> + + } /> + + + ) } diff --git a/src/hooks/useNavFavouriteCheck.jsx b/src/hooks/useNavFavouriteCheck.jsx index 1f04018f089e..dc53534dfddc 100644 --- a/src/hooks/useNavFavouriteCheck.jsx +++ b/src/hooks/useNavFavouriteCheck.jsx @@ -28,7 +28,7 @@ export const useNavFavouriteCheck = (navigation) => { var items = [] recentPages.map((path) => { - const item = routes.find((route) => route.path === path) + const item = routes.find((route) => route.path.toLowerCase() === path.toLowerCase()) if (item?.path) { items.push({ name: item.name, diff --git a/src/layout/DefaultLayout.jsx b/src/layout/DefaultLayout.jsx index aa39ae8273b3..0b08e4ad8b8c 100644 --- a/src/layout/DefaultLayout.jsx +++ b/src/layout/DefaultLayout.jsx @@ -8,6 +8,8 @@ import { toggleSwitcher } from 'src/store/features/switcher' import { useHotkeys } from 'react-hotkeys-hook' import { useMediaPredicate } from 'react-media-hook' import { setRecentPages } from 'src/store/features/app' +import routes from 'src/routes' +import { Helmet } from 'react-helmet-async' const DefaultLayout = () => { const preferredTheme = useMediaPredicate('(prefers-color-scheme: dark)') ? 'impact' : 'cyberdrain' @@ -17,6 +19,15 @@ const DefaultLayout = () => { const dispatch = useDispatch() const location = useLocation() + const [title, setTitle] = useState('CIPP') + useEffect(() => { + let route = routes.find((route) => route.path.toLowerCase() === location.pathname.toLowerCase()) + if (route?.name) { + console.log(route) + setTitle(route.name) + } + }, [setTitle, location.pathname]) + let theme if (themePreference === 'default') { theme = preferredTheme @@ -70,24 +81,29 @@ const DefaultLayout = () => { ) return ( -
- - - + <> + + CIPP - {title} + +
+ + + - -
- -
- - }> - - - + +
+ +
+ + }> + + + +
+
-
-
+ ) } diff --git a/src/views/email-exchange/tools/MailTest.jsx b/src/views/email-exchange/tools/MailTest.jsx index d433e658dba3..633d351fd489 100644 --- a/src/views/email-exchange/tools/MailTest.jsx +++ b/src/views/email-exchange/tools/MailTest.jsx @@ -40,22 +40,22 @@ const MailTest = () => { }, { name: 'SPF', - selector: (row) => row?.AuthResult.filter((x) => x?.Name === 'spf')[0].Status == 'pass', + selector: (row) => row?.AuthResult.filter((x) => x?.Name === 'spf')[0]?.Status == 'pass', cell: cellBooleanFormatter(), }, { name: 'DKIM', - selector: (row) => row?.AuthResult.filter((x) => x?.Name === 'dkim')[0].Status == 'pass', + selector: (row) => row?.AuthResult.filter((x) => x?.Name === 'dkim')[0]?.Status == 'pass', cell: cellBooleanFormatter(), }, { name: 'DMARC', - selector: (row) => row?.AuthResult.filter((x) => x?.Name === 'dmarc')[0].Status == 'pass', + selector: (row) => row?.AuthResult.filter((x) => x?.Name === 'dmarc')[0]?.Status == 'pass', cell: cellBooleanFormatter(), }, { name: 'Comp Auth', - selector: (row) => row?.AuthResult.filter((x) => x?.Name === 'compauth')[0].Status == 'pass', + selector: (row) => row?.AuthResult.filter((x) => x?.Name === 'compauth')[0]?.Status == 'pass', cell: cellBooleanFormatter(), }, {