Skip to content

Commit

Permalink
EES 4809: Upgrade to NextJS v14 (#4785)
Browse files Browse the repository at this point in the history
NextJS in @frontend upgrade to v14; NextJS removed from @common; refactoring of some components, babel replaced with swc in @common and @frontend
  • Loading branch information
sambiramairelogic authored Apr 24, 2024
1 parent a780376 commit e1fe1b5
Show file tree
Hide file tree
Showing 33 changed files with 537 additions and 1,813 deletions.
1,495 changes: 209 additions & 1,286 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
MapContainer: () => {},
};
3 changes: 0 additions & 3 deletions src/explore-education-statistics-admin/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ module.exports = {
sourceMaps: true,
env: {
test: {
plugins: [
'explore-education-statistics-common/babel-url-import-meta-plugin.js',
],
presets: [
[
'@babel/preset-react',
Expand Down
1 change: 1 addition & 0 deletions src/explore-education-statistics-admin/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const config = {
'@azure/msal-react': '<rootDir>/test/stub.js',
'react-markdown':
'<rootDir>/node_modules/react-markdown/react-markdown.min.js',
'react-leaflet': '<rootDir>/__mocks__/reactLeafletMock.ts',
},
moduleFileExtensions: [
'web.js',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ import classNames from 'classnames';
import React, { ReactNode } from 'react';
import { Link as RouterLink, LinkProps } from 'react-router-dom';

import {
SetCommonButtonLink,
ButtonLinkType,
} from '@common/components/ButtonLink';

type Props = {
children: ReactNode;
className?: string;
Expand All @@ -32,6 +27,4 @@ const ButtonLink = ({ children, className, to, variant, ...props }: Props) => {
);
};

SetCommonButtonLink(ButtonLink as ButtonLinkType);

export default ButtonLink;
21 changes: 0 additions & 21 deletions src/explore-education-statistics-common/.babelrc

This file was deleted.

This file was deleted.

13 changes: 4 additions & 9 deletions src/explore-education-statistics-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"@radix-ui/react-dialog": "1.0.4",
"@tanstack/react-query": "4.32.0",
"axios": "^1.4.0",
"babel-preset-react-app": "^9.1.2",
"classnames": "^2.3.2",
"color2k": "^2.0.2",
"core-js": "^3.31.1",
Expand All @@ -30,14 +29,12 @@
"lodash": "^4.17.21",
"memoizee": "^0.4.14",
"nanoid": "^4.0.0",
"next": "^12.3.4",
"qs": "^6.11.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-helmet": "^6.1.0",
"react-highlight-words": "^0.20.0",
"react-hook-form": "7.43.9",
"react-lazyload":"github:twobin/react-lazyload#f1faffda816180f39d3ff8cf3d9c2060f8d9d623",
"react-lazyload": "github:twobin/react-lazyload#f1faffda816180f39d3ff8cf3d9c2060f8d9d623",
"react-leaflet": "^4.2.1",
"react-markdown": "^8.0.0",
"recharts": "^2.7.2",
Expand All @@ -49,8 +46,8 @@
"yup": "^1.3.3"
},
"devDependencies": {
"@swc/core": "^1.3.71",
"@swc/jest": "^0.2.27",
"@swc/core": "^1.4.17",
"@swc/jest": "^0.2.36",
"@testing-library/dom": "^9.3.4",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.2.1",
Expand All @@ -65,13 +62,11 @@
"@types/qs": "^6.9.7",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"@types/react-helmet": "^6.1.0",
"@types/react-highlight-words": "^0.16.4",
"@types/react-lazyload": "^3.2.3",
"@types/react-modal": "^3.16.0",
"@types/sanitize-html": "^2.9.0",
"@types/uuid": "^8.3.0",
"babel-jest": "^29.6.1",
"eslint": "^8.43.0",
"jest": "^29.6.1",
"jest-junit": "^16.0.0",
Expand Down Expand Up @@ -111,4 +106,4 @@
"suiteName": "Common Jest tests",
"outputName": "junit-common.xml"
}
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import ErrorPrefixPageTitle from '@common/components/ErrorPrefixPageTitle';
import classNames from 'classnames';
import React, {
forwardRef,
Expand Down Expand Up @@ -26,6 +25,14 @@ export const BaseErrorSummary = forwardRef<
>((props, ref) => {
const { children, testId = 'errorSummary', title, visuallyHidden } = props;

useEffect(() => {
document.title = `ERROR: ${document.title.replace(/ERROR: /g, '')}`;

return () => {
document.title = document.title.replace(/ERROR: /g, '');
};
}, []);

return (
<div
className={classNames('govuk-error-summary', {
Expand All @@ -37,9 +44,6 @@ export const BaseErrorSummary = forwardRef<
>
<div role="alert">
<h2 className="govuk-error-summary__title">{title}</h2>

<ErrorPrefixPageTitle />

<div className="govuk-error-summary__body">{children}</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import InfographicBlock, {
import LineChartBlock, {
LineChartProps,
} from '@common/modules/charts/components/LineChartBlock';
import MapBlock from '@common/modules/charts/components/MapBlock';
import { MapBlockProps } from '@common/modules/charts/components/MapBlockInternal';
import MapBlock, {
MapBlockProps,
} from '@common/modules/charts/components/MapBlock';
import VerticalBarBlock, {
VerticalBarProps,
} from '@common/modules/charts/components/VerticalBarBlock';
Expand Down
Loading

0 comments on commit e1fe1b5

Please sign in to comment.