From e5a5da35887f17610d0e4e205687ce22ae98324f Mon Sep 17 00:00:00 2001 From: Rhys Date: Thu, 19 Sep 2024 14:30:51 +0100 Subject: [PATCH 01/12] Whats new child heading location fix --- src/app/components/cms/pages/WhatsNewChild.tsx | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/app/components/cms/pages/WhatsNewChild.tsx b/src/app/components/cms/pages/WhatsNewChild.tsx index 17f997388..a9c053ee1 100644 --- a/src/app/components/cms/pages/WhatsNewChild.tsx +++ b/src/app/components/cms/pages/WhatsNewChild.tsx @@ -26,7 +26,7 @@ export default async function WhatsNewChildPage({ const backLink = searchParams.returnUrl || extractRootSlug(slug) return ( - +
@@ -51,17 +51,6 @@ export default async function WhatsNewChildPage({
) : null} - - - , - ]} - values={{ value: title }} - /> - {t('entryDescription')} {body}
From d641ff16eda14061de5a80de2a9a89fa9badc89e Mon Sep 17 00:00:00 2001 From: Temi Akinsoto Date: Thu, 31 Oct 2024 16:00:20 +0000 Subject: [PATCH 02/12] add entry title for screen readers --- public/locales/en/common.json | 1 + src/app/components/ui/ukhsa/View/View.tsx | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 5ce7cc1bc..3ec7a1f6f 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -19,6 +19,7 @@ "welcome": "Welcome", "pageTitle": "{{title}}", "pageTitle_withArea": "{{title}} in {{- areaName}}", + "entryTitle": "<0>Entry title: <1>{{-value}}", "cms": { "blocks": { "headline": { diff --git a/src/app/components/ui/ukhsa/View/View.tsx b/src/app/components/ui/ukhsa/View/View.tsx index 1d02611de..4aaed0b55 100644 --- a/src/app/components/ui/ukhsa/View/View.tsx +++ b/src/app/components/ui/ukhsa/View/View.tsx @@ -1,6 +1,7 @@ import clsx from 'clsx' import Link from 'next/link' import { ReactNode } from 'react' +import { Trans } from 'react-i18next/TransWithoutContext' import { RichText } from '@/app/components/cms' import { getServerTranslation } from '@/app/i18n' @@ -60,6 +61,14 @@ export async function View({ })} > {heading} + + , ]} + values={{ value: heading }} + /> + )} From bbc84b64c2d6f02b7b82d95bda3e14bfa86e639f Mon Sep 17 00:00:00 2001 From: Temi Akinsoto Date: Fri, 1 Nov 2024 09:15:32 +0000 Subject: [PATCH 03/12] add heading value for h1 --- public/locales/en/common.json | 2 +- src/app/components/ui/ukhsa/View/View.tsx | 32 +++++++++++------------ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 3ec7a1f6f..ce35854c4 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -19,7 +19,7 @@ "welcome": "Welcome", "pageTitle": "{{title}}", "pageTitle_withArea": "{{title}} in {{- areaName}}", - "entryTitle": "<0>Entry title: <1>{{-value}}", + "entryTitle": "<0><0>Entry title: <1>{{- value}}", "cms": { "blocks": { "headline": { diff --git a/src/app/components/ui/ukhsa/View/View.tsx b/src/app/components/ui/ukhsa/View/View.tsx index 4aaed0b55..bae28ca93 100644 --- a/src/app/components/ui/ukhsa/View/View.tsx +++ b/src/app/components/ui/ukhsa/View/View.tsx @@ -54,22 +54,22 @@ export async function View({ {showWelcome &&

{t('welcome')}

} {heading && ( -

- {heading} - - , ]} - values={{ value: heading }} - /> - -

+ + + , + ]} + values={{ value: heading }} + /> )} {lastUpdated && ( From 68e19ca38ac228b687b21eed0c055f8c4b157f1e Mon Sep 17 00:00:00 2001 From: Temi Akinsoto Date: Fri, 1 Nov 2024 09:34:08 +0000 Subject: [PATCH 04/12] add heading value --- public/locales/en/common.json | 2 +- src/app/components/ui/ukhsa/View/View.tsx | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index ce35854c4..d708792b7 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -19,7 +19,7 @@ "welcome": "Welcome", "pageTitle": "{{title}}", "pageTitle_withArea": "{{title}} in {{- areaName}}", - "entryTitle": "<0><0>Entry title: <1>{{- value}}", + "entryTitle": "<0>Entry title: <1>{{- value}}", "cms": { "blocks": { "headline": { diff --git a/src/app/components/ui/ukhsa/View/View.tsx b/src/app/components/ui/ukhsa/View/View.tsx index bae28ca93..b6a1efd54 100644 --- a/src/app/components/ui/ukhsa/View/View.tsx +++ b/src/app/components/ui/ukhsa/View/View.tsx @@ -58,15 +58,14 @@ export async function View({ i18nKey="entryTitle" t={t} components={[ + ,

- -

, + key={1} + >, ]} values={{ value: heading }} /> From 6e1eade796cee0452d9a9fc5f94dafaa0376e3df Mon Sep 17 00:00:00 2001 From: Temi Akinsoto Date: Fri, 1 Nov 2024 09:57:08 +0000 Subject: [PATCH 05/12] add content for heading --- src/app/components/ui/ukhsa/View/View.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/components/ui/ukhsa/View/View.tsx b/src/app/components/ui/ukhsa/View/View.tsx index b6a1efd54..4ee9a166d 100644 --- a/src/app/components/ui/ukhsa/View/View.tsx +++ b/src/app/components/ui/ukhsa/View/View.tsx @@ -65,7 +65,9 @@ export async function View({ 'govuk-!-margin-bottom-2': lastUpdated, })} key={1} - >, + > + {heading} + , ]} values={{ value: heading }} /> From 9801b3bad52b3a1a92ef9b07a65b58867d8ebd14 Mon Sep 17 00:00:00 2001 From: A-Ashiq Date: Thu, 14 Nov 2024 16:43:51 +0000 Subject: [PATCH 06/12] Change meta type for form pages from feedback.FormPage -> forms.FormPage --- src/api/models/cms/Page/FormFields.ts | 2 +- src/api/requests/cms/getPage.ts | 2 +- src/api/requests/cms/getPages.ts | 2 +- src/app/components/cms/Feedback/Feedback.tsx | 2 +- .../handlers/cms/pages/fixtures/page/feedback.ts | 10 +++++----- src/mock-server/handlers/cms/pages/index.ts | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/api/models/cms/Page/FormFields.ts b/src/api/models/cms/Page/FormFields.ts index 8cf8e9f13..991b8e897 100644 --- a/src/api/models/cms/Page/FormFields.ts +++ b/src/api/models/cms/Page/FormFields.ts @@ -3,7 +3,7 @@ import { z } from 'zod' export const FormField = z.object({ id: z.number(), meta: z.object({ - type: z.literal('feedback.FormField'), + type: z.literal('forms.FormField'), }), clean_name: z.string(), label: z.string(), diff --git a/src/api/requests/cms/getPage.ts b/src/api/requests/cms/getPage.ts index bc33dc868..06311ff7c 100644 --- a/src/api/requests/cms/getPage.ts +++ b/src/api/requests/cms/getPage.ts @@ -54,7 +54,7 @@ const WithLandingData = SharedPageData.extend({ const withFeedbackData = SharedPageData.extend({ meta: Meta.extend({ - type: z.literal('feedback.FormPage'), + type: z.literal('forms.FormPage'), }), body: z.string(), form_fields: FormFields, diff --git a/src/api/requests/cms/getPages.ts b/src/api/requests/cms/getPages.ts index 700dbfc9c..f9ef076f4 100644 --- a/src/api/requests/cms/getPages.ts +++ b/src/api/requests/cms/getPages.ts @@ -31,7 +31,7 @@ import { logger } from '@/lib/logger' export enum PageType { Home = 'home.HomePage', Landing = 'home.LandingPage', - Feedback = 'feedback.FormPage', + Feedback = 'forms.FormPage', Common = 'common.CommonPage', Composite = 'composite.CompositePage', Topic = 'topic.TopicPage', diff --git a/src/app/components/cms/Feedback/Feedback.tsx b/src/app/components/cms/Feedback/Feedback.tsx index 5c254ebe9..619fcaa8b 100644 --- a/src/app/components/cms/Feedback/Feedback.tsx +++ b/src/app/components/cms/Feedback/Feedback.tsx @@ -17,7 +17,7 @@ const initialState = { interface FeedbackProps { formFields: { id: number - meta: { type: 'feedback.FormField' } + meta: { type: 'forms.FormField' } clean_name: string label: string field_type: string diff --git a/src/mock-server/handlers/cms/pages/fixtures/page/feedback.ts b/src/mock-server/handlers/cms/pages/fixtures/page/feedback.ts index 139babf1d..90194b348 100644 --- a/src/mock-server/handlers/cms/pages/fixtures/page/feedback.ts +++ b/src/mock-server/handlers/cms/pages/fixtures/page/feedback.ts @@ -5,7 +5,7 @@ export const feedbackMock: PageResponse = { id: 81, meta: { seo_title: 'Feedback | UKHSA data dashboard', - type: 'feedback.FormPage', + type: 'forms.FormPage', detail_url: 'https://localhost/api/pages/79/', html_url: 'https://localhost/feedback/', slug: 'feedback', @@ -32,7 +32,7 @@ export const feedbackMock: PageResponse = { { id: 1, meta: { - type: 'feedback.FormField', + type: 'forms.FormField', }, clean_name: 'what_was_your_reason_for_visiting_the_dashboard_today', label: 'What was your reason for visiting the dashboard today?', @@ -46,7 +46,7 @@ export const feedbackMock: PageResponse = { { id: 2, meta: { - type: 'feedback.FormField', + type: 'forms.FormField', }, clean_name: 'did_you_find_everything_you_were_looking_for', label: 'Did you find everything you were looking for?', @@ -59,7 +59,7 @@ export const feedbackMock: PageResponse = { { id: 3, meta: { - type: 'feedback.FormField', + type: 'forms.FormField', }, clean_name: 'how_could_we_improve_your_experience_with_the_dashboard', label: 'How could we improve your experience with the dashboard?', @@ -72,7 +72,7 @@ export const feedbackMock: PageResponse = { { id: 4, meta: { - type: 'feedback.FormField', + type: 'forms.FormField', }, clean_name: 'what_would_you_like_to_see_on_the_dashboard_in_the_future', label: 'What would you like to see on the dashboard in the future?', diff --git a/src/mock-server/handlers/cms/pages/index.ts b/src/mock-server/handlers/cms/pages/index.ts index 60c5d2439..53aa4cd1e 100644 --- a/src/mock-server/handlers/cms/pages/index.ts +++ b/src/mock-server/handlers/cms/pages/index.ts @@ -25,7 +25,7 @@ export const mockedPagesMap: Record = { 'home.HomePage': pagesWithHomeTypeMock, 'home.LandingPage': pagesWithLandingTypeMock, 'topic.TopicPage': pagesWithTopicTypeMock, - 'feedback.FormPage': pagesWithFeedbackTypeMock, + 'forms.FormPage': pagesWithFeedbackTypeMock, 'common.CommonPage': pagesWithCommonTypeMock, 'composite.CompositePage': pagesWithCompositeTypeMock, 'whats_new.WhatsNewParentPage': pagesWithWhatsNewParentTypeMock, From 04164d1787350f47a0e94d1a230c33c5b32320bc Mon Sep 17 00:00:00 2001 From: Rhys Date: Thu, 14 Nov 2024 17:09:53 +0000 Subject: [PATCH 07/12] Confirmation page add feature flag --- .../(pages)/feedback/confirmation/page.tsx | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/app/(pages)/feedback/confirmation/page.tsx b/src/app/(pages)/feedback/confirmation/page.tsx index b1fa6638d..dd868ee2f 100644 --- a/src/app/(pages)/feedback/confirmation/page.tsx +++ b/src/app/(pages)/feedback/confirmation/page.tsx @@ -5,6 +5,8 @@ import { PageType } from '@/api/requests/cms/getPages' import { getPageBySlug } from '@/api/requests/getPageBySlug' import { RichText } from '@/app/components/cms' import { View } from '@/app/components/ui/ukhsa' +import { flags } from '@/app/constants/flags.constants' +import { getFeatureFlag } from '@/app/utils/flags.utils' export const metadata: Metadata = { title: 'Feedback Confirmation | UKHSA data dashboard', @@ -17,15 +19,32 @@ export default async function FeedbackConfirmation() { confirmation_body: body, } = await getPageBySlug('feedback') + const { enabled } = await getFeatureFlag(flags.feedbackForm) + return (
-

{panelTitle}

-
{panelText}
+

{enabled ? panelTitle : 'Form submitted'}

+
{enabled ? panelText : 'Thank you for your feedback'}
- {body} + {enabled ? ( + {body} + ) : ( + <> +

+ Thank you for giving feedback on the UKHSA data dashboard. We will use your comments to help us + continually improve the service. We will not be able to get in touch with you about your comments. +

+

+ The feedback form is intended for feedback on your experience using the dashboard. If you need to get in + touch with UK Health Security Agency, you can find contact information at the bottom of the{' '} + UKHSA webpage +

+ + )} + Return to home page From 567f5e895139e753f4cfb6408e6eff02b21d7a23 Mon Sep 17 00:00:00 2001 From: Phillip Stanley Date: Thu, 14 Nov 2024 17:29:14 +0000 Subject: [PATCH 08/12] reduce lighthouse performance budget --- unlighthouse.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unlighthouse.config.ts b/unlighthouse.config.ts index b824b7148..0d188bdbe 100644 --- a/unlighthouse.config.ts +++ b/unlighthouse.config.ts @@ -9,7 +9,7 @@ export default { }, ci: { budget: { - performance: 75, + performance: 70, accessibility: 90, 'best-practices': 90, seo: 90, From c82594860b22a71bdcbdedf60010dd6b58f2cd8a Mon Sep 17 00:00:00 2001 From: Phillip Stanley Date: Fri, 15 Nov 2024 11:45:39 +0000 Subject: [PATCH 09/12] switch wha map to cold --- .../weather-health-alerts-parent.fixture.ts | 2 +- .../(weather-health-alerts)/weather-health-alerts/page.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/fixtures/pages/weather-health-alerts/weather-health-alerts-parent.fixture.ts b/e2e/fixtures/pages/weather-health-alerts/weather-health-alerts-parent.fixture.ts index 2e2efc941..0be28caf9 100644 --- a/e2e/fixtures/pages/weather-health-alerts/weather-health-alerts-parent.fixture.ts +++ b/e2e/fixtures/pages/weather-health-alerts/weather-health-alerts-parent.fixture.ts @@ -25,7 +25,7 @@ export class WeatherHealthAlertsParentPage { async hasMapLink() { await expect(this.page.getByRole('link', { name: 'View map of weather health alerts' })).toHaveAttribute( 'href', - '?v=map&type=heat' + '?v=map&type=cold' ) } diff --git a/src/app/(topics)/(weather-health-alerts)/weather-health-alerts/page.tsx b/src/app/(topics)/(weather-health-alerts)/weather-health-alerts/page.tsx index 57b397946..a189d81d2 100644 --- a/src/app/(topics)/(weather-health-alerts)/weather-health-alerts/page.tsx +++ b/src/app/(topics)/(weather-health-alerts)/weather-health-alerts/page.tsx @@ -45,7 +45,7 @@ export default async function WeatherHealthAlerts() {
- +
From 0c0639699bb10d0b1156d7ff63d8909f5bbcdadc Mon Sep 17 00:00:00 2001 From: Rhys Date: Fri, 15 Nov 2024 12:21:35 +0000 Subject: [PATCH 10/12] Updating postSuggestions tests inline with schema --- .../requests/suggestions/postSuggestions.spec.ts | 14 +++++++------- src/api/requests/suggestions/postSuggestions.ts | 2 +- src/schemas/feedback.schema.ts | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/api/requests/suggestions/postSuggestions.spec.ts b/src/api/requests/suggestions/postSuggestions.spec.ts index ebf88163c..7373eb8d3 100644 --- a/src/api/requests/suggestions/postSuggestions.spec.ts +++ b/src/api/requests/suggestions/postSuggestions.spec.ts @@ -8,10 +8,10 @@ test('Handles successful submission from the api', async () => { postSuggestion.mockResolvedValueOnce({ status: 200, data: {} }) const { success } = await postSuggestions({ - improve_experience: '', - did_you_find_everything: 'yes', - reason: '', - like_to_see: '', + what_was_your_reason_for_visiting_the_dashboard_today: '', + did_you_find_everything_you_were_looking_for: 'yes', + how_could_we_improve_your_experience_with_the_dashboard: '', + what_would_you_like_to_see_on_the_dashboard_in_the_future: '', }) expect(success).toBeTruthy() @@ -21,9 +21,9 @@ test('Handles non 200 response from the api', async () => { postSuggestion.mockResolvedValueOnce({ status: 500, data: {} }) const { success } = await postSuggestions({ - improve_experience: '', - reason: '', - like_to_see: '', + how_could_we_improve_your_experience_with_the_dashboard: '', + what_was_your_reason_for_visiting_the_dashboard_today: '', + what_would_you_like_to_see_on_the_dashboard_in_the_future: '', }) expect(success).toBeFalsy() diff --git a/src/api/requests/suggestions/postSuggestions.ts b/src/api/requests/suggestions/postSuggestions.ts index a23cff5cb..8118c78d4 100644 --- a/src/api/requests/suggestions/postSuggestions.ts +++ b/src/api/requests/suggestions/postSuggestions.ts @@ -12,7 +12,7 @@ export type RequestParams = z.infer export const postSuggestions = async (suggestions: RequestParams) => { try { - const { status } = await client('suggestions/v1', { + const { status } = await client('suggestions/v2', { body: suggestions, baseUrl: getFeedbackApiBaseUrl(), }) diff --git a/src/schemas/feedback.schema.ts b/src/schemas/feedback.schema.ts index 005035e93..9dcb03968 100644 --- a/src/schemas/feedback.schema.ts +++ b/src/schemas/feedback.schema.ts @@ -2,9 +2,9 @@ import * as z from 'zod' export const feedbackSchema = z .object({ - reason: z.string().optional().nullable(), - did_you_find_everything: z.enum(['yes', 'no']).or(z.undefined()), - improve_experience: z.string().optional().nullable(), - like_to_see: z.string().optional().nullable(), + what_was_your_reason_for_visiting_the_dashboard_today: z.string().optional().nullable(), + did_you_find_everything_you_were_looking_for: z.enum(['yes', 'no']).or(z.undefined()), + how_could_we_improve_your_experience_with_the_dashboard: z.string().optional().nullable(), + what_would_you_like_to_see_on_the_dashboard_in_the_future: z.string().optional().nullable(), }) .required() From cb327791c27a3f90963c56b2bd31fadfdc0cc564 Mon Sep 17 00:00:00 2001 From: Rhys Date: Fri, 15 Nov 2024 14:34:13 +0000 Subject: [PATCH 11/12] Added suggestions v2 mock, removed feature flag --- .../requests/suggestions/postSuggestions.ts | 4 ++ .../(pages)/feedback/confirmation/page.tsx | 25 ++--------- .../(pages)/feature-flags/page.tsx | 43 +------------------ src/app/components/cms/utils/handler.ts | 9 ++++ src/app/constants/flags.constants.ts | 1 - .../handlers/suggestions/{v1.ts => v2.ts} | 0 src/mock-server/index.ts | 4 +- 7 files changed, 20 insertions(+), 66 deletions(-) rename src/mock-server/handlers/suggestions/{v1.ts => v2.ts} (100%) diff --git a/src/api/requests/suggestions/postSuggestions.ts b/src/api/requests/suggestions/postSuggestions.ts index 8118c78d4..e13d87c32 100644 --- a/src/api/requests/suggestions/postSuggestions.ts +++ b/src/api/requests/suggestions/postSuggestions.ts @@ -11,11 +11,15 @@ export const requestSchema = feedbackSchema export type RequestParams = z.infer export const postSuggestions = async (suggestions: RequestParams) => { + console.log('Post suggestions reached') + try { const { status } = await client('suggestions/v2', { body: suggestions, baseUrl: getFeedbackApiBaseUrl(), }) + console.log('status', status) + if (status !== 200) { throw new Error('Failed to submit, invalid status code') } diff --git a/src/app/(pages)/feedback/confirmation/page.tsx b/src/app/(pages)/feedback/confirmation/page.tsx index dd868ee2f..c74686b01 100644 --- a/src/app/(pages)/feedback/confirmation/page.tsx +++ b/src/app/(pages)/feedback/confirmation/page.tsx @@ -5,8 +5,6 @@ import { PageType } from '@/api/requests/cms/getPages' import { getPageBySlug } from '@/api/requests/getPageBySlug' import { RichText } from '@/app/components/cms' import { View } from '@/app/components/ui/ukhsa' -import { flags } from '@/app/constants/flags.constants' -import { getFeatureFlag } from '@/app/utils/flags.utils' export const metadata: Metadata = { title: 'Feedback Confirmation | UKHSA data dashboard', @@ -19,31 +17,16 @@ export default async function FeedbackConfirmation() { confirmation_body: body, } = await getPageBySlug('feedback') - const { enabled } = await getFeatureFlag(flags.feedbackForm) - return (
-

{enabled ? panelTitle : 'Form submitted'}

-
{enabled ? panelText : 'Thank you for your feedback'}
+

{panelTitle}

+
{panelText}
- {enabled ? ( - {body} - ) : ( - <> -

- Thank you for giving feedback on the UKHSA data dashboard. We will use your comments to help us - continually improve the service. We will not be able to get in touch with you about your comments. -

-

- The feedback form is intended for feedback on your experience using the dashboard. If you need to get in - touch with UK Health Security Agency, you can find contact information at the bottom of the{' '} - UKHSA webpage -

- - )} + + {body} Return to home page diff --git a/src/app/(pages)/switchboard/(pages)/feature-flags/page.tsx b/src/app/(pages)/switchboard/(pages)/feature-flags/page.tsx index 24ea5c694..837fbf55d 100644 --- a/src/app/(pages)/switchboard/(pages)/feature-flags/page.tsx +++ b/src/app/(pages)/switchboard/(pages)/feature-flags/page.tsx @@ -10,11 +10,7 @@ export default function SwitchBoard() { const cookieStore = cookies() const { - flags: { - 'landing-page-hero': landingPageHero, - 'interactive-charts': interactiveCharts, - 'feedback-form': feedbackForm, - }, + flags: { 'landing-page-hero': landingPageHero, 'interactive-charts': interactiveCharts }, } = getSwitchBoardState(cookieStore.get(UKHSA_SWITCHBOARD_COOKIE_NAME)?.value) return ( @@ -28,7 +24,6 @@ export default function SwitchBoard() { { 'landing-page-hero': form.get('flags.landingPageHero') as string, 'interactive-charts': form.get('flags.interactiveCharts') as string, - 'feedback-form': form.get('flags.feedbackForm') as string, } ) }} @@ -109,42 +104,6 @@ export default function SwitchBoard() {
- -
- -
- - -
- -
- - -
-