From 873e534675d41422ef2ed2121d24a7955b902290 Mon Sep 17 00:00:00 2001 From: Amy Benson Date: Thu, 14 Sep 2023 16:09:25 +0100 Subject: [PATCH] EES-4510 release type modal on release page --- .../components/BasicReleaseSummary.tsx | 90 --------- .../content/components/ReleaseContent.tsx | 48 ++++- .../ReleaseHelpAndSupportSection.tsx | 88 -------- .../GlossaryEntryButton.module.scss | 11 - .../src/components/GlossaryEntryButton.tsx | 10 +- .../src/components/Modal.module.scss | 2 + .../src/components/Modal.tsx | 18 +- .../AdHocOfficialStatisticsSection.tsx | 32 --- .../ExperimentalStatisticsSection.tsx | 37 ---- .../components/ManageInformationSection.tsx | 17 -- .../components/NationalStatisticsSection.tsx | 46 ----- .../components/OfficialStatisticsSection.tsx | 34 ---- .../components/AdHocStatisticsSection.tsx | 36 ++++ .../ExperimentalStatisticsSection.tsx | 41 ++++ .../components/ManageInformationSection.tsx | 21 ++ .../components/NationalStatisticsSection.tsx | 51 +++++ .../components/OfficialStatisticsSection.tsx | 38 ++++ .../ReleaseHelpAndSupportSection.tsx | 60 ++++++ .../components/ReleaseSummarySection.tsx | 118 +++++++++++ .../release/components/ReleaseTypeSection.tsx | 29 +++ ...ublicationReleaseHelpAndSupportSection.tsx | 85 -------- .../PublicationReleasePage.tsx | 191 ++++++++---------- .../__tests__/PublicationReleasePage.test.tsx | 2 +- .../components/FilterModals.module.scss | 11 - .../components/FilterModals.tsx | 114 +++++------ 25 files changed, 592 insertions(+), 638 deletions(-) delete mode 100644 src/explore-education-statistics-admin/src/pages/release/content/components/BasicReleaseSummary.tsx delete mode 100644 src/explore-education-statistics-admin/src/pages/release/content/components/ReleaseHelpAndSupportSection.tsx delete mode 100644 src/explore-education-statistics-common/src/components/GlossaryEntryButton.module.scss delete mode 100644 src/explore-education-statistics-common/src/modules/find-statistics/components/AdHocOfficialStatisticsSection.tsx delete mode 100644 src/explore-education-statistics-common/src/modules/find-statistics/components/ExperimentalStatisticsSection.tsx delete mode 100644 src/explore-education-statistics-common/src/modules/find-statistics/components/ManageInformationSection.tsx delete mode 100644 src/explore-education-statistics-common/src/modules/find-statistics/components/NationalStatisticsSection.tsx delete mode 100644 src/explore-education-statistics-common/src/modules/find-statistics/components/OfficialStatisticsSection.tsx create mode 100644 src/explore-education-statistics-common/src/modules/release/components/AdHocStatisticsSection.tsx create mode 100644 src/explore-education-statistics-common/src/modules/release/components/ExperimentalStatisticsSection.tsx create mode 100644 src/explore-education-statistics-common/src/modules/release/components/ManageInformationSection.tsx create mode 100644 src/explore-education-statistics-common/src/modules/release/components/NationalStatisticsSection.tsx create mode 100644 src/explore-education-statistics-common/src/modules/release/components/OfficialStatisticsSection.tsx create mode 100644 src/explore-education-statistics-common/src/modules/release/components/ReleaseHelpAndSupportSection.tsx create mode 100644 src/explore-education-statistics-common/src/modules/release/components/ReleaseSummarySection.tsx create mode 100644 src/explore-education-statistics-common/src/modules/release/components/ReleaseTypeSection.tsx delete mode 100644 src/explore-education-statistics-frontend/src/modules/find-statistics/PublicationReleaseHelpAndSupportSection.tsx delete mode 100644 src/explore-education-statistics-frontend/src/modules/find-statistics/components/FilterModals.module.scss diff --git a/src/explore-education-statistics-admin/src/pages/release/content/components/BasicReleaseSummary.tsx b/src/explore-education-statistics-admin/src/pages/release/content/components/BasicReleaseSummary.tsx deleted file mode 100644 index a74ac59f7fd..00000000000 --- a/src/explore-education-statistics-admin/src/pages/release/content/components/BasicReleaseSummary.tsx +++ /dev/null @@ -1,90 +0,0 @@ -import { getReleaseApprovalStatusLabel } from '@admin/pages/release/utils/releaseSummaryUtil'; -import { EditableRelease } from '@admin/services/releaseContentService'; -import FormattedDate from '@common/components/FormattedDate'; -import { releaseTypes } from '@common/services/types/releaseType'; -import Tag from '@common/components/Tag'; -import { Dictionary } from '@common/types'; -import { - formatPartialDate, - isValidPartialDate, -} from '@common/utils/date/partialDate'; -import { parseISO } from 'date-fns'; -import React from 'react'; -import SummaryList from '@common/components/SummaryList'; -import SummaryListItem from '@common/components/SummaryListItem'; -import ReleaseNotesSection from './ReleaseNotesSection'; - -interface ReleaseTypeIcon { - url: string; - altText: string; -} - -const nationalStatisticsLogo: ReleaseTypeIcon = { - url: '/assets/images/UKSA-quality-mark.jpg', - altText: 'UK statistics authority quality mark', -}; - -const releaseTypesToIcons: Dictionary = { - [releaseTypes.NationalStatistics]: nationalStatisticsLogo, -}; - -interface Props { - release: EditableRelease; -} - -const BasicReleaseSummary = ({ release }: Props) => { - const releaseDate = release.published ?? release.publishScheduled; - return ( - <> -
-
- - {getReleaseApprovalStatusLabel(release.approvalStatus)} - - {releaseTypes[release.type]} -
- {releaseTypesToIcons[release.type] && ( - {releaseTypesToIcons[release.type].altText} - )} -
- - - - {releaseDate ? ( - {parseISO(releaseDate)} - ) : ( -

TBA

- )} -
- {isValidPartialDate(release.nextReleaseDate) && ( - - - - )} - - {release.updates && release.updates.length > 0 ? ( - release.updates[0].on - ) : ( - 'TBA' - )} - - - - - Sign up for email alerts - - -
- - ); -}; - -export default BasicReleaseSummary; diff --git a/src/explore-education-statistics-admin/src/pages/release/content/components/ReleaseContent.tsx b/src/explore-education-statistics-admin/src/pages/release/content/components/ReleaseContent.tsx index 1d6c57eab3e..9b1bf9a97f3 100644 --- a/src/explore-education-statistics-admin/src/pages/release/content/components/ReleaseContent.tsx +++ b/src/explore-education-statistics-admin/src/pages/release/content/components/ReleaseContent.tsx @@ -4,15 +4,16 @@ import PrintThisPage from '@admin/components/PrintThisPage'; import RouteLeavingGuard from '@admin/components/RouteLeavingGuard'; import { useConfig } from '@admin/contexts/ConfigContext'; import { useEditingContext } from '@admin/contexts/EditingContext'; -import BasicReleaseSummary from '@admin/pages/release/content/components/BasicReleaseSummary'; import RelatedPagesSection from '@admin/pages/release/content/components/RelatedPagesSection'; +import ReleaseHelpAndSupportSection from '@common/modules/release/components/ReleaseHelpAndSupportSection'; import ReleaseBlock from '@admin/pages/release/content/components/ReleaseBlock'; import ReleaseContentAccordion from '@admin/pages/release/content/components/ReleaseContentAccordion'; import ReleaseEditableBlock from '@admin/pages/release/content/components/ReleaseEditableBlock'; import ReleaseHeadlines from '@admin/pages/release/content/components/ReleaseHeadlines'; -import ReleaseHelpAndSupportSection from '@admin/pages/release/content/components/ReleaseHelpAndSupportSection'; +import ReleaseNotesSection from '@admin/pages/release/content/components/ReleaseNotesSection'; import { useReleaseContentState } from '@admin/pages/release/content/contexts/ReleaseContentContext'; import useReleaseContentActions from '@admin/pages/release/content/contexts/useReleaseContentActions'; +import { getReleaseApprovalStatusLabel } from '@admin/pages/release/utils/releaseSummaryUtil'; import { ReleaseRouteParams } from '@admin/routes/releaseRoutes'; import { preReleaseAccessListRoute, @@ -25,10 +26,12 @@ import ButtonText from '@common/components/ButtonText'; import Details from '@common/components/Details'; import PageSearchForm from '@common/components/PageSearchForm'; import RelatedAside from '@common/components/RelatedAside'; +import ScrollableContainer from '@common/components/ScrollableContainer'; +import Tag from '@common/components/Tag'; +import ReleaseSummarySection from '@common/modules/release/components/ReleaseSummarySection'; import ReleaseDataAndFiles from '@common/modules/release/components/ReleaseDataAndFiles'; import React, { useCallback, useMemo } from 'react'; import { generatePath, useLocation } from 'react-router'; -import ScrollableContainer from '@common/components/ScrollableContainer'; interface MethodologyLink { key: string; @@ -127,7 +130,26 @@ const ReleaseContent = () => {
- + } + renderStatusTags={ + + {getReleaseApprovalStatusLabel(release.approvalStatus)} + + } + renderSubscribeLink={ + + Sign up for email alerts + + } + />
{release.summarySection && ( @@ -411,7 +433,23 @@ const ReleaseContent = () => { - + ( + {externalMethodology.title} + )} + renderMethodologyLink={methodology => { + <> + {editingMode === 'edit' ? ( + {`${methodology.title}`} + ) : ( + + {methodology.title} + + )} + ; + }} + /> ); diff --git a/src/explore-education-statistics-admin/src/pages/release/content/components/ReleaseHelpAndSupportSection.tsx b/src/explore-education-statistics-admin/src/pages/release/content/components/ReleaseHelpAndSupportSection.tsx deleted file mode 100644 index 31e60fc8e1e..00000000000 --- a/src/explore-education-statistics-admin/src/pages/release/content/components/ReleaseHelpAndSupportSection.tsx +++ /dev/null @@ -1,88 +0,0 @@ -import Link from '@admin/components/Link'; -import { useEditingContext } from '@admin/contexts/EditingContext'; -import { EditableRelease } from '@admin/services/releaseContentService'; -import ContactUsSection from '@common/modules/find-statistics/components/ContactUsSection'; -import NationalStatisticsSection from '@common/modules/find-statistics/components/NationalStatisticsSection'; -import OfficialStatisticsSection from '@common/modules/find-statistics/components/OfficialStatisticsSection'; -import React from 'react'; -import AdHocOfficialStatisticsSection from '@common/modules/find-statistics/components/AdHocOfficialStatisticsSection'; -import ExperimentalStatisticsSection from '@common/modules/find-statistics/components/ExperimentalStatisticsSection'; -import ManagementInformationSection from '@common/modules/find-statistics/components/ManageInformationSection'; - -interface MethodologyLink { - key: string; - title: string; - url: string; -} - -const ReleaseHelpAndSupportSection = ({ - release, -}: { - release: EditableRelease; -}) => { - const { editingMode } = useEditingContext(); - const { publication } = release; - - const allMethodologies: MethodologyLink[] = publication.methodologies.map( - methodology => ({ - key: methodology.id, - title: methodology.title, - url: `/methodology/${methodology.id}/summary`, - }), - ); - - if (publication.externalMethodology) { - allMethodologies.push({ - key: publication.externalMethodology.url, - title: publication.externalMethodology.title, - url: publication.externalMethodology.url, - }); - } - - return ( - <> -

- Help and support -

- -

Methodology

- - {allMethodologies.length ? ( -
    - {allMethodologies.map(methodology => ( -
  • - {editingMode === 'edit' ? ( - {`${methodology.title}`} - ) : ( - {methodology.title} - )} -
  • - ))} -
- ) : ( -

No methodologies added.

- )} - - {release.type === 'NationalStatistics' && } - {release.type === 'OfficialStatistics' && } - {release.type === 'AdHocStatistics' && } - {release.type === 'ExperimentalStatistics' && ( - - )} - {release.type === 'ManagementInformation' && ( - - )} - - - - ); -}; - -export default ReleaseHelpAndSupportSection; diff --git a/src/explore-education-statistics-common/src/components/GlossaryEntryButton.module.scss b/src/explore-education-statistics-common/src/components/GlossaryEntryButton.module.scss deleted file mode 100644 index 4a5a24d73dc..00000000000 --- a/src/explore-education-statistics-common/src/components/GlossaryEntryButton.module.scss +++ /dev/null @@ -1,11 +0,0 @@ -@import '~govuk-frontend/govuk/base'; - -.content { - margin-bottom: govuk-spacing(5); - max-height: 50vh; - overflow-y: auto; - - &:focus { - outline: $govuk-focus-colour solid $govuk-focus-width; - } -} diff --git a/src/explore-education-statistics-common/src/components/GlossaryEntryButton.tsx b/src/explore-education-statistics-common/src/components/GlossaryEntryButton.tsx index b22b058bd82..33416e1d94a 100644 --- a/src/explore-education-statistics-common/src/components/GlossaryEntryButton.tsx +++ b/src/explore-education-statistics-common/src/components/GlossaryEntryButton.tsx @@ -1,9 +1,7 @@ -import Button from '@common/components/Button'; import ButtonText from '@common/components/ButtonText'; import InfoIcon from '@common/components/InfoIcon'; import Modal from '@common/components/Modal'; import { GlossaryEntry } from '@common/services/types/glossary'; -import styles from '@common/components/GlossaryEntryButton.module.scss'; import sanitizeHtml from '@common/utils/sanitizeHtml'; import parseHtmlString from 'html-react-parser'; import React, { ReactNode, useState } from 'react'; @@ -40,15 +38,11 @@ export default function GlossaryEntryButton({ {glossaryEntry && ( setGlossaryEntry(undefined)} > - {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */} -
- {parseHtmlString(sanitizeHtml(glossaryEntry.body))} -
- - + {parseHtmlString(sanitizeHtml(glossaryEntry.body))}
)} diff --git a/src/explore-education-statistics-common/src/components/Modal.module.scss b/src/explore-education-statistics-common/src/components/Modal.module.scss index cf700af12fb..0ab9649d835 100644 --- a/src/explore-education-statistics-common/src/components/Modal.module.scss +++ b/src/explore-education-statistics-common/src/components/Modal.module.scss @@ -20,8 +20,10 @@ background: #fff; cursor: initial; margin: 0 govuk-spacing(2); + max-height: 98vh; max-width: map-get($govuk-breakpoints, 'desktop'); min-width: 30vh; + overflow-y: auto; padding: govuk-spacing(6); @include govuk-media-query($from: tablet) { diff --git a/src/explore-education-statistics-common/src/components/Modal.tsx b/src/explore-education-statistics-common/src/components/Modal.tsx index cf3c831dc63..06baba1891e 100644 --- a/src/explore-education-statistics-common/src/components/Modal.tsx +++ b/src/explore-education-statistics-common/src/components/Modal.tsx @@ -2,8 +2,10 @@ import styles from '@common/components/Modal.module.scss'; import classNames from 'classnames'; import React, { ReactNode, useEffect } from 'react'; import BaseModal from 'react-modal'; +import Button from './Button'; export interface ModalProps { + cancelText?: string; children: ReactNode; className?: string; closeOnOutsideClick?: boolean; @@ -11,6 +13,7 @@ export interface ModalProps { fullScreen?: boolean; hideTitle?: boolean; open?: boolean; + showClose?: boolean; title: string; underlayClass?: string; onOpen?: () => void; @@ -18,6 +21,7 @@ export interface ModalProps { } const Modal = ({ + cancelText = 'Close', children, className, closeOnOutsideClick = true, @@ -25,10 +29,11 @@ const Modal = ({ fullScreen = false, hideTitle = false, open = true, - onOpen, - onExit, + showClose = false, title, underlayClass, + onOpen, + onExit, }: ModalProps) => { const appElement = typeof document !== 'undefined' @@ -74,6 +79,15 @@ const Modal = ({ {title} {children} + + {showClose && ( + + )} ); }; diff --git a/src/explore-education-statistics-common/src/modules/find-statistics/components/AdHocOfficialStatisticsSection.tsx b/src/explore-education-statistics-common/src/modules/find-statistics/components/AdHocOfficialStatisticsSection.tsx deleted file mode 100644 index 5ded20f595a..00000000000 --- a/src/explore-education-statistics-common/src/modules/find-statistics/components/AdHocOfficialStatisticsSection.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import React from 'react'; - -const AdHocOfficialStatisticsSection = () => ( - <> -

Ad hoc official statistics

-

- Ad hoc official statistics are one off publications that have been - produced as far as possible in line with the Code of Practice for - Statistics. -

-

This can be broadly interpreted to mean that these statistics are:

-
    -
  • managed impartially and objectively in the public interest
  • - -
  • meet identified user needs
  • - -
  • produced according to sound methods
  • - -
  • well explained and readily accessible
  • -
-

- Find out more about the standards we follow to produce these statistics - through our{' '} - - Standards for official statistics published by DfE guidance - - . -

- -); - -export default AdHocOfficialStatisticsSection; diff --git a/src/explore-education-statistics-common/src/modules/find-statistics/components/ExperimentalStatisticsSection.tsx b/src/explore-education-statistics-common/src/modules/find-statistics/components/ExperimentalStatisticsSection.tsx deleted file mode 100644 index d9ac8d77523..00000000000 --- a/src/explore-education-statistics-common/src/modules/find-statistics/components/ExperimentalStatisticsSection.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import React from 'react'; - -const ExperimentalStatisticsSection = () => ( - <> -

Experimental statistics

-

- These statistics are experimental statistics undergoing evaluation. They - have been developed under the guidance of the Head of Profession for - Statistics and published to involve users and stakeholders at an early - stage in assessing their suitability and quality. -

-

- Experimental official statistics have been produced as far as possible in - line with the Code of Practice for Statistics. -

-

This can be broadly interpreted to mean that these statistics are:

-
    -
  • managed impartially and objectively in the public interest
  • - -
  • meet identified user needs
  • - -
  • produced according to sound methods
  • - -
  • well explained and readily accessible
  • -
-

- Find out more about the standards we follow to produce these statistics - through our{' '} - - Standards for official statistics published by DfE guidance - - . -

- -); - -export default ExperimentalStatisticsSection; diff --git a/src/explore-education-statistics-common/src/modules/find-statistics/components/ManageInformationSection.tsx b/src/explore-education-statistics-common/src/modules/find-statistics/components/ManageInformationSection.tsx deleted file mode 100644 index 286c5afb00f..00000000000 --- a/src/explore-education-statistics-common/src/modules/find-statistics/components/ManageInformationSection.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import React from 'react'; - -const ManagementInformationSection = () => ( - <> -

Management information

-

- Management information describes aggregate information collated and used - in the normal course of business to inform operational delivery, policy - development or the management of organisational performance. It is usually - based on administrative data but can also be a product of survey data. The - terms administrative data and management information are sometimes used - interchangeably. -

- -); - -export default ManagementInformationSection; diff --git a/src/explore-education-statistics-common/src/modules/find-statistics/components/NationalStatisticsSection.tsx b/src/explore-education-statistics-common/src/modules/find-statistics/components/NationalStatisticsSection.tsx deleted file mode 100644 index 091fb831b80..00000000000 --- a/src/explore-education-statistics-common/src/modules/find-statistics/components/NationalStatisticsSection.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import React from 'react'; - -const NationalStatisticsSection = () => ( - <> -

National statistics

-

- The{' '} - - United Kingdom Statistics Authority - {' '} - designated these statistics as National Statistics in accordance with the{' '} - - Statistics and Registration Service Act 2007 - {' '} - and signifying compliance with the Code of Practice for Statistics. -

-

- Designation signifying their compliance with the authority's{' '} - - Code of Practice for Statistics - {' '} - which broadly means these statistics are: -

-
    -
  • managed impartially and objectively in the public interest
  • -
  • meet identified user needs
  • -
  • produced according to sound methods
  • -
  • well explained and readily accessible
  • -
-

- Once designated as National Statistics it's a statutory requirement for - statistics to follow and comply with the Code of Practice for Statistics - to be observed. -

-

- Find out more about the standards we follow to produce these statistics - through our{' '} - - Standards for official statistics published by DfE - {' '} - guidance. -

- -); - -export default NationalStatisticsSection; diff --git a/src/explore-education-statistics-common/src/modules/find-statistics/components/OfficialStatisticsSection.tsx b/src/explore-education-statistics-common/src/modules/find-statistics/components/OfficialStatisticsSection.tsx deleted file mode 100644 index 5c785b416e3..00000000000 --- a/src/explore-education-statistics-common/src/modules/find-statistics/components/OfficialStatisticsSection.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import React from 'react'; - -const OfficialStatisticsSection = () => ( - <> -

Official statistics

-

- These are Official Statistics and have been produced in line with the{' '} - - Code of Practice for Official Statistics - - . -

-

This can be broadly interpreted to mean that these statistics are:

-
    -
  • managed impartially and objectively in the public interest
  • - -
  • meet identified user needs
  • - -
  • produced according to sound methods
  • - -
  • well explained and readily accessible
  • -
-

- Find out more about the standards we follow to produce these statistics - through our{' '} - - Standards for official statistics published by DfE guidance - - . -

- -); - -export default OfficialStatisticsSection; diff --git a/src/explore-education-statistics-common/src/modules/release/components/AdHocStatisticsSection.tsx b/src/explore-education-statistics-common/src/modules/release/components/AdHocStatisticsSection.tsx new file mode 100644 index 00000000000..38d867e5d98 --- /dev/null +++ b/src/explore-education-statistics-common/src/modules/release/components/AdHocStatisticsSection.tsx @@ -0,0 +1,36 @@ +import React from 'react'; + +export default function AdHocStatisticsSection({ + showHeading = true, +}: { + showHeading?: boolean; +}) { + return ( + <> + {showHeading &&

Ad hoc official statistics

} +

+ Ad hoc official statistics are one off publications that have been + produced as far as possible in line with the Code of Practice for + Statistics. +

+

This can be broadly interpreted to mean that these statistics are:

+
    +
  • managed impartially and objectively in the public interest
  • + +
  • meet identified user needs
  • + +
  • produced according to sound methods
  • + +
  • well explained and readily accessible
  • +
+

+ Find out more about the standards we follow to produce these statistics + through our{' '} + + Standards for official statistics published by DfE guidance + + . +

+ + ); +} diff --git a/src/explore-education-statistics-common/src/modules/release/components/ExperimentalStatisticsSection.tsx b/src/explore-education-statistics-common/src/modules/release/components/ExperimentalStatisticsSection.tsx new file mode 100644 index 00000000000..4469ef1621a --- /dev/null +++ b/src/explore-education-statistics-common/src/modules/release/components/ExperimentalStatisticsSection.tsx @@ -0,0 +1,41 @@ +import React from 'react'; + +export default function ExperimentalStatisticsSection({ + showHeading = true, +}: { + showHeading?: boolean; +}) { + return ( + <> + {showHeading &&

Experimental statistics

} +

+ These statistics are experimental statistics undergoing evaluation. They + have been developed under the guidance of the Head of Profession for + Statistics and published to involve users and stakeholders at an early + stage in assessing their suitability and quality. +

+

+ Experimental official statistics have been produced as far as possible + in line with the Code of Practice for Statistics. +

+

This can be broadly interpreted to mean that these statistics are:

+
    +
  • managed impartially and objectively in the public interest
  • + +
  • meet identified user needs
  • + +
  • produced according to sound methods
  • + +
  • well explained and readily accessible
  • +
+

+ Find out more about the standards we follow to produce these statistics + through our{' '} + + Standards for official statistics published by DfE guidance + + . +

+ + ); +} diff --git a/src/explore-education-statistics-common/src/modules/release/components/ManageInformationSection.tsx b/src/explore-education-statistics-common/src/modules/release/components/ManageInformationSection.tsx new file mode 100644 index 00000000000..bbe0dd43760 --- /dev/null +++ b/src/explore-education-statistics-common/src/modules/release/components/ManageInformationSection.tsx @@ -0,0 +1,21 @@ +import React from 'react'; + +export default function ManagementInformationSection({ + showHeading = true, +}: { + showHeading?: boolean; +}) { + return ( + <> + {showHeading &&

Management information

} +

+ Management information describes aggregate information collated and used + in the normal course of business to inform operational delivery, policy + development or the management of organisational performance. It is + usually based on administrative data but can also be a product of survey + data. The terms administrative data and management information are + sometimes used interchangeably. +

+ + ); +} diff --git a/src/explore-education-statistics-common/src/modules/release/components/NationalStatisticsSection.tsx b/src/explore-education-statistics-common/src/modules/release/components/NationalStatisticsSection.tsx new file mode 100644 index 00000000000..c8d1c4ac98b --- /dev/null +++ b/src/explore-education-statistics-common/src/modules/release/components/NationalStatisticsSection.tsx @@ -0,0 +1,51 @@ +import React from 'react'; + +export default function NationalStatisticsSection({ + showHeading = true, +}: { + showHeading?: boolean; +}) { + return ( + <> + {showHeading &&

National statistics

} +

+ The{' '} + + United Kingdom Statistics Authority + {' '} + designated these statistics as National Statistics in accordance with + the{' '} + + Statistics and Registration Service Act 2007 + {' '} + and signifying compliance with the Code of Practice for Statistics. +

+

+ Designation signifying their compliance with the authority's{' '} + + Code of Practice for Statistics + {' '} + which broadly means these statistics are: +

+
    +
  • managed impartially and objectively in the public interest
  • +
  • meet identified user needs
  • +
  • produced according to sound methods
  • +
  • well explained and readily accessible
  • +
+

+ Once designated as National Statistics it's a statutory requirement for + statistics to follow and comply with the Code of Practice for Statistics + to be observed. +

+

+ Find out more about the standards we follow to produce these statistics + through our{' '} + + Standards for official statistics published by DfE + {' '} + guidance. +

+ + ); +} diff --git a/src/explore-education-statistics-common/src/modules/release/components/OfficialStatisticsSection.tsx b/src/explore-education-statistics-common/src/modules/release/components/OfficialStatisticsSection.tsx new file mode 100644 index 00000000000..c3b75926c4f --- /dev/null +++ b/src/explore-education-statistics-common/src/modules/release/components/OfficialStatisticsSection.tsx @@ -0,0 +1,38 @@ +import React from 'react'; + +export default function OfficialStatisticsSection({ + showHeading = true, +}: { + showHeading?: boolean; +}) { + return ( + <> + {showHeading &&

Official statistics

} +

+ These are Official Statistics and have been produced in line with the{' '} + + Code of Practice for Official Statistics + + . +

+

This can be broadly interpreted to mean that these statistics are:

+
    +
  • managed impartially and objectively in the public interest
  • + +
  • meet identified user needs
  • + +
  • produced according to sound methods
  • + +
  • well explained and readily accessible
  • +
+

+ Find out more about the standards we follow to produce these statistics + through our{' '} + + Standards for official statistics published by DfE guidance + + . +

+ + ); +} diff --git a/src/explore-education-statistics-common/src/modules/release/components/ReleaseHelpAndSupportSection.tsx b/src/explore-education-statistics-common/src/modules/release/components/ReleaseHelpAndSupportSection.tsx new file mode 100644 index 00000000000..4591f527c5b --- /dev/null +++ b/src/explore-education-statistics-common/src/modules/release/components/ReleaseHelpAndSupportSection.tsx @@ -0,0 +1,60 @@ +import ReleaseTypeSection from '@common/modules/release/components/ReleaseTypeSection'; +import ContactUsSection from '@common/modules/find-statistics/components/ContactUsSection'; +import { Release } from '@common/services/publicationService'; +import { + ExternalMethodology, + MethodologySummary, +} from '@common/services/types/methodology'; +import React, { ReactNode } from 'react'; + +interface Props { + release: Release; + renderExternalMethodologyLink: ( + externalMethodology: ExternalMethodology, + ) => ReactNode; + renderMethodologyLink: (methodology: MethodologySummary) => ReactNode; +} + +export default function ReleaseHelpAndSupportSection({ + release, + renderMethodologyLink, + renderExternalMethodologyLink, +}: Props) { + const { externalMethodology, methodologies, contact, title } = + release.publication; + + return ( + <> +

+ Help and support +

+ + {methodologies.length > 0 && ( + <> +

Methodology

+

+ Find out how and why we collect, process and publish these + statistics. +

+ +
    + {methodologies.map(methodology => ( +
  • {renderMethodologyLink(methodology)}
  • + ))} + {externalMethodology && ( +
  • {renderExternalMethodologyLink(externalMethodology)}
  • + )} +
+ + )} + + + + + + ); +} diff --git a/src/explore-education-statistics-common/src/modules/release/components/ReleaseSummarySection.tsx b/src/explore-education-statistics-common/src/modules/release/components/ReleaseSummarySection.tsx new file mode 100644 index 00000000000..196a9ad40df --- /dev/null +++ b/src/explore-education-statistics-common/src/modules/release/components/ReleaseSummarySection.tsx @@ -0,0 +1,118 @@ +import FormattedDate from '@common/components/FormattedDate'; +import { + formatPartialDate, + isValidPartialDate, +} from '@common/utils/date/partialDate'; +import SummaryList from '@common/components/SummaryList'; +import SummaryListItem from '@common/components/SummaryListItem'; +import ButtonText from '@common/components/ButtonText'; +import InfoIcon from '@common/components/InfoIcon'; +import ReleaseTypeSection from '@common/modules/release/components/ReleaseTypeSection'; +import useToggle from '@common/hooks/useToggle'; +import { Release } from '@common/services/publicationService'; +import { ReleaseType, releaseTypes } from '@common/services/types/releaseType'; +import Modal from '@common/components/Modal'; +import { parseISO } from 'date-fns'; +import React, { ReactNode } from 'react'; + +interface ReleaseTypeIcon { + url: string; + altText: string; +} + +const releaseTypesToIcons: Partial> = { + NationalStatistics: { + url: '/assets/images/UKSA-quality-mark.jpg', + altText: 'UK statistics authority quality mark', + }, +}; + +interface Props { + isEditing?: boolean; + lastUpdated?: Date; + release: Release; + releaseDate: string; + renderReleaseNotes: ReactNode; + renderStatusTags: ReactNode; + renderSubscribeLink: ReactNode; + onShowReleaseTypeModal?: () => void; +} + +export default function ReleaseSummarySection({ + isEditing, + lastUpdated, + release, + releaseDate, + renderReleaseNotes, + renderStatusTags, + renderSubscribeLink, + onShowReleaseTypeModal, +}: Props) { + const [showReleaseTypeModal, toggleReleaseTypeModal] = useToggle(false); + + return ( + <> +
+
{renderStatusTags}
+ {releaseTypesToIcons[release.type] && ( + {releaseTypesToIcons[release.type]?.altText} + )} +
+ + + + {releaseDate ? ( + {parseISO(releaseDate)} + ) : ( +

TBA

+ )} +
+ {release.latestRelease && + isValidPartialDate(release.nextReleaseDate) && ( + + + + )} + + {(isEditing || lastUpdated) && ( + + {lastUpdated && {lastUpdated}} + {renderReleaseNotes} + + )} + + + { + toggleReleaseTypeModal.on(); + onShowReleaseTypeModal?.(); + }} + > + {releaseTypes[release.type]}{' '} + + + + + + {renderSubscribeLink} + +
+ + + + + + ); +} diff --git a/src/explore-education-statistics-common/src/modules/release/components/ReleaseTypeSection.tsx b/src/explore-education-statistics-common/src/modules/release/components/ReleaseTypeSection.tsx new file mode 100644 index 00000000000..cda86b87440 --- /dev/null +++ b/src/explore-education-statistics-common/src/modules/release/components/ReleaseTypeSection.tsx @@ -0,0 +1,29 @@ +import AdHocStatisticsSection from '@common/modules/release/components/AdHocStatisticsSection'; +import ExperimentalStatisticsSection from '@common/modules/release/components/ExperimentalStatisticsSection'; +import ManagementInformationSection from '@common/modules/release/components/ManageInformationSection'; +import NationalStatisticsSection from '@common/modules/release/components/NationalStatisticsSection'; +import OfficialStatisticsSection from '@common/modules/release/components/OfficialStatisticsSection'; +import { ReleaseType } from '@common/services/types/releaseType'; +import React from 'react'; + +export const releaseTypeComponents = { + NationalStatistics: NationalStatisticsSection, + OfficialStatistics: OfficialStatisticsSection, + ExperimentalStatistics: ExperimentalStatisticsSection, + AdHocStatistics: AdHocStatisticsSection, + ManagementInformation: ManagementInformationSection, +}; + +interface Props { + showHeading?: boolean; + type: ReleaseType; +} + +export default function ReleaseTypeSection({ + showHeading = true, + type, +}: Props) { + const ReleaseTypeComponent = releaseTypeComponents[type]; + + return ; +} diff --git a/src/explore-education-statistics-frontend/src/modules/find-statistics/PublicationReleaseHelpAndSupportSection.tsx b/src/explore-education-statistics-frontend/src/modules/find-statistics/PublicationReleaseHelpAndSupportSection.tsx deleted file mode 100644 index 35a5ce32231..00000000000 --- a/src/explore-education-statistics-frontend/src/modules/find-statistics/PublicationReleaseHelpAndSupportSection.tsx +++ /dev/null @@ -1,85 +0,0 @@ -import ContactUsSection from '@common/modules/find-statistics/components/ContactUsSection'; -import NationalStatisticsSection from '@common/modules/find-statistics/components/NationalStatisticsSection'; -import OfficialStatisticsSection from '@common/modules/find-statistics/components/OfficialStatisticsSection'; -import AdHocOfficialStatisticsSection from '@common/modules/find-statistics/components/AdHocOfficialStatisticsSection'; -import ExperimentalStatisticsSection from '@common/modules/find-statistics/components/ExperimentalStatisticsSection'; -import ManagementInformationSection from '@common/modules/find-statistics/components/ManageInformationSection'; -import { Contact } from '@common/services/publicationService'; -import { - ExternalMethodology, - MethodologySummary, -} from '@common/services/types/methodology'; -import { ReleaseType } from '@common/services/types/releaseType'; -import Link from '@frontend/components/Link'; -import React from 'react'; - -interface Props { - publicationTitle: string; - methodologies: MethodologySummary[]; - externalMethodology?: ExternalMethodology; - releaseType?: ReleaseType; - publicationContact: Contact; -} - -const PublicationReleaseHelpAndSupportSection = ({ - publicationTitle, - methodologies, - externalMethodology, - releaseType, - publicationContact, -}: Props) => { - return ( - <> -

- Help and support -

- - {(methodologies.length || externalMethodology) && ( - <> -

Methodology

-

- Find out how and why we collect, process and publish these - statistics. -

- -
    - {methodologies.map(methodology => ( -
  • - - {methodology.title} - -
  • - ))} - {externalMethodology && ( -
  • - - {externalMethodology.title} - -
  • - )} -
- - )} - {releaseType === 'NationalStatistics' && } - {releaseType === 'OfficialStatistics' && } - {releaseType === 'AdHocStatistics' && } - {releaseType === 'ExperimentalStatistics' && ( - - )} - {releaseType === 'ManagementInformation' && ( - - )} - - - - ); -}; - -export default PublicationReleaseHelpAndSupportSection; diff --git a/src/explore-education-statistics-frontend/src/modules/find-statistics/PublicationReleasePage.tsx b/src/explore-education-statistics-frontend/src/modules/find-statistics/PublicationReleasePage.tsx index fa85a455ab6..6a33b7ba750 100644 --- a/src/explore-education-statistics-frontend/src/modules/find-statistics/PublicationReleasePage.tsx +++ b/src/explore-education-statistics-frontend/src/modules/find-statistics/PublicationReleasePage.tsx @@ -3,40 +3,33 @@ import AccordionSection from '@common/components/AccordionSection'; import Details from '@common/components/Details'; import FormattedDate from '@common/components/FormattedDate'; import RelatedAside from '@common/components/RelatedAside'; -import SummaryList from '@common/components/SummaryList'; -import SummaryListItem from '@common/components/SummaryListItem'; import Tag from '@common/components/Tag'; -import TagGroup from '@common/components/TagGroup'; +import VisuallyHidden from '@common/components/VisuallyHidden'; +import ScrollableContainer from '@common/components/ScrollableContainer'; +import WarningMessage from '@common/components/WarningMessage'; +import ReleaseSummarySection from '@common/modules/release/components/ReleaseSummarySection'; import ContentBlockRenderer from '@common/modules/find-statistics/components/ContentBlockRenderer'; import ReleaseDataAndFiles from '@common/modules/release/components/ReleaseDataAndFiles'; +import ReleaseHelpAndSupportSection from '@common/modules/release/components/ReleaseHelpAndSupportSection'; import publicationService, { Release, } from '@common/services/publicationService'; -import { releaseTypes } from '@common/services/types/releaseType'; import { Dictionary } from '@common/types'; -import { - formatPartialDate, - isValidPartialDate, -} from '@common/utils/date/partialDate'; import ButtonLink from '@frontend/components/ButtonLink'; import Link from '@frontend/components/Link'; import Page from '@frontend/components/Page'; import PageSearchFormWithAnalytics from '@frontend/components/PageSearchFormWithAnalytics'; import PrintThisPage from '@frontend/components/PrintThisPage'; import PublicationSectionBlocks from '@frontend/modules/find-statistics/components/PublicationSectionBlocks'; -import PublicationReleaseHelpAndSupportSection from '@frontend/modules/find-statistics/PublicationReleaseHelpAndSupportSection'; import { logEvent } from '@frontend/services/googleAnalyticsService'; import glossaryService from '@frontend/services/glossaryService'; +import withAxiosHandler from '@frontend/middleware/ssr/withAxiosHandler'; +import PublicationReleaseHeadlinesSection from '@frontend/modules/find-statistics/components/PublicationReleaseHeadlinesSection'; +import styles from '@frontend/modules/find-statistics/PublicationReleasePage.module.scss'; import classNames from 'classnames'; import orderBy from 'lodash/orderBy'; import { GetServerSideProps, NextPage } from 'next'; import React from 'react'; -import VisuallyHidden from '@common/components/VisuallyHidden'; -import ScrollableContainer from '@common/components/ScrollableContainer'; -import WarningMessage from '@common/components/WarningMessage'; -import withAxiosHandler from '@frontend/middleware/ssr/withAxiosHandler'; -import PublicationReleaseHeadlinesSection from './components/PublicationReleaseHeadlinesSection'; -import styles from './PublicationReleasePage.module.scss'; interface Props { release: Release; @@ -52,7 +45,7 @@ const PublicationReleasePage: NextPage = ({ release }) => { // Re-order updates in descending order in-case the cached // release from the content API has not been updated to // have the updates in the correct order. - const updates = orderBy(release.updates, 'on', 'desc'); + const releaseUpdates = orderBy(release.updates, 'on', 'desc'); const showAllFilesButton = release.downloadFiles.some( file => @@ -75,7 +68,7 @@ const PublicationReleasePage: NextPage = ({ release }) => { ]} >
- {release.publication?.isSuperseded ? ( + {release.publication?.isSuperseded && ( This publication has been superseded by{' '} = ({ release }) => { {release.publication.supersededBy?.title} - ) : null} + )} +
-
-
- {!release.publication.isSuperseded && !release.latestRelease && ( - - View latest data:{' '} - - {release.publication.releases[0].title} - - - )} - + + {releaseUpdates.length > 0 && ( +
{ + if (open) { + logEvent({ + category: 'Last Updates', + action: 'Release page last updates dropdown opened', + label: window.location.pathname, + }); + } + }} + > +
    + {releaseUpdates.map(update => ( +
  1. + + {update.on} + +

    {update.reason}

    +
  2. + ))} +
+
+ )} + + } + renderStatusTags={ + <> + {!release.publication.isSuperseded && + !release.latestRelease && ( + + View latest data:{' '} + + {release.publication.releases[0].title} + + + )} {!release.publication.isSuperseded && ( <> {release.latestRelease ? ( @@ -111,68 +143,9 @@ const PublicationReleasePage: NextPage = ({ release }) => { )} )} - {release.type && {releaseTypes[release.type]}} -
-
- {release.type === 'NationalStatistics' && ( - UK statistics authority quality mark - )} -
- - - {release.published} - - {release.latestRelease && - isValidPartialDate(release.nextReleaseDate) && ( - - - - )} - - {updates.length > 0 ? ( - - {updates[0].on} - -
{ - if (open) { - logEvent({ - category: 'Last Updates', - action: 'Release page last updates dropdown opened', - label: window.location.pathname, - }); - } - }} - > -
    - {updates.map(update => ( -
  1. - - {update.on} - -

    {update.reason}

    -
  2. - ))} -
-
-
- ) : null} - - + + } + renderSubscribeLink={ = ({ release }) => { > Sign up for email alerts - -
+ } + onShowReleaseTypeModal={() => + logEvent({ + category: `${release.publication.title} release page`, + action: 'Release type clicked', + label: window.location.pathname, + }) + } + /> + {/** Visually hidden h2 as currently the release intro editor only starts from h3 @@ -551,12 +532,16 @@ const PublicationReleasePage: NextPage = ({ release }) => { )} - ( + {externalMethodology.title} + )} + renderMethodologyLink={methodology => ( + + {methodology.title} + + )} /> { />, ); - const nextUpdateValue = screen.getByTestId('next-update-list-item-value'); + const nextUpdateValue = screen.getByTestId('Next update-value'); expect(nextUpdateValue.textContent).toEqual('February 2022'); }); diff --git a/src/explore-education-statistics-frontend/src/modules/find-statistics/components/FilterModals.module.scss b/src/explore-education-statistics-frontend/src/modules/find-statistics/components/FilterModals.module.scss deleted file mode 100644 index 4a5a24d73dc..00000000000 --- a/src/explore-education-statistics-frontend/src/modules/find-statistics/components/FilterModals.module.scss +++ /dev/null @@ -1,11 +0,0 @@ -@import '~govuk-frontend/govuk/base'; - -.content { - margin-bottom: govuk-spacing(5); - max-height: 50vh; - overflow-y: auto; - - &:focus { - outline: $govuk-focus-colour solid $govuk-focus-width; - } -} diff --git a/src/explore-education-statistics-frontend/src/modules/find-statistics/components/FilterModals.tsx b/src/explore-education-statistics-frontend/src/modules/find-statistics/components/FilterModals.tsx index 97ada3a2f6b..f1f3bae6930 100644 --- a/src/explore-education-statistics-frontend/src/modules/find-statistics/components/FilterModals.tsx +++ b/src/explore-education-statistics-frontend/src/modules/find-statistics/components/FilterModals.tsx @@ -1,9 +1,7 @@ -import Button from '@common/components/Button'; import Modal from '@common/components/Modal'; import SummaryList from '@common/components/SummaryList'; import SummaryListItem from '@common/components/SummaryListItem'; import { ThemeSummary } from '@common/services/themeService'; -import styles from '@frontend/modules/find-statistics/components/FilterModals.module.scss'; import React from 'react'; export const ReleaseTypesModal = ({ @@ -13,57 +11,47 @@ export const ReleaseTypesModal = ({ open: boolean; onClose: () => void; }) => ( - +

This is a description list of the different types of publication we currently publish.

- {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */} -
- - - National statistics are official statistics that have been assessed by - the Office for Statistics Regulation as fully compliant with the Code - of Practice for Statistics, i.e., they meet the highest standards for - trustworthiness, quality and value. - - - Official statistics are regular statistics produced by the UK - Statistics Authority, government departments (including executive - agencies), the Devolved Administrations in Scotland, Wales and - Northern Ireland, any other person acting on behalf of the Crown or - any other organisation named on an Official Statistics Order. - - - Experimental statistics are newly developed or innovative official - statistics that are undergoing evaluation. They are published to - involve users and stakeholders in the assessment of their suitability - and quality at an early stage. These statistics will reach a point - where the label, experimental statistics, can be removed, or should be - discontinued. - - - Releases of statistics which are not part of DfE's regular annual - official statistical release calendar. - - - Management information describes aggregate information collated and - used in the normal course of business to inform operational delivery, - policy development or the management of organisational performance. It - is usually based on administrative data but can also be a product of - survey data. The terms administrative data and management information - are sometimes used interchangeably. - - -
- + + + + National statistics are official statistics that have been assessed by + the Office for Statistics Regulation as fully compliant with the Code of + Practice for Statistics, i.e., they meet the highest standards for + trustworthiness, quality and value. + + + Official statistics are regular statistics produced by the UK Statistics + Authority, government departments (including executive agencies), the + Devolved Administrations in Scotland, Wales and Northern Ireland, any + other person acting on behalf of the Crown or any other organisation + named on an Official Statistics Order. + + + Experimental statistics are newly developed or innovative official + statistics that are undergoing evaluation. They are published to involve + users and stakeholders in the assessment of their suitability and + quality at an early stage. These statistics will reach a point where the + label, experimental statistics, can be removed, or should be + discontinued. + + + Releases of statistics which are not part of DfE's regular annual + official statistical release calendar. + + + Management information describes aggregate information collated and used + in the normal course of business to inform operational delivery, policy + development or the management of organisational performance. It is + usually based on administrative data but can also be a product of survey + data. The terms administrative data and management information are + sometimes used interchangeably. + +
); @@ -76,25 +64,15 @@ export const ThemesModal = ({ themes: ThemeSummary[]; onClose: () => void; }) => ( - +

This is a description list of our different publication themes.

- {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */} -
- - {themes.map(theme => ( - - {theme.summary} - - ))} - -
- + + + {themes.map(theme => ( + + {theme.summary} + + ))} +
);