diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 7d828e4f7..909c64922 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,3 +1,14 @@ +## June 6, 2024 + +- **Feature** Use createBrowserRouter insead of \ in the App component [🎟️ DESENG-627](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-627) + - Updated the App component to use the more flexible createBrowserRouter function instead of the component + - This enables the use of [data router](https://reactrouter.com/en/6.23.0/routers/picking-a-router) functionality and other advanced features in the future, most notably the Blocker component + - Added the AutoBreadcrumbs component to the common components library, which will be used to generate breadcrumbs based on the current route + - Updated the Tenant Admin pages as a proof of concept + - Tenant Admin pages now use the AutoBreadcrumbs component to generate breadcrumbs based on the current route + - Tenant Admin pages use data loaders to fetch data from the API instead of relying on a state or context + - Tenant Admin pages use useBlocker() to prompt for confirmation from users navigating away from the page when they're in the middle of editing a form + ## June 3, 2024 - **Bugfix** Patch button styles (follow-up to [🎟️ DESENG-583](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-583)) @@ -7,6 +18,7 @@ ## May 30, 2024 - **Feature** Remove web components [🎟️ DESENG-616](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-616) + - Removed web components and all code that references it - **Feature** Remove EAO process widget [🎟️ DESENG-626](https://apps.itsm.gov.bc.ca/jira/browse/DESENG-626) diff --git a/met-web/package-lock.json b/met-web/package-lock.json index 1f2a20c6f..c6d7ff152 100644 --- a/met-web/package-lock.json +++ b/met-web/package-lock.json @@ -74,7 +74,7 @@ "react-map-gl": "^7.0.21", "react-player": "^2.12.0", "react-redux": "^7.2.8", - "react-router-dom": "^6.10.0", + "react-router-dom": "^6.23.1", "react-scripts": "^5.0.1", "react-svg": "^15.0.1", "recharts": "^2.4.3", @@ -4815,11 +4815,11 @@ } }, "node_modules/@remix-run/router": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.5.0.tgz", - "integrity": "sha512-bkUDCp8o1MvFO+qxkODcbhSqRa6P2GXgrGZVpt0dCXNW2HCSCqYI0ZoAqEOSAjRWmmlKcYgFvN4B4S+zo/f8kg==", + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.16.1.tgz", + "integrity": "sha512-es2g3dq6Nb07iFxGk5GuHN20RwBZOsuDQN7izWIisUcv9r+d2C5jQxqmgkdebXgReWfiyUabcki6Fg77mSNrig==", "engines": { - "node": ">=14" + "node": ">=14.0.0" } }, "node_modules/@rollup/plugin-babel": { @@ -21103,29 +21103,29 @@ } }, "node_modules/react-router": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.10.0.tgz", - "integrity": "sha512-Nrg0BWpQqrC3ZFFkyewrflCud9dio9ME3ojHCF/WLsprJVzkq3q3UeEhMCAW1dobjeGbWgjNn/PVF6m46ANxXQ==", + "version": "6.23.1", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.23.1.tgz", + "integrity": "sha512-fzcOaRF69uvqbbM7OhvQyBTFDVrrGlsFdS3AL+1KfIBtGETibHzi3FkoTRyiDJnWNc2VxrfvR+657ROHjaNjqQ==", "dependencies": { - "@remix-run/router": "1.5.0" + "@remix-run/router": "1.16.1" }, "engines": { - "node": ">=14" + "node": ">=14.0.0" }, "peerDependencies": { "react": ">=16.8" } }, "node_modules/react-router-dom": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.10.0.tgz", - "integrity": "sha512-E5dfxRPuXKJqzwSe/qGcqdwa18QiWC6f3H3cWXM24qj4N0/beCIf/CWTipop2xm7mR0RCS99NnaqPNjHtrAzCg==", + "version": "6.23.1", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.23.1.tgz", + "integrity": "sha512-utP+K+aSTtEdbWpC+4gxhdlPFwuEfDKq8ZrPFU65bbRJY+l706qjR7yaidBpo3MSeA/fzwbXWbKBI6ftOnP3OQ==", "dependencies": { - "@remix-run/router": "1.5.0", - "react-router": "6.10.0" + "@remix-run/router": "1.16.1", + "react-router": "6.23.1" }, "engines": { - "node": ">=14" + "node": ">=14.0.0" }, "peerDependencies": { "react": ">=16.8", @@ -29626,9 +29626,9 @@ } }, "@remix-run/router": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.5.0.tgz", - "integrity": "sha512-bkUDCp8o1MvFO+qxkODcbhSqRa6P2GXgrGZVpt0dCXNW2HCSCqYI0ZoAqEOSAjRWmmlKcYgFvN4B4S+zo/f8kg==" + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.16.1.tgz", + "integrity": "sha512-es2g3dq6Nb07iFxGk5GuHN20RwBZOsuDQN7izWIisUcv9r+d2C5jQxqmgkdebXgReWfiyUabcki6Fg77mSNrig==" }, "@rollup/plugin-babel": { "version": "5.3.1", @@ -41818,20 +41818,20 @@ } }, "react-router": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.10.0.tgz", - "integrity": "sha512-Nrg0BWpQqrC3ZFFkyewrflCud9dio9ME3ojHCF/WLsprJVzkq3q3UeEhMCAW1dobjeGbWgjNn/PVF6m46ANxXQ==", + "version": "6.23.1", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.23.1.tgz", + "integrity": "sha512-fzcOaRF69uvqbbM7OhvQyBTFDVrrGlsFdS3AL+1KfIBtGETibHzi3FkoTRyiDJnWNc2VxrfvR+657ROHjaNjqQ==", "requires": { - "@remix-run/router": "1.5.0" + "@remix-run/router": "1.16.1" } }, "react-router-dom": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.10.0.tgz", - "integrity": "sha512-E5dfxRPuXKJqzwSe/qGcqdwa18QiWC6f3H3cWXM24qj4N0/beCIf/CWTipop2xm7mR0RCS99NnaqPNjHtrAzCg==", + "version": "6.23.1", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.23.1.tgz", + "integrity": "sha512-utP+K+aSTtEdbWpC+4gxhdlPFwuEfDKq8ZrPFU65bbRJY+l706qjR7yaidBpo3MSeA/fzwbXWbKBI6ftOnP3OQ==", "requires": { - "@remix-run/router": "1.5.0", - "react-router": "6.10.0" + "@remix-run/router": "1.16.1", + "react-router": "6.23.1" } }, "react-scripts": { diff --git a/met-web/package.json b/met-web/package.json index 4607e85e3..dec3a8b97 100644 --- a/met-web/package.json +++ b/met-web/package.json @@ -69,7 +69,7 @@ "react-map-gl": "^7.0.21", "react-player": "^2.12.0", "react-redux": "^7.2.8", - "react-router-dom": "^6.10.0", + "react-router-dom": "^6.23.1", "react-scripts": "^5.0.1", "react-svg": "^15.0.1", "recharts": "^2.4.3", diff --git a/met-web/src/App.tsx b/met-web/src/App.tsx index 8413a16f8..8ede5f481 100644 --- a/met-web/src/App.tsx +++ b/met-web/src/App.tsx @@ -1,24 +1,22 @@ import React, { useEffect, useState, useContext } from 'react'; import '@bcgov/design-tokens/css-prefixed/variables.css'; // Will be available to use in all component import './App.scss'; -import { Route, BrowserRouter as Router, Routes } from 'react-router-dom'; +import { + Route, + BrowserRouter as Router, + RouterProvider, + Routes, + createBrowserRouter, + createRoutesFromElements, +} from 'react-router-dom'; import { useAppSelector, useAppDispatch } from './hooks'; -import { MidScreenLoader, MobileToolbar } from './components/common'; -import { Box, Container, useMediaQuery, Theme } from '@mui/material'; -import InternalHeader from './components/layout/Header/InternalHeader'; -import PublicHeader from './components/layout/Header/PublicHeader'; +import { MidScreenLoader } from './components/common'; import UnauthenticatedRoutes from './routes/UnauthenticatedRoutes'; import AuthenticatedRoutes from './routes/AuthenticatedRoutes'; -import { Notification } from 'components/common/notification'; -import PageViewTracker from 'routes/PageViewTracker'; -import { NotificationModal } from 'components/common/modal'; -import { FeedbackModal } from 'components/feedback/FeedbackModal'; import { AppConfig } from 'config'; import NoAccess from 'routes/NoAccess'; import { getTenant } from 'services/tenantService'; import NotFound from 'routes/NotFound'; -import Footer from 'components/layout/Footer'; -import { ZIndex } from 'styles/Theme'; import { TenantState, loadingTenant, saveTenant } from 'reduxSlices/tenantSlice'; import { LanguageState } from 'reduxSlices/languageSlice'; import { openNotification } from 'services/notificationService/notificationSlice'; @@ -27,6 +25,8 @@ import DocumentTitle from 'DocumentTitle'; import { Languages } from 'constants/language'; import { AuthKeyCloakContext } from './components/auth/AuthKeycloakContext'; import { determinePathSegments, findTenantInPath } from './utils'; +import { AuthenticatedLayout } from 'components/appLayouts/AuthenticatedLayout'; +import { PublicLayout } from 'components/appLayouts/PublicLayout'; interface Translations { [languageId: string]: { [key: string]: string }; @@ -34,7 +34,6 @@ interface Translations { const App = () => { const drawerWidth = 280; - const isMediumScreen: boolean = useMediaQuery((theme: Theme) => theme.breakpoints.up('md')); const dispatch = useAppDispatch(); const roles = useAppSelector((state) => state.user.roles); const authenticationLoading = useAppSelector((state) => state.user.authentication.loading); @@ -203,71 +202,49 @@ const App = () => { } if (!isAuthenticated) { - return ( - - - - - - - - -