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 26245b8d01..51679b5ff8 100644 --- a/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx +++ b/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx @@ -9,6 +9,7 @@ import { } from "@opensystemslab/planx-core/types"; import { PASSPORT_UPLOAD_KEY } from "@planx/components/DrawBoundary/model"; import { PASSPORT_REQUESTED_FILES_KEY } from "@planx/components/FileUploadAndLabel/model"; +import type { Page } from "@planx/components/Page/model"; import { ConfirmationDialog } from "components/ConfirmationDialog"; import format from "date-fns/format"; import { useAnalyticsTracking } from "pages/FlowEditor/lib/analytics/provider"; @@ -16,6 +17,8 @@ import { Store, useStore } from "pages/FlowEditor/lib/store"; import React, { useState } from "react"; import { FONT_WEIGHT_SEMI_BOLD } from "theme"; +import { SchemaUserResponse } from "../Schema/model"; + export default SummaryListsBySections; /** These component types don't use their node title as the descriptive list title */ @@ -108,8 +111,7 @@ const presentationalComponents: { [TYPES.Notice]: undefined, [TYPES.NextSteps]: undefined, [TYPES.NumberInput]: NumberInput, - // TODO! - [TYPES.Page]: undefined, + [TYPES.Page]: Page, [TYPES.Pay]: undefined, [TYPES.PlanningConstraints]: undefined, [TYPES.PropertyInformation]: undefined, @@ -618,6 +620,34 @@ function FileUploadAndLabel(props: ComponentProps) { ); } +function Page(props: ComponentProps) { + const answers = getAnswersByNode(props) as SchemaUserResponse[]; + const fields = (props.node.data as Page).schema.fields; + + return ( + <> + {props.node.data.title} + + {fields.map((field) => ( + + + {field.data.title} + + + {field.type === "map" + ? `${answers[0][field.data.fn].length || 0} features` + : answers[0][field.data.fn]} + + + ))} + + + ); +} + function Debug(props: ComponentProps) { return ( <>