diff --git a/api.planx.uk/modules/gis/service/local_authorities/metadata/base.ts b/api.planx.uk/modules/gis/service/local_authorities/metadata/base.ts index 3970556b03..f04251789f 100644 --- a/api.planx.uk/modules/gis/service/local_authorities/metadata/base.ts +++ b/api.planx.uk/modules/gis/service/local_authorities/metadata/base.ts @@ -91,7 +91,7 @@ const baseSchema: PlanningConstraintsBaseSchema = { active: true, neg: "is not, or is not within, a Listed Building", pos: "is, or is within, a Listed Building", - "digital-land-datasets": ["listed-building", "listed-building-outline"], // HE publishes points, LPAs publish polygons + "digital-land-datasets": ["listed-building", "listed-building-outline"], // HE published points, LPAs publish polygons category: "Heritage and conservation", }, locallyListed: { diff --git a/editor.planx.uk/src/@planx/components/List/Editor.tsx b/editor.planx.uk/src/@planx/components/List/Editor.tsx index 0066f539d7..bad6870d6f 100644 --- a/editor.planx.uk/src/@planx/components/List/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/List/Editor.tsx @@ -14,13 +14,13 @@ import InputRowLabel from "ui/shared/InputRowLabel"; import { EditorProps, ICONS, InternalNotes, MoreInformation } from "../ui"; import { List, parseContent } from "./model"; import { ProposedAdvertisements } from "./schemas/Adverts"; -import { MaterialDetails } from "./schemas/Materials"; import { NonResidentialFloorspace } from "./schemas/Floorspace"; import { BuildingDetailsGLA } from "./schemas/GLA/BuildingDetails"; import { CommunalSpaceGLA } from "./schemas/GLA/CommunalSpace"; import { ExistingAndProposedUsesGLA } from "./schemas/GLA/ExistingAndProposedUses"; import { OpenSpaceGLA } from "./schemas/GLA/OpenSpace"; import { ProtectedSpaceGLA } from "./schemas/GLA/ProtectedSpace"; +import { MaterialDetails } from "./schemas/Materials"; import { ResidentialUnitsExisting } from "./schemas/ResidentialUnits/Existing"; import { ResidentialUnitsGLANew } from "./schemas/ResidentialUnits/GLA/New"; import { ResidentialUnitsGLARebuilt } from "./schemas/ResidentialUnits/GLA/Rebuilt"; @@ -28,7 +28,6 @@ import { ResidentialUnitsGLARemoved } from "./schemas/ResidentialUnits/GLA/Remov import { ResidentialUnitsGLARetained } from "./schemas/ResidentialUnits/GLA/Retained"; import { ResidentialUnitsProposed } from "./schemas/ResidentialUnits/Proposed"; - type Props = EditorProps; export const SCHEMAS = [ diff --git a/editor.planx.uk/src/@planx/components/List/schemas/Materials.ts b/editor.planx.uk/src/@planx/components/List/schemas/Materials.ts index be09469488..414f693644 100644 --- a/editor.planx.uk/src/@planx/components/List/schemas/Materials.ts +++ b/editor.planx.uk/src/@planx/components/List/schemas/Materials.ts @@ -29,7 +29,10 @@ export const MaterialDetails: Schema = { }, { id: "surface", - data: { text: "External ground materials for access and parking", val: "surface" }, + data: { + text: "External ground materials for access and parking", + val: "surface", + }, }, { id: "lighting", diff --git a/editor.planx.uk/src/@planx/components/PlanningConstraints/List.tsx b/editor.planx.uk/src/@planx/components/PlanningConstraints/List.tsx index 60e0c59c81..085c03265e 100644 --- a/editor.planx.uk/src/@planx/components/PlanningConstraints/List.tsx +++ b/editor.planx.uk/src/@planx/components/PlanningConstraints/List.tsx @@ -1,3 +1,4 @@ +import HelpIcon from "@mui/icons-material/Help"; import Accordion from "@mui/material/Accordion"; import AccordionDetails from "@mui/material/AccordionDetails"; import AccordionSummary from "@mui/material/AccordionSummary"; @@ -14,12 +15,21 @@ import type { Metadata, } from "@opensystemslab/planx-core/types"; import groupBy from "lodash/groupBy"; -import React, { ReactNode } from "react"; +import { useAnalyticsTracking } from "pages/FlowEditor/lib/analytics/provider"; +import { HelpClickMetadata } from "pages/FlowEditor/lib/analytics/types"; +import { useStore } from "pages/FlowEditor/lib/store"; +import React, { ReactNode, useState } from "react"; import ReactHtmlParser from "react-html-parser"; import { FONT_WEIGHT_SEMI_BOLD } from "theme"; +import { emptyContent } from "ui/editor/RichTextInput"; import Caret from "ui/icons/Caret"; import ReactMarkdownOrHtml from "ui/shared/ReactMarkdownOrHtml"; +import { SiteAddress } from "../FindProperty/model"; +import { HelpButton } from "../shared/Preview/CardHeader"; +import MoreInfo from "../shared/Preview/MoreInfo"; +import MoreInfoSection from "../shared/Preview/MoreInfoSection"; + const CATEGORY_COLORS: Record = { "General policy": "#99C1DE", "Heritage and conservation": "#EDDCD2", @@ -75,7 +85,7 @@ export default function ConstraintsList({ }); return ( - + {Object.keys(groupedConstraints).map( (category: string, index: number) => ( @@ -105,11 +115,11 @@ export default function ConstraintsList({ {category} - - {groupedConstraints[category].map((con: any) => ( + + {groupedConstraints[category].map((con: Constraint) => ( state.computePassport().data?._address, + ) as SiteAddress) || {}; + + const handleHelpClick = (metadata: HelpClickMetadata) => { + setOpen(true); + trackEvent({ event: "helpClick", metadata }); // This returns a promise but we don't need to await for it + }; + const item = props.metadata?.name.replaceAll(" ", "-"); return ( - + <> - - {`This property ${props?.content}`} + + {props.value + ? `${ + props.metadata?.plural || "Entities" + } that intersect with your property:` + : `We did not find any ${ + props.metadata?.plural?.toLowerCase() || "entities" + } that apply to your property.`} - {Boolean(props.data?.length) && ( - - {props.data && - props.data.map( - (record: any) => - record.name && ( - - - {record.name}{" "} - {record.name && record["documentation-url"] && ( - - ( - - source - - ) - - )} - - - ), - )} + {props.value && ( + + {props.data?.map((record: any) => ( + + + {record.name || + (record["flood-risk-level"] && + `${props.metadata?.name} - Level ${record["flood-risk-level"]}`) || + `Entity #${record.entity}`} + + + Report an inaccuracy + + + ))} )} + {props.metadata?.plural !== "Classified roads" && ( + + {`See ${props.metadata?.plural?.toLowerCase()} ${ + props.value ? `at this property` : `` + } on the `} + + Planning Data map + + {` (opens in a new tab).`} + + )} + {props.metadata?.text && props.metadata.text !== emptyContent && ( + + + handleHelpClick({ + [props.key]: props.metadata?.name || "Constraint", + }) + } + aria-haspopup="dialog" + data-testid="more-info-button" + > + More information + + + )} + setOpen(false)}> + + + {props.metadata?.plural === "Classified roads" ? ( + `Ordnance Survey MasterMap Highways` + ) : ( + + Planning Data + + )} + + + + + + - - - diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/PublishDialog.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/PublishDialog.tsx index 446cfafedd..f956eaccbb 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/PublishDialog.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/PublishDialog.tsx @@ -1,6 +1,7 @@ import Close from "@mui/icons-material/Close"; import Done from "@mui/icons-material/Done"; import NotInterested from "@mui/icons-material/NotInterested"; +import Warning from "@mui/icons-material/Warning"; import Box from "@mui/material/Box"; import Button from "@mui/material/Button"; import Collapse from "@mui/material/Collapse"; @@ -18,7 +19,6 @@ import { useAsync } from "react-use"; import Caret from "ui/icons/Caret"; import { useStore } from "../../lib/store"; -import Warning from "@mui/icons-material/Warning"; export interface AlteredNode { id: string; diff --git a/editor.planx.uk/src/pages/FlowEditor/lib/store/index.ts b/editor.planx.uk/src/pages/FlowEditor/lib/store/index.ts index 94572fdd6b..5e90c35e50 100644 --- a/editor.planx.uk/src/pages/FlowEditor/lib/store/index.ts +++ b/editor.planx.uk/src/pages/FlowEditor/lib/store/index.ts @@ -1,6 +1,6 @@ import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import { isPreviewOnlyDomain } from "routes/utils"; -import { create, StoreApi,UseBoundStore } from "zustand"; +import { create, StoreApi, UseBoundStore } from "zustand"; import type { EditorStore, EditorUIStore } from "./editor"; import type { NavigationStore } from "./navigation"; diff --git a/editor.planx.uk/src/routes/views/flowEditor.tsx b/editor.planx.uk/src/routes/views/flowEditor.tsx index d80823711b..e2a47bb846 100644 --- a/editor.planx.uk/src/routes/views/flowEditor.tsx +++ b/editor.planx.uk/src/routes/views/flowEditor.tsx @@ -67,8 +67,10 @@ const getFlowMetadata = async ( */ export const flowEditorView = async (req: NaviRequest) => { const [flow] = req.params.flow.split(","); - const { flowAnalyticsLink, isFlowPublished } = - await getFlowMetadata(flow, req.params.team); + const { flowAnalyticsLink, isFlowPublished } = await getFlowMetadata( + flow, + req.params.team, + ); useStore.setState({ flowAnalyticsLink, isFlowPublished }); return (