From 1c53e9324559f0e3ee000b1872f9b6fe113bd0ca 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 +- .../src/components/ModalConfirm.tsx | 6 +- .../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 +++++------ 26 files changed, 595 insertions(+), 641 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..4260d729eba 100644 --- a/src/explore-education-statistics-common/src/components/Modal.tsx +++ b/src/explore-education-statistics-common/src/components/Modal.tsx @@ -2,15 +2,18 @@ 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 { children: ReactNode; className?: string; closeOnOutsideClick?: boolean; closeOnEsc?: boolean; + closeText?: string; fullScreen?: boolean; hideTitle?: boolean; open?: boolean; + showClose?: boolean; title: string; underlayClass?: string; onOpen?: () => void; @@ -22,13 +25,15 @@ const Modal = ({ className, closeOnOutsideClick = true, closeOnEsc = true, + closeText = 'Close', 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/components/ModalConfirm.tsx b/src/explore-education-statistics-common/src/components/ModalConfirm.tsx index be277ba74ec..305d32bd4a3 100644 --- a/src/explore-education-statistics-common/src/components/ModalConfirm.tsx +++ b/src/explore-education-statistics-common/src/components/ModalConfirm.tsx @@ -8,7 +8,7 @@ import Modal from './Modal'; interface Props { children?: ReactNode; className?: string; - cancelText?: string; + closeText?: string; confirmText?: string; open?: boolean; onConfirm(): void; @@ -23,7 +23,7 @@ const ModalConfirm = ({ children, className, confirmText = 'Confirm', - cancelText = 'Cancel', + closeText = 'Cancel', open, onConfirm, onExit, @@ -70,7 +70,7 @@ const ModalConfirm = ({ onClick={handleAction(onCancel)} disabled={isDisabled} > - {cancelText} + {closeText} )} + + + + 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} + + ))} +
);