diff --git a/src/RootApp.tsx b/src/RootApp.tsx index 956e57b1bb..26f12eb39b 100644 --- a/src/RootApp.tsx +++ b/src/RootApp.tsx @@ -11,6 +11,8 @@ import { HistoryRouter } from 'components/router/HistoryRouter'; import { ApiProvider } from 'hooks/useApi'; import { WebConfigProvider } from 'hooks/useWebConfig'; import theme from 'themes/theme'; +import { useLocation } from 'react-router-dom'; +import { DASHBOARD_APP_PATHS } from './apps/dashboard/App'; const DashboardApp = loadable(() => import('./apps/dashboard/App')); const ExperimentalApp = loadable(() => import('./apps/experimental/App')); @@ -22,10 +24,14 @@ const RootAppLayout = () => { const layoutMode = localStorage.getItem('layout'); const isExperimentalLayout = layoutMode === 'experimental'; + const location = useLocation(); + const isNewLayoutPath = Object.values(DASHBOARD_APP_PATHS) + .some(path => location.pathname.startsWith(`/${path}`)); + return ( <> - + { isExperimentalLayout ? diff --git a/src/apps/dashboard/App.tsx b/src/apps/dashboard/App.tsx index 232c8e77cb..2127a807f7 100644 --- a/src/apps/dashboard/App.tsx +++ b/src/apps/dashboard/App.tsx @@ -25,25 +25,31 @@ const toDashboardAsyncPageRoute = (route: AsyncRoute) => ( }) ); +export const DASHBOARD_APP_PATHS = { + Dashboard: 'dashboard', + MetadataManager: 'metadata', + PluginConfig: 'configurationpage' +}; + const DashboardApp = () => ( }> }> - + {ASYNC_ADMIN_ROUTES.map(toDashboardAsyncPageRoute)} {LEGACY_ADMIN_ROUTES.map(toViewManagerPageRoute)} {/* TODO: Should the metadata manager be a separate app? */} {toViewManagerPageRoute({ - path: 'metadata', + path: DASHBOARD_APP_PATHS.MetadataManager, pageProps: { controller: 'edititemmetadata', view: 'edititemmetadata.html' } })} - } /> diff --git a/src/apps/dashboard/AppLayout.tsx b/src/apps/dashboard/AppLayout.tsx index 1e427d3c6e..19fe09e1ba 100644 --- a/src/apps/dashboard/AppLayout.tsx +++ b/src/apps/dashboard/AppLayout.tsx @@ -1,29 +1,15 @@ -import { ThemeProvider } from '@mui/material/styles'; import React from 'react'; import { Outlet } from 'react-router-dom'; -import AppHeader from 'components/AppHeader'; -import Backdrop from 'components/Backdrop'; -import theme from 'themes/theme'; +import AppBody from 'components/AppBody'; + +import '../experimental/AppOverrides.scss'; const AppLayout = () => { return ( - - - - - {/* - * TODO: These components are not used, but views interact with them directly so the need to be - * present in the dom. We add them in a hidden element to prevent errors. - */} - - - - - - - - + + + ); }; diff --git a/src/apps/experimental/App.tsx b/src/apps/experimental/App.tsx index a4f67e7957..d804352f94 100644 --- a/src/apps/experimental/App.tsx +++ b/src/apps/experimental/App.tsx @@ -10,6 +10,7 @@ import { toRedirectRoute } from 'components/router/Redirect'; import AppLayout from './AppLayout'; import { ASYNC_USER_ROUTES } from './routes/asyncRoutes'; import { LEGACY_PUBLIC_ROUTES, LEGACY_USER_ROUTES } from './routes/legacyRoutes'; +import { DASHBOARD_APP_PATHS } from 'apps/dashboard/App'; const ExperimentalApp = () => { return ( @@ -33,9 +34,13 @@ const ExperimentalApp = () => { {REDIRECTS.map(toRedirectRoute)} {/* Ignore dashboard routes */} - - - + {Object.entries(DASHBOARD_APP_PATHS).map(([ key, path ]) => ( + + ))} ); }; diff --git a/src/apps/stable/App.tsx b/src/apps/stable/App.tsx index de6cdddb90..f9103eb6ea 100644 --- a/src/apps/stable/App.tsx +++ b/src/apps/stable/App.tsx @@ -5,11 +5,12 @@ import AppBody from 'components/AppBody'; import ConnectionRequired from 'components/ConnectionRequired'; import { toAsyncPageRoute } from 'components/router/AsyncRoute'; import { toViewManagerPageRoute } from 'components/router/LegacyRoute'; +import { toRedirectRoute } from 'components/router/Redirect'; import { ASYNC_USER_ROUTES } from './routes/asyncRoutes'; import { LEGACY_PUBLIC_ROUTES, LEGACY_USER_ROUTES } from './routes/legacyRoutes'; import { REDIRECTS } from './routes/_redirects'; -import { toRedirectRoute } from 'components/router/Redirect'; +import { DASHBOARD_APP_PATHS } from 'apps/dashboard/App'; const Layout = () => ( @@ -34,9 +35,13 @@ const StableApp = () => ( {/* Ignore dashboard routes */} - - - + {Object.entries(DASHBOARD_APP_PATHS).map(([ key, path ]) => ( + + ))} {/* Suppress warnings for unhandled routes */}