Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install react router 6 in accredited representative portal #33339

Merged
merged 18 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,13 @@
"src/applications/check-in",
"src/applications/vaos",
"src/applications/claims-status",
"src/applications/accredited-representative-portal/accreditation/21a"
"src/applications/accredited-representative-portal/accreditation/21a",
"src/applications/accredited-representative-portal"
],
"nohoist": [
"**/applications/accredited-representative-portal/accreditation/21a/react-router",
"**/applications-accredited-representative-portal/accreditation/21a/react-router",
"**/applications-accredited-representative-portal/accreditation/21a/history",
"**/applications-accredited-representative-portal/react-router-dom",
"**/applications-check-in/i18next-resources-to-backend",
"**/applications-check-in/react-i18next",
"**/applications-claims-status/@department-of-veterans-affairs/component-library",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import '@department-of-veterans-affairs/platform-polyfills';

import React from 'react';
import { Provider } from 'react-redux';
import { BrowserRouter } from 'react-router-dom-v5-compat';
import { RouterProvider } from 'react-router-dom';

import startReactApp from '@department-of-veterans-affairs/platform-startup/react';
import { connectFeatureToggle } from 'platform/utilities/feature-toggles';
Expand All @@ -12,7 +12,7 @@ import './sass/POARequestsCard.scss';
import './sass/POARequestDetails.scss';

import manifest from './manifest.json';
import routes from './routes';
import router from './routes';
import createReduxStore from './store';
import rootReducer from './reducers';

Expand All @@ -22,6 +22,6 @@ connectFeatureToggle(store.dispatch);

startReactApp(
<Provider store={store}>
<BrowserRouter basename={manifest.rootUrl}>{routes}</BrowserRouter>
<RouterProvider router={router} />
</Provider>,
);
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Link } from 'react-router-dom-v5-compat';
import { Link } from 'react-router-dom';
import PropTypes from 'prop-types';

const LandingPageWelcome = ({ firstName = '', children }) => (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import { Link } from 'react-router-dom-v5-compat';
import { Link } from 'react-router-dom';
import {
formatDateParsedZoneLong,
timeFromNow,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { useLocation } from 'react-router-dom-v5-compat';
import { useLocation } from 'react-router-dom';
import upperFirst from 'lodash/upperFirst';
import lowerCase from 'lodash/lowerCase';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { Outlet } from 'react-router-dom-v5-compat';
import { Outlet } from 'react-router';

import { VaLoadingIndicator } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
import environment from '@department-of-veterans-affairs/platform-utilities/environment';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import { useParams, Link } from 'react-router-dom-v5-compat';
import { useParams, Link } from 'react-router-dom';
import { formatDateShort } from 'platform/utilities/date/index';
import usePOARequests from '../hooks/usePOARequests';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import { Outlet } from 'react-router-dom-v5-compat';
import { Outlet } from 'react-router-dom';

import { VaLoadingIndicator } from '@department-of-veterans-affairs/component-library/dist/react-bindings';

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@department-of-veterans-affairs/applications-accredited-representative-portal",
"version": "1.0.0",
"private": true,
"dependencies": {
"react-router-dom": "^6.28.0"
}
}
43 changes: 31 additions & 12 deletions src/applications/accredited-representative-portal/routes.jsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,40 @@
import React from 'react';
import { Route, Routes } from 'react-router-dom-v5-compat';
import { createBrowserRouter } from 'react-router-dom';

import App from './containers/App';
import LandingPage from './containers/LandingPage';
import POARequestsPage from './containers/POARequestsPage';
import SignedInLayoutWrapper from './containers/SignedInLayoutWrapper';
import POARequestDetailsPage from './containers/POARequestDetailsPage';

const routes = (
<Routes>
<Route element={<App />}>
<Route index element={<LandingPage />} />
<Route element={<SignedInLayoutWrapper />}>
<Route path="poa-requests" element={<POARequestsPage />} />
<Route path="poa-requests/:id" element={<POARequestDetailsPage />} />
</Route>
</Route>
</Routes>
const router = createBrowserRouter(
[
{
element: <App />,
children: [
{
index: true,
element: <LandingPage />,
},
{
element: <SignedInLayoutWrapper />,
children: [
{
path: 'poa-requests',
element: <POARequestsPage />,
},
{
path: 'poa-requests/:id',
element: <POARequestDetailsPage />,
},
],
},
],
},
],
{
basename: '/representative',
},
);

export default routes;
export default router;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Provider } from 'react-redux';
import { MemoryRouter } from 'react-router-dom-v5-compat';
import { MemoryRouter } from 'react-router-dom';
import { render } from '@testing-library/react';

import createReduxStore from '../../../store';
Expand Down
Loading