From d66eb52a32b9ee1dd3bca2c368a555ef7ed320ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dafydd=20Ll=C5=B7r=20Pearson?= Date: Thu, 8 Feb 2024 17:36:08 +0000 Subject: [PATCH] fix: Handle additional breadcrumb info in SummaryList component --- .../Review/Public/mocks/fileUpload.tsx | 22 +++++++++++++++++++ .../components/shared/Preview/SummaryList.tsx | 2 ++ 2 files changed, 24 insertions(+) diff --git a/editor.planx.uk/src/@planx/components/Review/Public/mocks/fileUpload.tsx b/editor.planx.uk/src/@planx/components/Review/Public/mocks/fileUpload.tsx index d8d7d3a0b1..cbbbbd9e15 100644 --- a/editor.planx.uk/src/@planx/components/Review/Public/mocks/fileUpload.tsx +++ b/editor.planx.uk/src/@planx/components/Review/Public/mocks/fileUpload.tsx @@ -1,3 +1,5 @@ +import { PASSPORT_REQUESTED_FILES_KEY } from "@planx/components/FileUploadAndLabel/model"; + export const mockLink = "my-file.png"; export const uploadedPlanUrl = "http://someurl.com/whjhnh65/plan.png"; @@ -10,6 +12,11 @@ export const fileUploadBreadcrumbs = { filename: "my-file.png", }, ], + [PASSPORT_REQUESTED_FILES_KEY]: { + required: ["fileUpload"], + recommended: [], + optional: [], + }, }, }, }; @@ -44,6 +51,11 @@ export const fileUploadPassport = { filename: "my-file.png", }, ], + [PASSPORT_REQUESTED_FILES_KEY]: { + required: ["fileUpload"], + recommended: [], + optional: [], + }, }, }; @@ -88,6 +100,11 @@ export const uploadedPlansBreadcrumb = { }, ], }, + [PASSPORT_REQUESTED_FILES_KEY]: { + required: ["locationPlan"], + recommended: [], + optional: [], + }, }, }; @@ -124,6 +141,11 @@ export const uploadedPlansPassport = { url: uploadedPlanUrl, }, ], + [PASSPORT_REQUESTED_FILES_KEY]: { + required: ["locationPlan"], + recommended: [], + optional: [], + }, }, }; diff --git a/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx b/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx index e5a20bd827..742af6f432 100644 --- a/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx +++ b/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx @@ -4,6 +4,7 @@ import { styled } from "@mui/material/styles"; import Typography from "@mui/material/Typography"; import { visuallyHidden } from "@mui/utils"; import { PASSPORT_UPLOAD_KEY } from "@planx/components/DrawBoundary/model"; +import { PASSPORT_REQUESTED_FILES_KEY } from "@planx/components/FileUploadAndLabel/model"; import { TYPES } from "@planx/components/types"; import format from "date-fns/format"; import { useAnalyticsTracking } from "pages/FlowEditor/lib/analyticsProvider"; @@ -493,6 +494,7 @@ function ContactInput(props: ComponentProps) { function FileUploadAndLabel(props: ComponentProps) { const userFiles = Object.entries(props?.userData?.data || {}); const allFilenames: string[] = userFiles + .filter(([key]) => key !== PASSPORT_REQUESTED_FILES_KEY) .map(([_key, value]) => value.map((file: any) => file.filename)) .flat(); const uniqueFilenames = [...new Set(allFilenames)];