From a1edf8cebfec6f3196c5a05fb5956c6d81b626d4 Mon Sep 17 00:00:00 2001 From: Jo Humphrey <31373245+jamdelion@users.noreply.github.com> Date: Mon, 28 Oct 2024 16:22:45 +0000 Subject: [PATCH 1/8] Refactor ui.tsx --- .../@planx/components/AddressInput/Editor.tsx | 3 +- .../@planx/components/AddressInput/Public.tsx | 2 +- .../@planx/components/Calculate/Editor.tsx | 3 +- .../@planx/components/Calculate/Public.tsx | 2 +- .../@planx/components/Checklist/Editor.tsx | 32 +-- .../@planx/components/Checklist/Public.tsx | 2 +- .../src/@planx/components/Checklist/types.ts | 26 +++ .../@planx/components/Confirmation/Editor.tsx | 3 +- .../@planx/components/Confirmation/Public.tsx | 2 +- .../@planx/components/ContactInput/Editor.tsx | 3 +- .../@planx/components/ContactInput/Public.tsx | 2 +- .../src/@planx/components/Content/Editor.tsx | 4 +- .../src/@planx/components/Content/Public.tsx | 2 +- .../@planx/components/DateInput/Editor.tsx | 2 +- .../@planx/components/DateInput/Public.tsx | 2 +- .../@planx/components/DrawBoundary/Editor.tsx | 3 +- .../components/DrawBoundary/Public/index.tsx | 2 +- .../components/ExternalPortal/Editor.tsx | 2 +- .../src/@planx/components/Feedback/Public.tsx | 2 +- .../@planx/components/FileUpload/Editor.tsx | 3 +- .../components/FileUploadAndLabel/Editor.tsx | 3 +- .../components/FileUploadAndLabel/Public.tsx | 2 +- .../src/@planx/components/Filter/Editor.tsx | 2 +- .../@planx/components/FindProperty/Editor.tsx | 3 +- .../components/FindProperty/Public/index.tsx | 2 +- .../src/@planx/components/InternalNotes.tsx | 36 ++++ .../components/InternalPortal/Editor.tsx | 2 +- .../src/@planx/components/List/Editor.tsx | 3 +- .../@planx/components/List/Public/Context.tsx | 2 +- .../@planx/components/List/Public/index.tsx | 2 +- .../@planx/components/MapAndLabel/Editor.tsx | 3 +- .../components/MapAndLabel/Public/index.tsx | 2 +- .../MoreInformation/MoreInformation.tsx | 60 ++++++ .../components/MoreInformation/types.ts | 7 + .../@planx/components/NextSteps/Editor.tsx | 4 +- .../@planx/components/NextSteps/Public.tsx | 2 +- .../src/@planx/components/Notice/Editor.tsx | 6 +- .../src/@planx/components/Notice/Public.tsx | 2 +- .../@planx/components/NumberInput/Editor.tsx | 4 +- .../@planx/components/NumberInput/Public.tsx | 2 +- .../src/@planx/components/Page/Editor.tsx | 3 +- .../src/@planx/components/Page/Public.tsx | 2 +- .../src/@planx/components/Pay/Editor.tsx | 2 +- .../src/@planx/components/Pay/Public/Pay.tsx | 2 +- .../components/PlanningConstraints/Editor.tsx | 2 +- .../components/PlanningConstraints/Public.tsx | 2 +- .../components/PropertyInformation/Editor.tsx | 2 +- .../components/PropertyInformation/Public.tsx | 2 +- .../src/@planx/components/Question/Editor.tsx | 2 +- .../src/@planx/components/Result/Editor.tsx | 3 +- .../@planx/components/Result/Public/index.tsx | 4 +- .../src/@planx/components/Review/Editor.tsx | 3 +- .../@planx/components/Review/Public/index.tsx | 2 +- .../src/@planx/components/Section/Editor.tsx | 3 +- .../src/@planx/components/Section/Public.tsx | 2 +- .../src/@planx/components/Send/Editor.tsx | 6 +- .../src/@planx/components/Send/Public.tsx | 2 +- .../src/@planx/components/SetValue/Editor.tsx | 2 +- .../src/@planx/components/SetValue/Public.tsx | 2 +- .../src/@planx/components/TaskList/Editor.tsx | 2 +- .../src/@planx/components/TaskList/Public.tsx | 2 +- .../@planx/components/TextInput/Editor.tsx | 3 +- .../@planx/components/TextInput/Public.tsx | 2 +- .../@planx/components/fixtures/Wrapper.tsx | 2 +- .../src/@planx/components/shared/icons.tsx | 70 +++++++ .../src/@planx/components/sharedTypes.tsx | 21 ++ editor.planx.uk/src/@planx/components/ui.tsx | 190 ------------------ .../components/Flow/components/Checklist.tsx | 14 +- .../components/Flow/components/Filter.tsx | 2 +- .../components/Flow/components/Portal.tsx | 2 +- .../components/Flow/components/Question.tsx | 2 +- .../Sidebar/Search/SearchResultCard/index.tsx | 2 +- editor.planx.uk/src/ui/editor/ModalFooter.tsx | 2 +- 73 files changed, 325 insertions(+), 290 deletions(-) create mode 100644 editor.planx.uk/src/@planx/components/Checklist/types.ts create mode 100644 editor.planx.uk/src/@planx/components/InternalNotes.tsx create mode 100644 editor.planx.uk/src/@planx/components/MoreInformation/MoreInformation.tsx create mode 100644 editor.planx.uk/src/@planx/components/MoreInformation/types.ts create mode 100644 editor.planx.uk/src/@planx/components/shared/icons.tsx create mode 100644 editor.planx.uk/src/@planx/components/sharedTypes.tsx delete mode 100644 editor.planx.uk/src/@planx/components/ui.tsx diff --git a/editor.planx.uk/src/@planx/components/AddressInput/Editor.tsx b/editor.planx.uk/src/@planx/components/AddressInput/Editor.tsx index e7bfef588d..13b948b9d3 100644 --- a/editor.planx.uk/src/@planx/components/AddressInput/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/AddressInput/Editor.tsx @@ -1,5 +1,5 @@ import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { EditorProps, ICONS } from "@planx/components/ui"; +import { EditorProps } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React from "react"; import { ModalFooter } from "ui/editor/ModalFooter"; @@ -9,6 +9,7 @@ import RichTextInput from "ui/editor/RichTextInput/RichTextInput"; import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; +import { ICONS } from "../shared/icons"; import { AddressInput, parseAddressInput } from "./model"; export type Props = EditorProps; diff --git a/editor.planx.uk/src/@planx/components/AddressInput/Public.tsx b/editor.planx.uk/src/@planx/components/AddressInput/Public.tsx index c48adc4897..71c1822535 100644 --- a/editor.planx.uk/src/@planx/components/AddressInput/Public.tsx +++ b/editor.planx.uk/src/@planx/components/AddressInput/Public.tsx @@ -1,6 +1,6 @@ import Card from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; -import type { PublicProps } from "@planx/components/ui"; +import type { PublicProps } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React from "react"; import InputLabel from "ui/public/InputLabel"; diff --git a/editor.planx.uk/src/@planx/components/Calculate/Editor.tsx b/editor.planx.uk/src/@planx/components/Calculate/Editor.tsx index 7937956891..21de1d01a9 100644 --- a/editor.planx.uk/src/@planx/components/Calculate/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Calculate/Editor.tsx @@ -3,7 +3,7 @@ import { styled } from "@mui/material/styles"; import Switch from "@mui/material/Switch"; import Typography from "@mui/material/Typography"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { EditorProps, ICONS } from "@planx/components/ui"; +import { EditorProps } from "@planx/components/sharedTypes"; import { FormikErrors, useFormik } from "formik"; import React from "react"; import InputGroup from "ui/editor/InputGroup"; @@ -13,6 +13,7 @@ import ModalSectionContent from "ui/editor/ModalSectionContent"; import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; +import { ICONS } from "../shared/icons"; import type { Calculate } from "./model"; import { evaluate, getVariables, parseCalculate } from "./model"; diff --git a/editor.planx.uk/src/@planx/components/Calculate/Public.tsx b/editor.planx.uk/src/@planx/components/Calculate/Public.tsx index af6aaffbcb..21a7396187 100644 --- a/editor.planx.uk/src/@planx/components/Calculate/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Calculate/Public.tsx @@ -1,5 +1,5 @@ import { makeData } from "@planx/components/shared/utils"; -import type { PublicProps } from "@planx/components/ui"; +import type { PublicProps } from "@planx/components/sharedTypes"; import { useStore } from "pages/FlowEditor/lib/store"; import { useEffect } from "react"; diff --git a/editor.planx.uk/src/@planx/components/Checklist/Editor.tsx b/editor.planx.uk/src/@planx/components/Checklist/Editor.tsx index d5de61d6aa..4df56c1bdb 100644 --- a/editor.planx.uk/src/@planx/components/Checklist/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Checklist/Editor.tsx @@ -23,36 +23,14 @@ import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; import InputRowItem from "ui/shared/InputRowItem"; -import { BaseNodeData, Option, parseBaseNodeData } from "../shared"; +import { Option, parseBaseNodeData } from "../shared"; +import { ICONS } from "../shared/icons"; import PermissionSelect from "../shared/PermissionSelect"; -import { ICONS } from "../ui"; -import type { Category, Checklist, Group } from "./model"; +import type { Checklist, Group } from "./model"; import { toggleExpandableChecklist } from "./model"; +import { ChecklistProps, OptionEditorProps } from "./types"; -export interface ChecklistProps extends Checklist { - text: string; - handleSubmit?: Function; - node?: { - data?: { - allRequired?: boolean; - categories?: Array; - description?: string; - fn?: string; - img?: string; - text: string; - } & BaseNodeData; - }; -} - -const OptionEditor: React.FC<{ - index: number; - value: Option; - onChange: (newVal: Option) => void; - groupIndex?: number; - groups?: Array; - onMoveToGroup?: (itemIndex: number, groupIndex: number) => void; - showValueField?: boolean; -}> = (props) => { +const OptionEditor: React.FC = (props) => { return (
diff --git a/editor.planx.uk/src/@planx/components/Checklist/Public.tsx b/editor.planx.uk/src/@planx/components/Checklist/Public.tsx index 11cdd84c31..866e380d35 100644 --- a/editor.planx.uk/src/@planx/components/Checklist/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Checklist/Public.tsx @@ -21,7 +21,7 @@ import ErrorWrapper from "ui/shared/ErrorWrapper"; import { object } from "yup"; import { Option } from "../shared"; -import type { PublicProps } from "../ui"; +import type { PublicProps } from "../sharedTypes"; export type Props = PublicProps; diff --git a/editor.planx.uk/src/@planx/components/Checklist/types.ts b/editor.planx.uk/src/@planx/components/Checklist/types.ts new file mode 100644 index 0000000000..3028ea6163 --- /dev/null +++ b/editor.planx.uk/src/@planx/components/Checklist/types.ts @@ -0,0 +1,26 @@ +import { BaseNodeData, Option } from "../shared"; +import type { Category, Checklist } from "./model"; + +export interface ChecklistProps extends Checklist { + text: string; + handleSubmit?: Function; + node?: { + data?: { + allRequired?: boolean; + categories?: Array; + description?: string; + fn?: string; + img?: string; + text: string; + } & BaseNodeData; + }; +} +export interface OptionEditorProps { + index: number; + value: Option; + onChange: (newVal: Option) => void; + groupIndex?: number; + groups?: Array; + onMoveToGroup?: (itemIndex: number, groupIndex: number) => void; + showValueField?: boolean; +} diff --git a/editor.planx.uk/src/@planx/components/Confirmation/Editor.tsx b/editor.planx.uk/src/@planx/components/Confirmation/Editor.tsx index 75da2069f9..b4a3da492b 100644 --- a/editor.planx.uk/src/@planx/components/Confirmation/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Confirmation/Editor.tsx @@ -1,6 +1,6 @@ import Box from "@mui/material/Box"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { EditorProps, ICONS } from "@planx/components/ui"; +import { EditorProps } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React, { ChangeEvent } from "react"; import ListManager, { @@ -12,6 +12,7 @@ import RichTextInput from "ui/editor/RichTextInput/RichTextInput"; import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; +import { ICONS } from "../shared/icons"; import { Confirmation, parseNextSteps, Step } from "./model"; export type Props = EditorProps; diff --git a/editor.planx.uk/src/@planx/components/Confirmation/Public.tsx b/editor.planx.uk/src/@planx/components/Confirmation/Public.tsx index e6316ad774..59bf8fc0d8 100644 --- a/editor.planx.uk/src/@planx/components/Confirmation/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Confirmation/Public.tsx @@ -4,7 +4,7 @@ import Typography from "@mui/material/Typography"; import { QuestionAndResponses } from "@opensystemslab/planx-core/types"; import Card from "@planx/components/shared/Preview/Card"; import { SummaryListTable } from "@planx/components/shared/Preview/SummaryList"; -import { PublicProps } from "@planx/components/ui"; +import { PublicProps } from "@planx/components/sharedTypes"; import { objectWithoutNullishValues } from "lib/objectHelpers"; import { Store, useStore } from "pages/FlowEditor/lib/store"; import React, { useEffect, useState } from "react"; diff --git a/editor.planx.uk/src/@planx/components/ContactInput/Editor.tsx b/editor.planx.uk/src/@planx/components/ContactInput/Editor.tsx index 962d0330bf..6f10caef5f 100644 --- a/editor.planx.uk/src/@planx/components/ContactInput/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/ContactInput/Editor.tsx @@ -1,5 +1,5 @@ import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { EditorProps, ICONS } from "@planx/components/ui"; +import { EditorProps } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React from "react"; import { ModalFooter } from "ui/editor/ModalFooter"; @@ -9,6 +9,7 @@ import RichTextInput from "ui/editor/RichTextInput/RichTextInput"; import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; +import { ICONS } from "../shared/icons"; import { ContactInput, parseContactInput } from "./model"; export type Props = EditorProps; diff --git a/editor.planx.uk/src/@planx/components/ContactInput/Public.tsx b/editor.planx.uk/src/@planx/components/ContactInput/Public.tsx index 340f124957..96f0e2500b 100644 --- a/editor.planx.uk/src/@planx/components/ContactInput/Public.tsx +++ b/editor.planx.uk/src/@planx/components/ContactInput/Public.tsx @@ -1,6 +1,6 @@ import Card from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; -import type { PublicProps } from "@planx/components/ui"; +import type { PublicProps } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React from "react"; import InputLabel from "ui/public/InputLabel"; diff --git a/editor.planx.uk/src/@planx/components/Content/Editor.tsx b/editor.planx.uk/src/@planx/components/Content/Editor.tsx index c361ddee4a..1a6db072ad 100644 --- a/editor.planx.uk/src/@planx/components/Content/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Content/Editor.tsx @@ -1,7 +1,7 @@ import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import type { Content } from "@planx/components/Content/model"; import { parseContent } from "@planx/components/Content/model"; -import { EditorProps, ICONS } from "@planx/components/ui"; +import { EditorProps } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React from "react"; import ColorPicker from "ui/editor/ColorPicker/ColorPicker"; @@ -11,6 +11,8 @@ import ModalSectionContent from "ui/editor/ModalSectionContent"; import RichTextInput from "ui/editor/RichTextInput/RichTextInput"; import InputRow from "ui/shared/InputRow"; +import { ICONS } from "../shared/icons"; + export type Props = EditorProps; const ContentComponent: React.FC = (props) => { diff --git a/editor.planx.uk/src/@planx/components/Content/Public.tsx b/editor.planx.uk/src/@planx/components/Content/Public.tsx index 3f3fba2c55..6cdc8e5c5d 100644 --- a/editor.planx.uk/src/@planx/components/Content/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Content/Public.tsx @@ -5,7 +5,7 @@ import { styled } from "@mui/material/styles"; import Typography from "@mui/material/Typography"; import type { Content } from "@planx/components/Content/model"; import Card from "@planx/components/shared/Preview/Card"; -import { PublicProps } from "@planx/components/ui"; +import { PublicProps } from "@planx/components/sharedTypes"; import { useAnalyticsTracking } from "pages/FlowEditor/lib/analytics/provider"; import React from "react"; import { getContrastTextColor } from "styleUtils"; diff --git a/editor.planx.uk/src/@planx/components/DateInput/Editor.tsx b/editor.planx.uk/src/@planx/components/DateInput/Editor.tsx index 50cd6d1d63..9240e09113 100644 --- a/editor.planx.uk/src/@planx/components/DateInput/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/DateInput/Editor.tsx @@ -6,7 +6,7 @@ import { paddedDate, parseDateInput, } from "@planx/components/DateInput/model"; -import { EditorProps, ICONS } from "@planx/components/ui"; +import { EditorProps } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React from "react"; import { ModalFooter } from "ui/editor/ModalFooter"; diff --git a/editor.planx.uk/src/@planx/components/DateInput/Public.tsx b/editor.planx.uk/src/@planx/components/DateInput/Public.tsx index 2d8db2ff69..5e92852d80 100644 --- a/editor.planx.uk/src/@planx/components/DateInput/Public.tsx +++ b/editor.planx.uk/src/@planx/components/DateInput/Public.tsx @@ -7,7 +7,7 @@ import { } from "@planx/components/DateInput/model"; import Card from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; -import { PublicProps } from "@planx/components/ui"; +import { PublicProps } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React from "react"; import DateInputComponent from "ui/shared/DateInput/DateInput"; diff --git a/editor.planx.uk/src/@planx/components/DrawBoundary/Editor.tsx b/editor.planx.uk/src/@planx/components/DrawBoundary/Editor.tsx index 2b6050db9a..fbb813da4e 100644 --- a/editor.planx.uk/src/@planx/components/DrawBoundary/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/DrawBoundary/Editor.tsx @@ -1,7 +1,7 @@ import FormControlLabel from "@mui/material/FormControlLabel"; import Switch from "@mui/material/Switch"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { EditorProps, ICONS } from "@planx/components/ui"; +import { EditorProps } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React from "react"; import InputGroup from "ui/editor/InputGroup"; @@ -12,6 +12,7 @@ import RichTextInput from "ui/editor/RichTextInput/RichTextInput"; import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; +import { ICONS } from "../shared/icons"; import type { DrawBoundary } from "./model"; import { parseDrawBoundary } from "./model"; diff --git a/editor.planx.uk/src/@planx/components/DrawBoundary/Public/index.tsx b/editor.planx.uk/src/@planx/components/DrawBoundary/Public/index.tsx index 0d09c79d65..a6bb873114 100644 --- a/editor.planx.uk/src/@planx/components/DrawBoundary/Public/index.tsx +++ b/editor.planx.uk/src/@planx/components/DrawBoundary/Public/index.tsx @@ -12,7 +12,7 @@ import { } from "@planx/components/shared/Preview/MapContainer"; import { PrivateFileUpload } from "@planx/components/shared/PrivateFileUpload/PrivateFileUpload"; import { squareMetresToHectares } from "@planx/components/shared/utils"; -import type { PublicProps } from "@planx/components/ui"; +import type { PublicProps } from "@planx/components/sharedTypes"; import buffer from "@turf/buffer"; import { point } from "@turf/helpers"; import { Feature } from "geojson"; diff --git a/editor.planx.uk/src/@planx/components/ExternalPortal/Editor.tsx b/editor.planx.uk/src/@planx/components/ExternalPortal/Editor.tsx index 9e8d44e52c..5350889a30 100644 --- a/editor.planx.uk/src/@planx/components/ExternalPortal/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/ExternalPortal/Editor.tsx @@ -4,7 +4,7 @@ import React from "react"; import ModalSection from "ui/editor/ModalSection"; import ModalSectionContent from "ui/editor/ModalSectionContent"; -import { ICONS } from "../ui"; +import { ICONS } from "../sharedTypes"; interface Flow { id: string; diff --git a/editor.planx.uk/src/@planx/components/Feedback/Public.tsx b/editor.planx.uk/src/@planx/components/Feedback/Public.tsx index a26a2d7fe5..4a8fbc4523 100644 --- a/editor.planx.uk/src/@planx/components/Feedback/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Feedback/Public.tsx @@ -4,7 +4,7 @@ import Link from "@mui/material/Link"; import Typography from "@mui/material/Typography"; import Card from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; -import type { PublicProps } from "@planx/components/ui"; +import type { PublicProps } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React from "react"; import RichTextInput from "ui/editor/RichTextInput/RichTextInput"; diff --git a/editor.planx.uk/src/@planx/components/FileUpload/Editor.tsx b/editor.planx.uk/src/@planx/components/FileUpload/Editor.tsx index 3e6b69c6cc..cd84592001 100644 --- a/editor.planx.uk/src/@planx/components/FileUpload/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/FileUpload/Editor.tsx @@ -1,5 +1,4 @@ import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { ICONS } from "@planx/components/ui"; import { useFormik } from "formik"; import React from "react"; import { ModalFooter } from "ui/editor/ModalFooter"; @@ -9,6 +8,8 @@ import RichTextInput from "ui/editor/RichTextInput/RichTextInput"; import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; +import { ICONS } from "../shared/icons"; + function Component(props: any) { const formik = useFormik<{ color: string; diff --git a/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Editor.tsx b/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Editor.tsx index 3635853e62..c485cd6e28 100644 --- a/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Editor.tsx @@ -7,7 +7,7 @@ import { styled } from "@mui/material/styles"; import Switch from "@mui/material/Switch"; import Typography from "@mui/material/Typography"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { EditorProps, ICONS } from "@planx/components/ui"; +import { EditorProps } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import { lowerCase, merge, upperFirst } from "lodash"; import React from "react"; @@ -25,6 +25,7 @@ import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; import InputRowItem from "ui/shared/InputRowItem"; +import { ICONS } from "../shared/icons"; import { checkIfConditionalRule, Condition, diff --git a/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Public.tsx b/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Public.tsx index a661f1ad28..466c664f95 100644 --- a/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Public.tsx +++ b/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Public.tsx @@ -6,7 +6,7 @@ import ListItem from "@mui/material/ListItem"; import ListSubheader from "@mui/material/ListSubheader"; import { styled } from "@mui/material/styles"; import Typography from "@mui/material/Typography"; -import { PublicProps } from "@planx/components/ui"; +import { PublicProps } from "@planx/components/sharedTypes"; import { PrintButton } from "components/PrintButton"; import capitalize from "lodash/capitalize"; import { useAnalyticsTracking } from "pages/FlowEditor/lib/analytics/provider"; diff --git a/editor.planx.uk/src/@planx/components/Filter/Editor.tsx b/editor.planx.uk/src/@planx/components/Filter/Editor.tsx index b7b84f8ec3..b301d25d28 100644 --- a/editor.planx.uk/src/@planx/components/Filter/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Filter/Editor.tsx @@ -9,7 +9,7 @@ import React from "react"; import ModalSection from "ui/editor/ModalSection"; import ModalSectionContent from "ui/editor/ModalSectionContent"; -import { ICONS } from "../ui"; +import { ICONS } from "../sharedTypes"; export interface Props { id?: string; diff --git a/editor.planx.uk/src/@planx/components/FindProperty/Editor.tsx b/editor.planx.uk/src/@planx/components/FindProperty/Editor.tsx index 208bd2333c..ecfecfc637 100644 --- a/editor.planx.uk/src/@planx/components/FindProperty/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/FindProperty/Editor.tsx @@ -1,7 +1,7 @@ import FormControlLabel from "@mui/material/FormControlLabel"; import Switch from "@mui/material/Switch"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { EditorProps, ICONS } from "@planx/components/ui"; +import { EditorProps } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React from "react"; import InputGroup from "ui/editor/InputGroup"; @@ -13,6 +13,7 @@ import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; import InputRowItem from "ui/shared/InputRowItem"; +import { ICONS } from "../shared/icons"; import type { FindProperty } from "./model"; import { parseFindProperty } from "./model"; diff --git a/editor.planx.uk/src/@planx/components/FindProperty/Public/index.tsx b/editor.planx.uk/src/@planx/components/FindProperty/Public/index.tsx index c5fed728cb..98d5cdf777 100644 --- a/editor.planx.uk/src/@planx/components/FindProperty/Public/index.tsx +++ b/editor.planx.uk/src/@planx/components/FindProperty/Public/index.tsx @@ -6,7 +6,7 @@ import Typography from "@mui/material/Typography"; import Card from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; import { squareMetresToHectares } from "@planx/components/shared/utils"; -import { PublicProps } from "@planx/components/ui"; +import { PublicProps } from "@planx/components/sharedTypes"; import area from "@turf/area"; import DelayedLoadingIndicator from "components/DelayedLoadingIndicator/DelayedLoadingIndicator"; import { Feature } from "geojson"; diff --git a/editor.planx.uk/src/@planx/components/InternalNotes.tsx b/editor.planx.uk/src/@planx/components/InternalNotes.tsx new file mode 100644 index 0000000000..0ea5e00dc1 --- /dev/null +++ b/editor.planx.uk/src/@planx/components/InternalNotes.tsx @@ -0,0 +1,36 @@ +import BorderColorIcon from "@mui/icons-material/BorderColor"; +import React, { ChangeEvent } from "react"; +import ModalSection from "ui/editor/ModalSection"; +import ModalSectionContent from "ui/editor/ModalSectionContent"; +import Input from "ui/shared/Input/Input"; +import InputRow from "ui/shared/InputRow"; + +export interface InternalNotesProps { + name?: string; + value?: string; + onChange: (ev: ChangeEvent) => void; +} + +export const InternalNotes: React.FC = ({ + name, + value, + onChange, +}) => { + return ( + + + + + + + + ); +}; diff --git a/editor.planx.uk/src/@planx/components/InternalPortal/Editor.tsx b/editor.planx.uk/src/@planx/components/InternalPortal/Editor.tsx index 127d0862fd..5ee5f29345 100644 --- a/editor.planx.uk/src/@planx/components/InternalPortal/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/InternalPortal/Editor.tsx @@ -3,7 +3,7 @@ import { useFormik } from "formik"; import React from "react"; import InputField from "ui/editor/InputField/InputField"; -import { FormError } from "../ui"; +import { FormError } from "../sharedTypes"; interface Flow { id: string; diff --git a/editor.planx.uk/src/@planx/components/List/Editor.tsx b/editor.planx.uk/src/@planx/components/List/Editor.tsx index 00b057be3d..2b85e01572 100644 --- a/editor.planx.uk/src/@planx/components/List/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/List/Editor.tsx @@ -13,7 +13,8 @@ import InputRow from "ui/shared/InputRow"; import InputRowItem from "ui/shared/InputRowItem"; import InputRowLabel from "ui/shared/InputRowLabel"; -import { EditorProps, ICONS } from "../ui"; +import { ICONS } from "../shared/icons"; +import { EditorProps } from "../sharedTypes"; import { List, parseContent, validationSchema } from "./model"; import { ProposedAdvertisements } from "./schemas/Adverts"; import { NonResidentialFloorspace } from "./schemas/Floorspace"; diff --git a/editor.planx.uk/src/@planx/components/List/Public/Context.tsx b/editor.planx.uk/src/@planx/components/List/Public/Context.tsx index 929320bd68..cf3832d276 100644 --- a/editor.planx.uk/src/@planx/components/List/Public/Context.tsx +++ b/editor.planx.uk/src/@planx/components/List/Public/Context.tsx @@ -8,7 +8,7 @@ import { getPreviouslySubmittedData, makeData, } from "@planx/components/shared/utils"; -import { PublicProps } from "@planx/components/ui"; +import { PublicProps } from "@planx/components/sharedTypes"; import { FormikProps, useFormik } from "formik"; import React, { createContext, diff --git a/editor.planx.uk/src/@planx/components/List/Public/index.tsx b/editor.planx.uk/src/@planx/components/List/Public/index.tsx index 861e7268da..bff55b6f4e 100644 --- a/editor.planx.uk/src/@planx/components/List/Public/index.tsx +++ b/editor.planx.uk/src/@planx/components/List/Public/index.tsx @@ -9,7 +9,7 @@ import TableCell from "@mui/material/TableCell"; import TableRow from "@mui/material/TableRow"; import Typography from "@mui/material/Typography"; import { SchemaFields } from "@planx/components/shared/Schema/SchemaFields"; -import { PublicProps } from "@planx/components/ui"; +import { PublicProps } from "@planx/components/sharedTypes"; import React, { useEffect, useRef } from "react"; import { FONT_WEIGHT_SEMI_BOLD } from "theme"; import FullWidthWrapper from "ui/public/FullWidthWrapper"; diff --git a/editor.planx.uk/src/@planx/components/MapAndLabel/Editor.tsx b/editor.planx.uk/src/@planx/components/MapAndLabel/Editor.tsx index 6f14c52153..d68c3892e4 100644 --- a/editor.planx.uk/src/@planx/components/MapAndLabel/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/MapAndLabel/Editor.tsx @@ -17,8 +17,9 @@ import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; import InputRowItem from "ui/shared/InputRowItem"; +import { ICONS } from "../shared/icons"; import BasicRadio from "../shared/Radio/BasicRadio"; -import { EditorProps, ICONS } from "../ui"; +import { EditorProps } from "../sharedTypes"; import { MapAndLabel, parseContent } from "./model"; import { Trees } from "./schemas/Trees"; diff --git a/editor.planx.uk/src/@planx/components/MapAndLabel/Public/index.tsx b/editor.planx.uk/src/@planx/components/MapAndLabel/Public/index.tsx index b6aee6bfa5..bd6a536f40 100644 --- a/editor.planx.uk/src/@planx/components/MapAndLabel/Public/index.tsx +++ b/editor.planx.uk/src/@planx/components/MapAndLabel/Public/index.tsx @@ -21,7 +21,7 @@ import ErrorWrapper from "ui/shared/ErrorWrapper"; import Card from "../../shared/Preview/Card"; import { CardHeader } from "../../shared/Preview/CardHeader/CardHeader"; import { MapContainer } from "../../shared/Preview/MapContainer"; -import { PublicProps } from "../../ui"; +import { PublicProps } from "../../sharedTypes"; import type { MapAndLabel } from "./../model"; import { MAP_ID, MapAndLabelProvider, useMapAndLabelContext } from "./Context"; import { CopyFeature } from "./CopyFeature"; diff --git a/editor.planx.uk/src/@planx/components/MoreInformation/MoreInformation.tsx b/editor.planx.uk/src/@planx/components/MoreInformation/MoreInformation.tsx new file mode 100644 index 0000000000..d0eaf5e709 --- /dev/null +++ b/editor.planx.uk/src/@planx/components/MoreInformation/MoreInformation.tsx @@ -0,0 +1,60 @@ +import InfoOutlined from "@mui/icons-material/InfoOutlined"; +import React from "react"; +import ImgInput from "ui/editor/ImgInput/ImgInput"; +import InputGroup from "ui/editor/InputGroup"; +import InputLabel from "ui/editor/InputLabel"; +import ModalSection from "ui/editor/ModalSection"; +import ModalSectionContent from "ui/editor/ModalSectionContent"; +import RichTextInput from "ui/editor/RichTextInput/RichTextInput"; +import InputRow from "ui/shared/InputRow"; + +export const MoreInformation = ({ + changeField, + definitionImg, + howMeasured, + policyRef, + info, +}: MoreInformationProps) => { + return ( + + + + + + + + + + + + + { + changeField({ + target: { name: "definitionImg", value: newUrl }, + }); + }} + /> + + + + + + ); +}; diff --git a/editor.planx.uk/src/@planx/components/MoreInformation/types.ts b/editor.planx.uk/src/@planx/components/MoreInformation/types.ts new file mode 100644 index 0000000000..c3f4b90c78 --- /dev/null +++ b/editor.planx.uk/src/@planx/components/MoreInformation/types.ts @@ -0,0 +1,7 @@ +interface MoreInformationProps { + changeField: (changes: any) => any; + howMeasured?: string; + policyRef?: string; + info?: string; + definitionImg?: string; +} diff --git a/editor.planx.uk/src/@planx/components/NextSteps/Editor.tsx b/editor.planx.uk/src/@planx/components/NextSteps/Editor.tsx index 17e7c42aeb..98d5ed0421 100644 --- a/editor.planx.uk/src/@planx/components/NextSteps/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/NextSteps/Editor.tsx @@ -2,7 +2,7 @@ import Box from "@mui/material/Box"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import type { NextSteps, Step } from "@planx/components/NextSteps/model"; import { parseNextSteps } from "@planx/components/NextSteps/model"; -import { EditorProps, ICONS } from "@planx/components/ui"; +import { EditorProps } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React, { ChangeEvent } from "react"; import ListManager, { @@ -15,6 +15,8 @@ import RichTextInput from "ui/editor/RichTextInput/RichTextInput"; import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; +import { ICONS } from "../shared/icons"; + type Props = EditorProps; const newStep = (): Step => ({ diff --git a/editor.planx.uk/src/@planx/components/NextSteps/Public.tsx b/editor.planx.uk/src/@planx/components/NextSteps/Public.tsx index 208cd4dc0f..4023b76fab 100644 --- a/editor.planx.uk/src/@planx/components/NextSteps/Public.tsx +++ b/editor.planx.uk/src/@planx/components/NextSteps/Public.tsx @@ -1,4 +1,4 @@ -import { PublicProps } from "@planx/components/ui"; +import { PublicProps } from "@planx/components/sharedTypes"; import React from "react"; import NextStepsList from "ui/public/NextStepsList"; diff --git a/editor.planx.uk/src/@planx/components/Notice/Editor.tsx b/editor.planx.uk/src/@planx/components/Notice/Editor.tsx index 48d2a9cc09..51c1239972 100644 --- a/editor.planx.uk/src/@planx/components/Notice/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Notice/Editor.tsx @@ -3,7 +3,11 @@ import Switch from "@mui/material/Switch"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import type { Notice } from "@planx/components/Notice/model"; import { parseNotice } from "@planx/components/Notice/model"; -import { ICONS, InternalNotes, MoreInformation } from "@planx/components/ui"; +import { + ICONS, + InternalNotes, + MoreInformation, +} from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React from "react"; import ColorPicker from "ui/editor/ColorPicker/ColorPicker"; diff --git a/editor.planx.uk/src/@planx/components/Notice/Public.tsx b/editor.planx.uk/src/@planx/components/Notice/Public.tsx index e87b9d133b..b6283f6aec 100644 --- a/editor.planx.uk/src/@planx/components/Notice/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Notice/Public.tsx @@ -9,7 +9,7 @@ import Card, { contentFlowSpacing, } from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; -import { PublicProps } from "@planx/components/ui"; +import { PublicProps } from "@planx/components/sharedTypes"; import { useAnalyticsTracking } from "pages/FlowEditor/lib/analytics/provider"; import React from "react"; import { getContrastTextColor } from "styleUtils"; diff --git a/editor.planx.uk/src/@planx/components/NumberInput/Editor.tsx b/editor.planx.uk/src/@planx/components/NumberInput/Editor.tsx index dbe326843c..e37ad007ac 100644 --- a/editor.planx.uk/src/@planx/components/NumberInput/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/NumberInput/Editor.tsx @@ -3,7 +3,7 @@ import Switch from "@mui/material/Switch"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import type { NumberInput } from "@planx/components/NumberInput/model"; import { parseNumberInput } from "@planx/components/NumberInput/model"; -import { EditorProps, ICONS } from "@planx/components/ui"; +import { EditorProps } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React from "react"; import { ModalFooter } from "ui/editor/ModalFooter"; @@ -15,6 +15,8 @@ import InputRow from "ui/shared/InputRow"; import InputRowItem from "ui/shared/InputRowItem"; import InputRowLabel from "ui/shared/InputRowLabel"; +import { ICONS } from "../shared/icons"; + export type Props = EditorProps; export default function NumberInputComponent(props: Props): FCReturn { diff --git a/editor.planx.uk/src/@planx/components/NumberInput/Public.tsx b/editor.planx.uk/src/@planx/components/NumberInput/Public.tsx index 3987e98396..9f8f6f4a7d 100644 --- a/editor.planx.uk/src/@planx/components/NumberInput/Public.tsx +++ b/editor.planx.uk/src/@planx/components/NumberInput/Public.tsx @@ -1,6 +1,6 @@ import Card from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; -import { PublicProps } from "@planx/components/ui"; +import { PublicProps } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import isNil from "lodash/isNil"; import React, { useEffect, useRef } from "react"; diff --git a/editor.planx.uk/src/@planx/components/Page/Editor.tsx b/editor.planx.uk/src/@planx/components/Page/Editor.tsx index b70b830a85..470485ccfe 100644 --- a/editor.planx.uk/src/@planx/components/Page/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Page/Editor.tsx @@ -12,7 +12,8 @@ import InputRow from "ui/shared/InputRow"; import InputRowItem from "ui/shared/InputRowItem"; import InputRowLabel from "ui/shared/InputRowLabel"; -import { EditorProps, ICONS } from "../ui"; +import { ICONS } from "../shared/icons"; +import { EditorProps } from "../sharedTypes"; import { Page, parsePage } from "./model"; import { ProposedAdvertisements } from "./schema/AdvertConsent"; diff --git a/editor.planx.uk/src/@planx/components/Page/Public.tsx b/editor.planx.uk/src/@planx/components/Page/Public.tsx index 615fbb4108..22cf4476a7 100644 --- a/editor.planx.uk/src/@planx/components/Page/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Page/Public.tsx @@ -1,4 +1,4 @@ -import { PublicProps } from "@planx/components/ui"; +import { PublicProps } from "@planx/components/sharedTypes"; import { FormikConfig, useFormik } from "formik"; import React from "react"; diff --git a/editor.planx.uk/src/@planx/components/Pay/Editor.tsx b/editor.planx.uk/src/@planx/components/Pay/Editor.tsx index 2716d7c509..854750f869 100644 --- a/editor.planx.uk/src/@planx/components/Pay/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Pay/Editor.tsx @@ -19,7 +19,7 @@ import { ICONS, InternalNotes, MoreInformation, -} from "@planx/components/ui"; +} from "@planx/components/sharedTypes"; import { Form, Formik, useFormikContext } from "formik"; import { useStore } from "pages/FlowEditor/lib/store"; import React from "react"; diff --git a/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx b/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx index ec7318a1f1..01f376d36b 100644 --- a/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx +++ b/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx @@ -3,7 +3,7 @@ import { GovUKPayment, PaymentStatus, } from "@opensystemslab/planx-core/types"; -import { PublicProps } from "@planx/components/ui"; +import { PublicProps } from "@planx/components/sharedTypes"; import { logger } from "airbrake"; import axios from "axios"; import DelayedLoadingIndicator from "components/DelayedLoadingIndicator/DelayedLoadingIndicator"; diff --git a/editor.planx.uk/src/@planx/components/PlanningConstraints/Editor.tsx b/editor.planx.uk/src/@planx/components/PlanningConstraints/Editor.tsx index ee7ced4ac4..92ce460f2c 100644 --- a/editor.planx.uk/src/@planx/components/PlanningConstraints/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/PlanningConstraints/Editor.tsx @@ -8,7 +8,7 @@ import TableHead from "@mui/material/TableHead"; import TableRow from "@mui/material/TableRow"; import Typography from "@mui/material/Typography"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { EditorProps, ICONS } from "@planx/components/ui"; +import { EditorProps } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React from "react"; import { FONT_WEIGHT_BOLD } from "theme"; diff --git a/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.tsx b/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.tsx index af0fa89e5b..b69d44242e 100644 --- a/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.tsx +++ b/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.tsx @@ -4,7 +4,7 @@ import type { } from "@opensystemslab/planx-core/types"; import Card from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; -import type { PublicProps } from "@planx/components/ui"; +import type { PublicProps } from "@planx/components/sharedTypes"; import DelayedLoadingIndicator from "components/DelayedLoadingIndicator/DelayedLoadingIndicator"; import { GraphError } from "components/Error/GraphError"; import { useStore } from "pages/FlowEditor/lib/store"; diff --git a/editor.planx.uk/src/@planx/components/PropertyInformation/Editor.tsx b/editor.planx.uk/src/@planx/components/PropertyInformation/Editor.tsx index 9ce1c9e0cd..47af1278a5 100644 --- a/editor.planx.uk/src/@planx/components/PropertyInformation/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/PropertyInformation/Editor.tsx @@ -1,7 +1,7 @@ import FormControlLabel from "@mui/material/FormControlLabel"; import Switch from "@mui/material/Switch"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { EditorProps, ICONS } from "@planx/components/ui"; +import { EditorProps } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React from "react"; import { ModalFooter } from "ui/editor/ModalFooter"; diff --git a/editor.planx.uk/src/@planx/components/PropertyInformation/Public.tsx b/editor.planx.uk/src/@planx/components/PropertyInformation/Public.tsx index cd9402734a..6f4741a942 100644 --- a/editor.planx.uk/src/@planx/components/PropertyInformation/Public.tsx +++ b/editor.planx.uk/src/@planx/components/PropertyInformation/Public.tsx @@ -5,7 +5,7 @@ import { visuallyHidden } from "@mui/utils"; import Card from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; import { SummaryListTable } from "@planx/components/shared/Preview/SummaryList"; -import type { PublicProps } from "@planx/components/ui"; +import type { PublicProps } from "@planx/components/sharedTypes"; import { GraphError } from "components/Error/GraphError"; import { Feature } from "geojson"; import { publicClient } from "lib/graphql"; diff --git a/editor.planx.uk/src/@planx/components/Question/Editor.tsx b/editor.planx.uk/src/@planx/components/Question/Editor.tsx index 7db6a5a639..c9d903d2a7 100644 --- a/editor.planx.uk/src/@planx/components/Question/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Question/Editor.tsx @@ -14,7 +14,7 @@ import InputRowItem from "ui/shared/InputRowItem"; import { BaseNodeData, Option, parseBaseNodeData } from "../shared"; import PermissionSelect from "../shared/PermissionSelect"; -import { ICONS, InternalNotes, MoreInformation } from "../ui"; +import { ICONS, InternalNotes, MoreInformation } from "../sharedTypes"; interface Props { node: { diff --git a/editor.planx.uk/src/@planx/components/Result/Editor.tsx b/editor.planx.uk/src/@planx/components/Result/Editor.tsx index 87c8ff7dde..548d5d6948 100644 --- a/editor.planx.uk/src/@planx/components/Result/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Result/Editor.tsx @@ -14,7 +14,8 @@ import InputLabel from "ui/public/InputLabel"; import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; -import { EditorProps, ICONS } from "../ui"; +import { ICONS } from "../shared/icons"; +import { EditorProps } from "../sharedTypes"; import { FlagDisplayText, Result } from "./model"; type FlagWithValue = Flag & { value: NonNullable }; diff --git a/editor.planx.uk/src/@planx/components/Result/Public/index.tsx b/editor.planx.uk/src/@planx/components/Result/Public/index.tsx index 81bdce60c7..964d4eab81 100644 --- a/editor.planx.uk/src/@planx/components/Result/Public/index.tsx +++ b/editor.planx.uk/src/@planx/components/Result/Public/index.tsx @@ -6,7 +6,7 @@ import { DEFAULT_FLAG_CATEGORY } from "@opensystemslab/planx-core/types"; import Card from "@planx/components/shared/Preview/Card"; import SimpleExpand from "@planx/components/shared/Preview/SimpleExpand"; import { WarningContainer } from "@planx/components/shared/Preview/WarningContainer"; -import { PublicProps } from "@planx/components/ui"; +import { PublicProps } from "@planx/components/sharedTypes"; import { useStore } from "pages/FlowEditor/lib/store"; import { Response } from "pages/FlowEditor/lib/store/preview"; import React from "react"; @@ -177,4 +177,4 @@ const ResultComponent: React.FC = (props) => { ); }; -export default ResultComponent; \ No newline at end of file +export default ResultComponent; diff --git a/editor.planx.uk/src/@planx/components/Review/Editor.tsx b/editor.planx.uk/src/@planx/components/Review/Editor.tsx index 463d70c56a..2536a5e05e 100644 --- a/editor.planx.uk/src/@planx/components/Review/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Review/Editor.tsx @@ -8,7 +8,8 @@ import RichTextInput from "ui/editor/RichTextInput/RichTextInput"; import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; -import { EditorProps, ICONS } from "../ui"; +import { ICONS } from "../shared/icons"; +import { EditorProps } from "../sharedTypes"; import { parseContent, Review } from "./model"; type Props = EditorProps; diff --git a/editor.planx.uk/src/@planx/components/Review/Public/index.tsx b/editor.planx.uk/src/@planx/components/Review/Public/index.tsx index 44ead5f360..6bf742ed95 100644 --- a/editor.planx.uk/src/@planx/components/Review/Public/index.tsx +++ b/editor.planx.uk/src/@planx/components/Review/Public/index.tsx @@ -1,4 +1,4 @@ -import { PublicProps } from "@planx/components/ui"; +import { PublicProps } from "@planx/components/sharedTypes"; import { useStore } from "pages/FlowEditor/lib/store"; import React from "react"; diff --git a/editor.planx.uk/src/@planx/components/Section/Editor.tsx b/editor.planx.uk/src/@planx/components/Section/Editor.tsx index fcf6e3292c..995d82ba21 100644 --- a/editor.planx.uk/src/@planx/components/Section/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Section/Editor.tsx @@ -1,5 +1,5 @@ import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { EditorProps, ICONS } from "@planx/components/ui"; +import { EditorProps } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React from "react"; import { ModalFooter } from "ui/editor/ModalFooter"; @@ -9,6 +9,7 @@ import RichTextInput from "ui/editor/RichTextInput/RichTextInput"; import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; +import { ICONS } from "../shared/icons"; import { parseSection, Section } from "./model"; type Props = EditorProps; diff --git a/editor.planx.uk/src/@planx/components/Section/Public.tsx b/editor.planx.uk/src/@planx/components/Section/Public.tsx index 48c8fb6b65..e3c7ebd8ec 100644 --- a/editor.planx.uk/src/@planx/components/Section/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Section/Public.tsx @@ -4,7 +4,7 @@ import { styled } from "@mui/material/styles"; import Typography from "@mui/material/Typography"; import visuallyHidden from "@mui/utils/visuallyHidden"; import Tag, { TagType } from "@planx/components/shared/Buttons/Tag"; -import type { PublicProps } from "@planx/components/ui"; +import type { PublicProps } from "@planx/components/sharedTypes"; import { useAnalyticsTracking } from "pages/FlowEditor/lib/analytics/provider"; import { Store, useStore } from "pages/FlowEditor/lib/store"; import React from "react"; diff --git a/editor.planx.uk/src/@planx/components/Send/Editor.tsx b/editor.planx.uk/src/@planx/components/Send/Editor.tsx index 867e55c9a6..29c9274966 100644 --- a/editor.planx.uk/src/@planx/components/Send/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Send/Editor.tsx @@ -16,9 +16,9 @@ import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; import { array, object } from "yup"; -import { EditorProps, ICONS } from "../ui"; -import { Send } from "./model"; -import { parseContent } from "./model"; +import { ICONS } from "../shared/icons"; +import { EditorProps } from "../sharedTypes"; +import { parseContent, Send } from "./model"; export type Props = EditorProps; diff --git a/editor.planx.uk/src/@planx/components/Send/Public.tsx b/editor.planx.uk/src/@planx/components/Send/Public.tsx index 42cb18de02..44eb4ca304 100644 --- a/editor.planx.uk/src/@planx/components/Send/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Send/Public.tsx @@ -10,7 +10,7 @@ import { AsyncState } from "react-use/lib/useAsyncFn"; import Card from "../shared/Preview/Card"; import { WarningContainer } from "../shared/Preview/WarningContainer"; -import { PublicProps } from "../ui"; +import { PublicProps } from "../sharedTypes"; import { DEFAULT_DESTINATION, getCombinedEventsPayload, Send } from "./model"; /** Response returned by /create-send-events endpoint */ diff --git a/editor.planx.uk/src/@planx/components/SetValue/Editor.tsx b/editor.planx.uk/src/@planx/components/SetValue/Editor.tsx index a05222118a..15c9f7c3a1 100644 --- a/editor.planx.uk/src/@planx/components/SetValue/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/SetValue/Editor.tsx @@ -3,7 +3,7 @@ import RadioGroup from "@mui/material/RadioGroup"; import Typography from "@mui/material/Typography"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import BasicRadio from "@planx/components/shared/Radio/BasicRadio"; -import { EditorProps } from "@planx/components/ui"; +import { EditorProps } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React from "react"; import { ModalFooter } from "ui/editor/ModalFooter"; diff --git a/editor.planx.uk/src/@planx/components/SetValue/Public.tsx b/editor.planx.uk/src/@planx/components/SetValue/Public.tsx index 870d4b2948..9b1a65873d 100644 --- a/editor.planx.uk/src/@planx/components/SetValue/Public.tsx +++ b/editor.planx.uk/src/@planx/components/SetValue/Public.tsx @@ -1,5 +1,5 @@ import { makeData } from "@planx/components/shared/utils"; -import type { PublicProps } from "@planx/components/ui"; +import type { PublicProps } from "@planx/components/sharedTypes"; import { useEffect } from "react"; import type { SetValue } from "./model"; diff --git a/editor.planx.uk/src/@planx/components/TaskList/Editor.tsx b/editor.planx.uk/src/@planx/components/TaskList/Editor.tsx index 5eab90d175..0108a3c282 100644 --- a/editor.planx.uk/src/@planx/components/TaskList/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/TaskList/Editor.tsx @@ -1,8 +1,8 @@ import Box from "@mui/material/Box"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; +import { EditorProps } from "@planx/components/sharedTypes"; import type { Task, TaskList } from "@planx/components/TaskList/model"; import { parseTaskList } from "@planx/components/TaskList/model"; -import { EditorProps, ICONS } from "@planx/components/ui"; import { useFormik } from "formik"; import React, { ChangeEvent } from "react"; import ListManager, { diff --git a/editor.planx.uk/src/@planx/components/TaskList/Public.tsx b/editor.planx.uk/src/@planx/components/TaskList/Public.tsx index b348e7d72f..76fc7995c3 100644 --- a/editor.planx.uk/src/@planx/components/TaskList/Public.tsx +++ b/editor.planx.uk/src/@planx/components/TaskList/Public.tsx @@ -1,7 +1,7 @@ import Card from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; +import { PublicProps } from "@planx/components/sharedTypes"; import type { TaskList } from "@planx/components/TaskList/model"; -import { PublicProps } from "@planx/components/ui"; import React from "react"; import NumberedList from "ui/public/NumberedList"; diff --git a/editor.planx.uk/src/@planx/components/TextInput/Editor.tsx b/editor.planx.uk/src/@planx/components/TextInput/Editor.tsx index 769c36e57d..87231ddf5f 100644 --- a/editor.planx.uk/src/@planx/components/TextInput/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/TextInput/Editor.tsx @@ -2,7 +2,7 @@ import FormControl from "@mui/material/FormControl"; import RadioGroup from "@mui/material/RadioGroup"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import BasicRadio from "@planx/components/shared/Radio/BasicRadio"; -import { EditorProps, ICONS } from "@planx/components/ui"; +import { EditorProps } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React from "react"; import { ModalFooter } from "ui/editor/ModalFooter"; @@ -12,6 +12,7 @@ import RichTextInput from "ui/editor/RichTextInput/RichTextInput"; import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; +import { ICONS } from "../shared/icons"; import { parseTextInput, TextInput } from "./model"; export type Props = EditorProps; diff --git a/editor.planx.uk/src/@planx/components/TextInput/Public.tsx b/editor.planx.uk/src/@planx/components/TextInput/Public.tsx index ff97a75d91..210a2db24a 100644 --- a/editor.planx.uk/src/@planx/components/TextInput/Public.tsx +++ b/editor.planx.uk/src/@planx/components/TextInput/Public.tsx @@ -1,6 +1,6 @@ import Card from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; -import { PublicProps } from "@planx/components/ui"; +import { PublicProps } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React from "react"; import InputLabel from "ui/public/InputLabel"; diff --git a/editor.planx.uk/src/@planx/components/fixtures/Wrapper.tsx b/editor.planx.uk/src/@planx/components/fixtures/Wrapper.tsx index 6a68513ae3..d5b73e9512 100644 --- a/editor.planx.uk/src/@planx/components/fixtures/Wrapper.tsx +++ b/editor.planx.uk/src/@planx/components/fixtures/Wrapper.tsx @@ -1,5 +1,5 @@ import Button from "@mui/material/Button"; -import { EditorProps, PublicProps } from "@planx/components/ui"; +import { EditorProps, PublicProps } from "@planx/components/sharedTypes"; import React, { useState } from "react"; export default Wrapper; diff --git a/editor.planx.uk/src/@planx/components/shared/icons.tsx b/editor.planx.uk/src/@planx/components/shared/icons.tsx new file mode 100644 index 0000000000..8cb11eeed0 --- /dev/null +++ b/editor.planx.uk/src/@planx/components/shared/icons.tsx @@ -0,0 +1,70 @@ +import ArrowForwardIcon from "@mui/icons-material/ArrowForward"; +import Article from "@mui/icons-material/Article"; +import CallSplit from "@mui/icons-material/CallSplit"; +import CheckBoxOutlined from "@mui/icons-material/CheckBoxOutlined"; +import CloudUpload from "@mui/icons-material/CloudUpload"; +import ContactPage from "@mui/icons-material/ContactPage"; +import CopyAll from "@mui/icons-material/CopyAll"; +import Create from "@mui/icons-material/Create"; +import DoorFrontOutlined from "@mui/icons-material/DoorFrontOutlined"; +import Event from "@mui/icons-material/Event"; +import FilterAltOutlined from "@mui/icons-material/FilterAltOutlined"; +import FunctionsIcon from "@mui/icons-material/Functions"; +import Home from "@mui/icons-material/Home"; +import List from "@mui/icons-material/List"; +import ListAlt from "@mui/icons-material/ListAlt"; +import LocationOnOutlined from "@mui/icons-material/LocationOnOutlined"; +import Map from "@mui/icons-material/Map"; +import PaymentOutlined from "@mui/icons-material/PaymentOutlined"; +import Pin from "@mui/icons-material/Pin"; +import PlaylistAdd from "@mui/icons-material/PlaylistAdd"; +import PlaylistAddCheck from "@mui/icons-material/PlaylistAddCheck"; +import RateReviewOutlined from "@mui/icons-material/RateReviewOutlined"; +import ReportProblemOutlined from "@mui/icons-material/ReportProblemOutlined"; +import SearchOutlined from "@mui/icons-material/SearchOutlined"; +import Send from "@mui/icons-material/Send"; +import ShapeLine from "@mui/icons-material/ShapeLine"; +import SquareFoot from "@mui/icons-material/SquareFoot"; +import TextFields from "@mui/icons-material/TextFields"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; + +// XXX: We define the Icon type in terms of one of the Icons so as not to have to repeat ourselves +type Icon = typeof CheckBoxOutlined; + +export const ICONS: { + [key in TYPES]: Icon | undefined; +} = { + [TYPES.AddressInput]: Home, + [TYPES.Calculate]: FunctionsIcon, + [TYPES.Checklist]: CheckBoxOutlined, + [TYPES.ContactInput]: ContactPage, + [TYPES.Content]: TextFields, + [TYPES.Confirmation]: TextFields, + [TYPES.DateInput]: Event, + [TYPES.DrawBoundary]: SquareFoot, + [TYPES.ExternalPortal]: CopyAll, + [TYPES.FileUpload]: CloudUpload, + [TYPES.FileUploadAndLabel]: CloudUpload, + [TYPES.Filter]: FilterAltOutlined, + [TYPES.FindProperty]: SearchOutlined, + [TYPES.Flow]: undefined, + [TYPES.InternalPortal]: DoorFrontOutlined, + [TYPES.List]: ListAlt, + [TYPES.MapAndLabel]: ShapeLine, + [TYPES.Notice]: ReportProblemOutlined, + [TYPES.NextSteps]: ArrowForwardIcon, + [TYPES.NumberInput]: Pin, + [TYPES.Page]: Article, + [TYPES.Pay]: PaymentOutlined, + [TYPES.PlanningConstraints]: Map, + [TYPES.PropertyInformation]: LocationOnOutlined, + [TYPES.Answer]: undefined, + [TYPES.Result]: PlaylistAddCheck, + [TYPES.Review]: RateReviewOutlined, + [TYPES.Section]: List, + [TYPES.Send]: Send, + [TYPES.SetValue]: PlaylistAdd, + [TYPES.Question]: CallSplit, + [TYPES.TaskList]: List, + [TYPES.TextInput]: Create, +} as const; diff --git a/editor.planx.uk/src/@planx/components/sharedTypes.tsx b/editor.planx.uk/src/@planx/components/sharedTypes.tsx new file mode 100644 index 0000000000..475a8a2e59 --- /dev/null +++ b/editor.planx.uk/src/@planx/components/sharedTypes.tsx @@ -0,0 +1,21 @@ +import { Store } from "pages/FlowEditor/lib/store"; +import type { HandleSubmit } from "pages/Preview/Node"; +import React from "react"; + +export interface EditorProps { + id?: string; + handleSubmit?: (data: { type: Type; data: Data }) => void; + node?: any; +} + +export type PublicProps = Data & { + id?: string; + handleSubmit?: HandleSubmit; + resetButton?: boolean; + resetPreview?: () => void; + autoFocus?: boolean; + previouslySubmittedData?: Store.UserData; +}; + +export const FormError: React.FC<{ message: string }> = ({ message }) => + message ? {message} : null; diff --git a/editor.planx.uk/src/@planx/components/ui.tsx b/editor.planx.uk/src/@planx/components/ui.tsx deleted file mode 100644 index 7018d6ed96..0000000000 --- a/editor.planx.uk/src/@planx/components/ui.tsx +++ /dev/null @@ -1,190 +0,0 @@ -import ArrowForwardIcon from "@mui/icons-material/ArrowForward"; -import Article from "@mui/icons-material/Article"; -import BorderColorIcon from "@mui/icons-material/BorderColor"; -import CallSplit from "@mui/icons-material/CallSplit"; -import CheckBoxOutlined from "@mui/icons-material/CheckBoxOutlined"; -import CloudUpload from "@mui/icons-material/CloudUpload"; -import ContactPage from "@mui/icons-material/ContactPage"; -import CopyAll from "@mui/icons-material/CopyAll"; -import Create from "@mui/icons-material/Create"; -import DoorFrontOutlined from "@mui/icons-material/DoorFrontOutlined"; -import Event from "@mui/icons-material/Event"; -import FilterAltOutlined from "@mui/icons-material/FilterAltOutlined"; -import FunctionsIcon from "@mui/icons-material/Functions"; -import Home from "@mui/icons-material/Home"; -import InfoOutlined from "@mui/icons-material/InfoOutlined"; -import List from "@mui/icons-material/List"; -import ListAlt from "@mui/icons-material/ListAlt"; -import LocationOnOutlined from "@mui/icons-material/LocationOnOutlined"; -import Map from "@mui/icons-material/Map"; -import PaymentOutlined from "@mui/icons-material/PaymentOutlined"; -import Pin from "@mui/icons-material/Pin"; -import PlaylistAdd from "@mui/icons-material/PlaylistAdd"; -import PlaylistAddCheck from "@mui/icons-material/PlaylistAddCheck"; -import RateReviewOutlined from "@mui/icons-material/RateReviewOutlined"; -import ReportProblemOutlined from "@mui/icons-material/ReportProblemOutlined"; -import SearchOutlined from "@mui/icons-material/SearchOutlined"; -import Send from "@mui/icons-material/Send"; -import ShapeLine from "@mui/icons-material/ShapeLine"; -import SquareFoot from "@mui/icons-material/SquareFoot"; -import TextFields from "@mui/icons-material/TextFields"; -import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { Store } from "pages/FlowEditor/lib/store"; -import type { HandleSubmit } from "pages/Preview/Node"; -import React, { ChangeEvent } from "react"; -import ImgInput from "ui/editor/ImgInput/ImgInput"; -import InputGroup from "ui/editor/InputGroup"; -import InputLabel from "ui/editor/InputLabel"; -import ModalSection from "ui/editor/ModalSection"; -import ModalSectionContent from "ui/editor/ModalSectionContent"; -import RichTextInput from "ui/editor/RichTextInput/RichTextInput"; -import Input from "ui/shared/Input/Input"; -import InputRow from "ui/shared/InputRow"; - -export interface EditorProps { - id?: string; - handleSubmit?: (data: { type: Type; data: Data }) => void; - node?: any; -} - -export type PublicProps = Data & { - id?: string; - handleSubmit?: HandleSubmit; - resetButton?: boolean; - resetPreview?: () => void; - autoFocus?: boolean; - previouslySubmittedData?: Store.UserData; -}; - -// XXX: We define the Icon type in terms of one of the Icons so as not to have to repeat ourselves -type Icon = typeof CheckBoxOutlined; - -export const ICONS: { - [key in TYPES]: Icon | undefined; -} = { - [TYPES.AddressInput]: Home, - [TYPES.Calculate]: FunctionsIcon, - [TYPES.Checklist]: CheckBoxOutlined, - [TYPES.ContactInput]: ContactPage, - [TYPES.Content]: TextFields, - [TYPES.Confirmation]: TextFields, - [TYPES.DateInput]: Event, - [TYPES.DrawBoundary]: SquareFoot, - [TYPES.ExternalPortal]: CopyAll, - [TYPES.FileUpload]: CloudUpload, - [TYPES.FileUploadAndLabel]: CloudUpload, - [TYPES.Filter]: FilterAltOutlined, - [TYPES.FindProperty]: SearchOutlined, - [TYPES.Flow]: undefined, - [TYPES.InternalPortal]: DoorFrontOutlined, - [TYPES.List]: ListAlt, - [TYPES.MapAndLabel]: ShapeLine, - [TYPES.Notice]: ReportProblemOutlined, - [TYPES.NextSteps]: ArrowForwardIcon, - [TYPES.NumberInput]: Pin, - [TYPES.Page]: Article, - [TYPES.Pay]: PaymentOutlined, - [TYPES.PlanningConstraints]: Map, - [TYPES.PropertyInformation]: LocationOnOutlined, - [TYPES.Answer]: undefined, - [TYPES.Result]: PlaylistAddCheck, - [TYPES.Review]: RateReviewOutlined, - [TYPES.Section]: List, - [TYPES.Send]: Send, - [TYPES.SetValue]: PlaylistAdd, - [TYPES.Question]: CallSplit, - [TYPES.TaskList]: List, - [TYPES.TextInput]: Create, -} as const; - -interface MoreInformationProps { - changeField: (changes: any) => any; - howMeasured?: string; - policyRef?: string; - info?: string; - definitionImg?: string; -} - -export const MoreInformation = ({ - changeField, - definitionImg, - howMeasured, - policyRef, - info, -}: MoreInformationProps) => { - return ( - - - - - - - - - - - - - { - changeField({ - target: { name: "definitionImg", value: newUrl }, - }); - }} - /> - - - - - - ); -}; - -export interface InternalNotesProps { - name?: string; - value?: string; - onChange: (ev: ChangeEvent) => void; -} - -export const InternalNotes: React.FC = ({ - name, - value, - onChange, -}) => { - return ( - - - - - - - - ); -}; - -export const FormError: React.FC<{ message: string }> = ({ message }) => - message ? {message} : null; diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Checklist.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Checklist.tsx index f818d7210d..b56db2325c 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Checklist.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Checklist.tsx @@ -3,7 +3,7 @@ import { ComponentType as TYPES, NodeTags, } from "@opensystemslab/planx-core/types"; -import { ICONS } from "@planx/components/ui"; +import { ICONS } from "@planx/components/shared/icons"; import classNames from "classnames"; import mapAccum from "ramda/src/mapAccum"; import React, { useMemo } from "react"; @@ -94,11 +94,13 @@ const Checklist: React.FC = React.memo((props) => { onContextMenu={handleContext} ref={drag} > - + {props.data?.img && ( Date: Mon, 28 Oct 2024 17:21:17 +0000 Subject: [PATCH 2/8] Fix import issue --- editor.planx.uk/src/@planx/components/Notice/Editor.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/Notice/Editor.tsx b/editor.planx.uk/src/@planx/components/Notice/Editor.tsx index 51c1239972..1efc79afe0 100644 --- a/editor.planx.uk/src/@planx/components/Notice/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Notice/Editor.tsx @@ -3,11 +3,6 @@ import Switch from "@mui/material/Switch"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import type { Notice } from "@planx/components/Notice/model"; import { parseNotice } from "@planx/components/Notice/model"; -import { - ICONS, - InternalNotes, - MoreInformation, -} from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React from "react"; import ColorPicker from "ui/editor/ColorPicker/ColorPicker"; @@ -18,6 +13,10 @@ import RichTextInput from "ui/editor/RichTextInput/RichTextInput"; import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; +import { InternalNotes } from "../InternalNotes"; +import { MoreInformation } from "../MoreInformation/MoreInformation"; +import { ICONS } from "../shared/icons"; + export interface Props { id?: string; handleSubmit?: (data: { type: TYPES.Notice; data: Notice }) => void; From ab569db6067e5f7ef6610a5fd831e02bfe64372d Mon Sep 17 00:00:00 2001 From: Jo Humphrey <31373245+jamdelion@users.noreply.github.com> Date: Mon, 28 Oct 2024 18:01:52 +0000 Subject: [PATCH 3/8] Fix remaining imports --- .../src/@planx/components/DateInput/Editor.tsx | 2 ++ .../src/@planx/components/ExternalPortal/Editor.tsx | 2 +- .../src/@planx/components/Filter/Editor.tsx | 2 +- editor.planx.uk/src/@planx/components/Pay/Editor.tsx | 11 +++++------ .../@planx/components/PlanningConstraints/Editor.tsx | 1 + .../@planx/components/PropertyInformation/Editor.tsx | 1 + .../src/@planx/components/Question/Editor.tsx | 4 +++- .../src/@planx/components/TaskList/Editor.tsx | 2 ++ editor.planx.uk/src/ui/editor/ModalFooter.tsx | 3 ++- 9 files changed, 18 insertions(+), 10 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/DateInput/Editor.tsx b/editor.planx.uk/src/@planx/components/DateInput/Editor.tsx index 9240e09113..fa4b5d0644 100644 --- a/editor.planx.uk/src/@planx/components/DateInput/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/DateInput/Editor.tsx @@ -17,6 +17,8 @@ import DateInputUi from "ui/shared/DateInput/DateInput"; import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; +import { ICONS } from "../shared/icons"; + export type Props = EditorProps; const DateInputComponent: React.FC = (props) => { diff --git a/editor.planx.uk/src/@planx/components/ExternalPortal/Editor.tsx b/editor.planx.uk/src/@planx/components/ExternalPortal/Editor.tsx index 5350889a30..99735c9aaf 100644 --- a/editor.planx.uk/src/@planx/components/ExternalPortal/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/ExternalPortal/Editor.tsx @@ -4,7 +4,7 @@ import React from "react"; import ModalSection from "ui/editor/ModalSection"; import ModalSectionContent from "ui/editor/ModalSectionContent"; -import { ICONS } from "../sharedTypes"; +import { ICONS } from "../shared/icons"; interface Flow { id: string; diff --git a/editor.planx.uk/src/@planx/components/Filter/Editor.tsx b/editor.planx.uk/src/@planx/components/Filter/Editor.tsx index b301d25d28..8689271099 100644 --- a/editor.planx.uk/src/@planx/components/Filter/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Filter/Editor.tsx @@ -9,7 +9,7 @@ import React from "react"; import ModalSection from "ui/editor/ModalSection"; import ModalSectionContent from "ui/editor/ModalSectionContent"; -import { ICONS } from "../sharedTypes"; +import { ICONS } from "../shared/icons"; export interface Props { id?: string; diff --git a/editor.planx.uk/src/@planx/components/Pay/Editor.tsx b/editor.planx.uk/src/@planx/components/Pay/Editor.tsx index 854750f869..b8291ce60d 100644 --- a/editor.planx.uk/src/@planx/components/Pay/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Pay/Editor.tsx @@ -14,12 +14,7 @@ import { validationSchema, } from "@planx/components/Pay/model"; import { parseBaseNodeData } from "@planx/components/shared"; -import { - EditorProps, - ICONS, - InternalNotes, - MoreInformation, -} from "@planx/components/sharedTypes"; +import { EditorProps } from "@planx/components/sharedTypes"; import { Form, Formik, useFormikContext } from "formik"; import { useStore } from "pages/FlowEditor/lib/store"; import React from "react"; @@ -34,6 +29,10 @@ import ErrorWrapper from "ui/shared/ErrorWrapper"; import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; +import { InternalNotes } from "../InternalNotes"; +import { MoreInformation } from "../MoreInformation/MoreInformation"; +import { ICONS } from "../shared/icons"; + type FormikGovPayMetadata = | Record[] | string diff --git a/editor.planx.uk/src/@planx/components/PlanningConstraints/Editor.tsx b/editor.planx.uk/src/@planx/components/PlanningConstraints/Editor.tsx index 92ce460f2c..074d4809a8 100644 --- a/editor.planx.uk/src/@planx/components/PlanningConstraints/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/PlanningConstraints/Editor.tsx @@ -20,6 +20,7 @@ import RichTextInput from "ui/editor/RichTextInput/RichTextInput"; import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; +import { ICONS } from "../shared/icons"; import { availableDatasets, parseContent, PlanningConstraints } from "./model"; type Props = EditorProps; diff --git a/editor.planx.uk/src/@planx/components/PropertyInformation/Editor.tsx b/editor.planx.uk/src/@planx/components/PropertyInformation/Editor.tsx index 47af1278a5..9e7c2d1065 100644 --- a/editor.planx.uk/src/@planx/components/PropertyInformation/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/PropertyInformation/Editor.tsx @@ -11,6 +11,7 @@ import RichTextInput from "ui/editor/RichTextInput/RichTextInput"; import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; +import { ICONS } from "../shared/icons"; import { parseContent, PropertyInformation } from "./model"; type Props = EditorProps; diff --git a/editor.planx.uk/src/@planx/components/Question/Editor.tsx b/editor.planx.uk/src/@planx/components/Question/Editor.tsx index c9d903d2a7..19a56a33d2 100644 --- a/editor.planx.uk/src/@planx/components/Question/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Question/Editor.tsx @@ -12,9 +12,11 @@ import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; import InputRowItem from "ui/shared/InputRowItem"; +import { InternalNotes } from "../InternalNotes"; +import { MoreInformation } from "../MoreInformation/MoreInformation"; import { BaseNodeData, Option, parseBaseNodeData } from "../shared"; +import { ICONS } from "../shared/icons"; import PermissionSelect from "../shared/PermissionSelect"; -import { ICONS, InternalNotes, MoreInformation } from "../sharedTypes"; interface Props { node: { diff --git a/editor.planx.uk/src/@planx/components/TaskList/Editor.tsx b/editor.planx.uk/src/@planx/components/TaskList/Editor.tsx index 0108a3c282..fc2d432223 100644 --- a/editor.planx.uk/src/@planx/components/TaskList/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/TaskList/Editor.tsx @@ -15,6 +15,8 @@ import RichTextInput from "ui/editor/RichTextInput/RichTextInput"; import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; +import { ICONS } from "../shared/icons"; + export type Props = EditorProps; const newTask = (): Task => ({ diff --git a/editor.planx.uk/src/ui/editor/ModalFooter.tsx b/editor.planx.uk/src/ui/editor/ModalFooter.tsx index ecc4af0b65..2d5a66e190 100644 --- a/editor.planx.uk/src/ui/editor/ModalFooter.tsx +++ b/editor.planx.uk/src/ui/editor/ModalFooter.tsx @@ -1,5 +1,6 @@ +import { InternalNotes } from "@planx/components/InternalNotes"; +import { MoreInformation } from "@planx/components/MoreInformation/MoreInformation"; import { BaseNodeData } from "@planx/components/shared"; -import { InternalNotes, MoreInformation } from "@planx/components/sharedTypes"; import { useFormik } from "formik"; import React from "react"; From 6351d973a5c8df41aff601e5e38667b7475b675a Mon Sep 17 00:00:00 2001 From: Jo Humphrey <31373245+jamdelion@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:25:59 +0000 Subject: [PATCH 4/8] Make file name changes as suggested --- .../@planx/components/AddressInput/Editor.tsx | 2 +- .../@planx/components/AddressInput/Public.tsx | 2 +- .../@planx/components/Calculate/Editor.tsx | 2 +- .../@planx/components/Calculate/Public.tsx | 2 +- .../@planx/components/Checklist/Public.tsx | 2 +- .../@planx/components/Confirmation/Editor.tsx | 2 +- .../@planx/components/Confirmation/Public.tsx | 2 +- .../@planx/components/ContactInput/Editor.tsx | 2 +- .../@planx/components/ContactInput/Public.tsx | 2 +- .../src/@planx/components/Content/Editor.tsx | 2 +- .../src/@planx/components/Content/Public.tsx | 2 +- .../@planx/components/DateInput/Editor.tsx | 2 +- .../@planx/components/DateInput/Public.tsx | 2 +- .../@planx/components/DrawBoundary/Editor.tsx | 2 +- .../components/DrawBoundary/Public/index.tsx | 2 +- .../components/Feedback/Editor/Editor.tsx | 44 +++++++++++++++++++ .../src/@planx/components/Feedback/Public.tsx | 2 +- .../components/FileUploadAndLabel/Editor.tsx | 2 +- .../components/FileUploadAndLabel/Public.tsx | 2 +- .../@planx/components/FindProperty/Editor.tsx | 2 +- .../components/FindProperty/Public/index.tsx | 2 +- .../components/InternalPortal/Editor.tsx | 2 +- .../src/@planx/components/List/Editor.tsx | 2 +- .../@planx/components/List/Public/Context.tsx | 2 +- .../@planx/components/List/Public/index.tsx | 2 +- .../@planx/components/MapAndLabel/Editor.tsx | 2 +- .../components/MapAndLabel/Public/index.tsx | 2 +- .../@planx/components/NextSteps/Editor.tsx | 2 +- .../@planx/components/NextSteps/Public.tsx | 2 +- .../src/@planx/components/Notice/Editor.tsx | 4 +- .../src/@planx/components/Notice/Public.tsx | 2 +- .../@planx/components/NumberInput/Editor.tsx | 2 +- .../@planx/components/NumberInput/Public.tsx | 2 +- .../src/@planx/components/Page/Editor.tsx | 2 +- .../src/@planx/components/Page/Public.tsx | 2 +- .../src/@planx/components/Pay/Public/Pay.tsx | 2 +- .../components/PlanningConstraints/Editor.tsx | 2 +- .../components/PlanningConstraints/Public.tsx | 2 +- .../components/PropertyInformation/Editor.tsx | 2 +- .../components/PropertyInformation/Public.tsx | 2 +- .../src/@planx/components/Question/Editor.tsx | 4 +- .../src/@planx/components/Result/Editor.tsx | 2 +- .../@planx/components/Result/Public/index.tsx | 2 +- .../src/@planx/components/Review/Editor.tsx | 2 +- .../@planx/components/Review/Public/index.tsx | 2 +- .../src/@planx/components/Section/Editor.tsx | 2 +- .../src/@planx/components/Section/Public.tsx | 2 +- .../src/@planx/components/Send/Editor.tsx | 2 +- .../src/@planx/components/Send/Public.tsx | 2 +- .../src/@planx/components/SetValue/Editor.tsx | 2 +- .../src/@planx/components/SetValue/Public.tsx | 2 +- .../src/@planx/components/TaskList/Editor.tsx | 2 +- .../src/@planx/components/TaskList/Public.tsx | 2 +- .../@planx/components/TextInput/Editor.tsx | 2 +- .../@planx/components/TextInput/Public.tsx | 2 +- .../@planx/components/fixtures/Wrapper.tsx | 2 +- .../{sharedTypes.tsx => shared/types.tsx} | 0 .../editor}/InternalNotes.tsx | 0 editor.planx.uk/src/ui/editor/ModalFooter.tsx | 4 +- .../MoreInformation/MoreInformation.tsx | 0 .../editor}/MoreInformation/types.ts | 0 61 files changed, 103 insertions(+), 59 deletions(-) create mode 100644 editor.planx.uk/src/@planx/components/Feedback/Editor/Editor.tsx rename editor.planx.uk/src/@planx/components/{sharedTypes.tsx => shared/types.tsx} (100%) rename editor.planx.uk/src/{@planx/components => ui/editor}/InternalNotes.tsx (100%) rename editor.planx.uk/src/{@planx/components => ui/editor}/MoreInformation/MoreInformation.tsx (100%) rename editor.planx.uk/src/{@planx/components => ui/editor}/MoreInformation/types.ts (100%) diff --git a/editor.planx.uk/src/@planx/components/AddressInput/Editor.tsx b/editor.planx.uk/src/@planx/components/AddressInput/Editor.tsx index 13b948b9d3..35a9a643a1 100644 --- a/editor.planx.uk/src/@planx/components/AddressInput/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/AddressInput/Editor.tsx @@ -1,5 +1,5 @@ import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { EditorProps } from "@planx/components/sharedTypes"; +import { EditorProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; import React from "react"; import { ModalFooter } from "ui/editor/ModalFooter"; diff --git a/editor.planx.uk/src/@planx/components/AddressInput/Public.tsx b/editor.planx.uk/src/@planx/components/AddressInput/Public.tsx index 71c1822535..3ae055715f 100644 --- a/editor.planx.uk/src/@planx/components/AddressInput/Public.tsx +++ b/editor.planx.uk/src/@planx/components/AddressInput/Public.tsx @@ -1,6 +1,6 @@ import Card from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; -import type { PublicProps } from "@planx/components/sharedTypes"; +import type { PublicProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; import React from "react"; import InputLabel from "ui/public/InputLabel"; diff --git a/editor.planx.uk/src/@planx/components/Calculate/Editor.tsx b/editor.planx.uk/src/@planx/components/Calculate/Editor.tsx index 21de1d01a9..3cb8da3c9a 100644 --- a/editor.planx.uk/src/@planx/components/Calculate/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Calculate/Editor.tsx @@ -3,7 +3,7 @@ import { styled } from "@mui/material/styles"; import Switch from "@mui/material/Switch"; import Typography from "@mui/material/Typography"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { EditorProps } from "@planx/components/sharedTypes"; +import { EditorProps } from "@planx/components/shared/types"; import { FormikErrors, useFormik } from "formik"; import React from "react"; import InputGroup from "ui/editor/InputGroup"; diff --git a/editor.planx.uk/src/@planx/components/Calculate/Public.tsx b/editor.planx.uk/src/@planx/components/Calculate/Public.tsx index 21a7396187..93d4766298 100644 --- a/editor.planx.uk/src/@planx/components/Calculate/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Calculate/Public.tsx @@ -1,5 +1,5 @@ +import type { PublicProps } from "@planx/components/shared/types"; import { makeData } from "@planx/components/shared/utils"; -import type { PublicProps } from "@planx/components/sharedTypes"; import { useStore } from "pages/FlowEditor/lib/store"; import { useEffect } from "react"; diff --git a/editor.planx.uk/src/@planx/components/Checklist/Public.tsx b/editor.planx.uk/src/@planx/components/Checklist/Public.tsx index 866e380d35..ebd1e99a27 100644 --- a/editor.planx.uk/src/@planx/components/Checklist/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Checklist/Public.tsx @@ -21,7 +21,7 @@ import ErrorWrapper from "ui/shared/ErrorWrapper"; import { object } from "yup"; import { Option } from "../shared"; -import type { PublicProps } from "../sharedTypes"; +import type { PublicProps } from "../shared/types"; export type Props = PublicProps; diff --git a/editor.planx.uk/src/@planx/components/Confirmation/Editor.tsx b/editor.planx.uk/src/@planx/components/Confirmation/Editor.tsx index b4a3da492b..2e64a68f6f 100644 --- a/editor.planx.uk/src/@planx/components/Confirmation/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Confirmation/Editor.tsx @@ -1,6 +1,6 @@ import Box from "@mui/material/Box"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { EditorProps } from "@planx/components/sharedTypes"; +import { EditorProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; import React, { ChangeEvent } from "react"; import ListManager, { diff --git a/editor.planx.uk/src/@planx/components/Confirmation/Public.tsx b/editor.planx.uk/src/@planx/components/Confirmation/Public.tsx index 59bf8fc0d8..f6cd94fd2c 100644 --- a/editor.planx.uk/src/@planx/components/Confirmation/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Confirmation/Public.tsx @@ -4,7 +4,7 @@ import Typography from "@mui/material/Typography"; import { QuestionAndResponses } from "@opensystemslab/planx-core/types"; import Card from "@planx/components/shared/Preview/Card"; import { SummaryListTable } from "@planx/components/shared/Preview/SummaryList"; -import { PublicProps } from "@planx/components/sharedTypes"; +import { PublicProps } from "@planx/components/shared/types"; import { objectWithoutNullishValues } from "lib/objectHelpers"; import { Store, useStore } from "pages/FlowEditor/lib/store"; import React, { useEffect, useState } from "react"; diff --git a/editor.planx.uk/src/@planx/components/ContactInput/Editor.tsx b/editor.planx.uk/src/@planx/components/ContactInput/Editor.tsx index 6f10caef5f..c8bb017dcb 100644 --- a/editor.planx.uk/src/@planx/components/ContactInput/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/ContactInput/Editor.tsx @@ -1,5 +1,5 @@ import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { EditorProps } from "@planx/components/sharedTypes"; +import { EditorProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; import React from "react"; import { ModalFooter } from "ui/editor/ModalFooter"; diff --git a/editor.planx.uk/src/@planx/components/ContactInput/Public.tsx b/editor.planx.uk/src/@planx/components/ContactInput/Public.tsx index 96f0e2500b..5dd8ad58c4 100644 --- a/editor.planx.uk/src/@planx/components/ContactInput/Public.tsx +++ b/editor.planx.uk/src/@planx/components/ContactInput/Public.tsx @@ -1,6 +1,6 @@ import Card from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; -import type { PublicProps } from "@planx/components/sharedTypes"; +import type { PublicProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; import React from "react"; import InputLabel from "ui/public/InputLabel"; diff --git a/editor.planx.uk/src/@planx/components/Content/Editor.tsx b/editor.planx.uk/src/@planx/components/Content/Editor.tsx index 1a6db072ad..fa973ddffe 100644 --- a/editor.planx.uk/src/@planx/components/Content/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Content/Editor.tsx @@ -1,7 +1,7 @@ import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import type { Content } from "@planx/components/Content/model"; import { parseContent } from "@planx/components/Content/model"; -import { EditorProps } from "@planx/components/sharedTypes"; +import { EditorProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; import React from "react"; import ColorPicker from "ui/editor/ColorPicker/ColorPicker"; diff --git a/editor.planx.uk/src/@planx/components/Content/Public.tsx b/editor.planx.uk/src/@planx/components/Content/Public.tsx index 6cdc8e5c5d..ec0d61c092 100644 --- a/editor.planx.uk/src/@planx/components/Content/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Content/Public.tsx @@ -5,7 +5,7 @@ import { styled } from "@mui/material/styles"; import Typography from "@mui/material/Typography"; import type { Content } from "@planx/components/Content/model"; import Card from "@planx/components/shared/Preview/Card"; -import { PublicProps } from "@planx/components/sharedTypes"; +import { PublicProps } from "@planx/components/shared/types"; import { useAnalyticsTracking } from "pages/FlowEditor/lib/analytics/provider"; import React from "react"; import { getContrastTextColor } from "styleUtils"; diff --git a/editor.planx.uk/src/@planx/components/DateInput/Editor.tsx b/editor.planx.uk/src/@planx/components/DateInput/Editor.tsx index fa4b5d0644..b1e9bde74a 100644 --- a/editor.planx.uk/src/@planx/components/DateInput/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/DateInput/Editor.tsx @@ -6,7 +6,7 @@ import { paddedDate, parseDateInput, } from "@planx/components/DateInput/model"; -import { EditorProps } from "@planx/components/sharedTypes"; +import { EditorProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; import React from "react"; import { ModalFooter } from "ui/editor/ModalFooter"; diff --git a/editor.planx.uk/src/@planx/components/DateInput/Public.tsx b/editor.planx.uk/src/@planx/components/DateInput/Public.tsx index 5e92852d80..14c492d15a 100644 --- a/editor.planx.uk/src/@planx/components/DateInput/Public.tsx +++ b/editor.planx.uk/src/@planx/components/DateInput/Public.tsx @@ -7,7 +7,7 @@ import { } from "@planx/components/DateInput/model"; import Card from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; -import { PublicProps } from "@planx/components/sharedTypes"; +import { PublicProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; import React from "react"; import DateInputComponent from "ui/shared/DateInput/DateInput"; diff --git a/editor.planx.uk/src/@planx/components/DrawBoundary/Editor.tsx b/editor.planx.uk/src/@planx/components/DrawBoundary/Editor.tsx index fbb813da4e..01bbfb47f0 100644 --- a/editor.planx.uk/src/@planx/components/DrawBoundary/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/DrawBoundary/Editor.tsx @@ -1,7 +1,7 @@ import FormControlLabel from "@mui/material/FormControlLabel"; import Switch from "@mui/material/Switch"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { EditorProps } from "@planx/components/sharedTypes"; +import { EditorProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; import React from "react"; import InputGroup from "ui/editor/InputGroup"; diff --git a/editor.planx.uk/src/@planx/components/DrawBoundary/Public/index.tsx b/editor.planx.uk/src/@planx/components/DrawBoundary/Public/index.tsx index a6bb873114..8c533ae74b 100644 --- a/editor.planx.uk/src/@planx/components/DrawBoundary/Public/index.tsx +++ b/editor.planx.uk/src/@planx/components/DrawBoundary/Public/index.tsx @@ -11,8 +11,8 @@ import { MapFooter, } from "@planx/components/shared/Preview/MapContainer"; import { PrivateFileUpload } from "@planx/components/shared/PrivateFileUpload/PrivateFileUpload"; +import type { PublicProps } from "@planx/components/shared/types"; import { squareMetresToHectares } from "@planx/components/shared/utils"; -import type { PublicProps } from "@planx/components/sharedTypes"; import buffer from "@turf/buffer"; import { point } from "@turf/helpers"; import { Feature } from "geojson"; diff --git a/editor.planx.uk/src/@planx/components/Feedback/Editor/Editor.tsx b/editor.planx.uk/src/@planx/components/Feedback/Editor/Editor.tsx new file mode 100644 index 0000000000..d496d89a0b --- /dev/null +++ b/editor.planx.uk/src/@planx/components/Feedback/Editor/Editor.tsx @@ -0,0 +1,44 @@ +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; +import { ICONS } from "@planx/components/shared/icons"; +import { useFormik } from "formik"; +import React from "react"; +import ModalSection from "ui/editor/ModalSection"; +import ModalSectionContent from "ui/editor/ModalSectionContent"; +import Input from "ui/shared/Input/Input"; +import InputRow from "ui/shared/InputRow"; + +import { EditorProps } from "../../shared/types"; +import { Feedback, parseFeedback } from "../model"; + +type Props = EditorProps; + +export const FeedbackEditor = (props: Props) => { + const formik = useFormik({ + initialValues: parseFeedback(props.node?.data), + onSubmit: (newValues) => { + props.handleSubmit?.({ + type: TYPES.Feedback, + data: newValues, + }); + }, + }); + + return ( + + ); +}; diff --git a/editor.planx.uk/src/@planx/components/Feedback/Public.tsx b/editor.planx.uk/src/@planx/components/Feedback/Public.tsx index 4a8fbc4523..e547afcaf0 100644 --- a/editor.planx.uk/src/@planx/components/Feedback/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Feedback/Public.tsx @@ -4,7 +4,7 @@ import Link from "@mui/material/Link"; import Typography from "@mui/material/Typography"; import Card from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; -import type { PublicProps } from "@planx/components/sharedTypes"; +import type { PublicProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; import React from "react"; import RichTextInput from "ui/editor/RichTextInput/RichTextInput"; diff --git a/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Editor.tsx b/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Editor.tsx index c485cd6e28..b769d7a563 100644 --- a/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Editor.tsx @@ -7,7 +7,7 @@ import { styled } from "@mui/material/styles"; import Switch from "@mui/material/Switch"; import Typography from "@mui/material/Typography"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { EditorProps } from "@planx/components/sharedTypes"; +import { EditorProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; import { lowerCase, merge, upperFirst } from "lodash"; import React from "react"; diff --git a/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Public.tsx b/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Public.tsx index 466c664f95..c1708cd6e0 100644 --- a/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Public.tsx +++ b/editor.planx.uk/src/@planx/components/FileUploadAndLabel/Public.tsx @@ -6,7 +6,7 @@ import ListItem from "@mui/material/ListItem"; import ListSubheader from "@mui/material/ListSubheader"; import { styled } from "@mui/material/styles"; import Typography from "@mui/material/Typography"; -import { PublicProps } from "@planx/components/sharedTypes"; +import { PublicProps } from "@planx/components/shared/types"; import { PrintButton } from "components/PrintButton"; import capitalize from "lodash/capitalize"; import { useAnalyticsTracking } from "pages/FlowEditor/lib/analytics/provider"; diff --git a/editor.planx.uk/src/@planx/components/FindProperty/Editor.tsx b/editor.planx.uk/src/@planx/components/FindProperty/Editor.tsx index ecfecfc637..2cfee8fd4e 100644 --- a/editor.planx.uk/src/@planx/components/FindProperty/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/FindProperty/Editor.tsx @@ -1,7 +1,7 @@ import FormControlLabel from "@mui/material/FormControlLabel"; import Switch from "@mui/material/Switch"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { EditorProps } from "@planx/components/sharedTypes"; +import { EditorProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; import React from "react"; import InputGroup from "ui/editor/InputGroup"; diff --git a/editor.planx.uk/src/@planx/components/FindProperty/Public/index.tsx b/editor.planx.uk/src/@planx/components/FindProperty/Public/index.tsx index 98d5cdf777..c7f3093821 100644 --- a/editor.planx.uk/src/@planx/components/FindProperty/Public/index.tsx +++ b/editor.planx.uk/src/@planx/components/FindProperty/Public/index.tsx @@ -5,8 +5,8 @@ import { styled } from "@mui/material/styles"; import Typography from "@mui/material/Typography"; import Card from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; +import { PublicProps } from "@planx/components/shared/types"; import { squareMetresToHectares } from "@planx/components/shared/utils"; -import { PublicProps } from "@planx/components/sharedTypes"; import area from "@turf/area"; import DelayedLoadingIndicator from "components/DelayedLoadingIndicator/DelayedLoadingIndicator"; import { Feature } from "geojson"; diff --git a/editor.planx.uk/src/@planx/components/InternalPortal/Editor.tsx b/editor.planx.uk/src/@planx/components/InternalPortal/Editor.tsx index 5ee5f29345..01a3af5944 100644 --- a/editor.planx.uk/src/@planx/components/InternalPortal/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/InternalPortal/Editor.tsx @@ -3,7 +3,7 @@ import { useFormik } from "formik"; import React from "react"; import InputField from "ui/editor/InputField/InputField"; -import { FormError } from "../sharedTypes"; +import { FormError } from "../shared/types"; interface Flow { id: string; diff --git a/editor.planx.uk/src/@planx/components/List/Editor.tsx b/editor.planx.uk/src/@planx/components/List/Editor.tsx index 2b85e01572..72b01dc3b7 100644 --- a/editor.planx.uk/src/@planx/components/List/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/List/Editor.tsx @@ -14,7 +14,7 @@ import InputRowItem from "ui/shared/InputRowItem"; import InputRowLabel from "ui/shared/InputRowLabel"; import { ICONS } from "../shared/icons"; -import { EditorProps } from "../sharedTypes"; +import { EditorProps } from "../shared/types"; import { List, parseContent, validationSchema } from "./model"; import { ProposedAdvertisements } from "./schemas/Adverts"; import { NonResidentialFloorspace } from "./schemas/Floorspace"; diff --git a/editor.planx.uk/src/@planx/components/List/Public/Context.tsx b/editor.planx.uk/src/@planx/components/List/Public/Context.tsx index cf3832d276..e6c0741555 100644 --- a/editor.planx.uk/src/@planx/components/List/Public/Context.tsx +++ b/editor.planx.uk/src/@planx/components/List/Public/Context.tsx @@ -4,11 +4,11 @@ import { SchemaUserData, SchemaUserResponse, } from "@planx/components/shared/Schema/model"; +import { PublicProps } from "@planx/components/shared/types"; import { getPreviouslySubmittedData, makeData, } from "@planx/components/shared/utils"; -import { PublicProps } from "@planx/components/sharedTypes"; import { FormikProps, useFormik } from "formik"; import React, { createContext, diff --git a/editor.planx.uk/src/@planx/components/List/Public/index.tsx b/editor.planx.uk/src/@planx/components/List/Public/index.tsx index bff55b6f4e..8fe0fc4afb 100644 --- a/editor.planx.uk/src/@planx/components/List/Public/index.tsx +++ b/editor.planx.uk/src/@planx/components/List/Public/index.tsx @@ -9,7 +9,7 @@ import TableCell from "@mui/material/TableCell"; import TableRow from "@mui/material/TableRow"; import Typography from "@mui/material/Typography"; import { SchemaFields } from "@planx/components/shared/Schema/SchemaFields"; -import { PublicProps } from "@planx/components/sharedTypes"; +import { PublicProps } from "@planx/components/shared/types"; import React, { useEffect, useRef } from "react"; import { FONT_WEIGHT_SEMI_BOLD } from "theme"; import FullWidthWrapper from "ui/public/FullWidthWrapper"; diff --git a/editor.planx.uk/src/@planx/components/MapAndLabel/Editor.tsx b/editor.planx.uk/src/@planx/components/MapAndLabel/Editor.tsx index d68c3892e4..4c8643b78f 100644 --- a/editor.planx.uk/src/@planx/components/MapAndLabel/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/MapAndLabel/Editor.tsx @@ -19,7 +19,7 @@ import InputRowItem from "ui/shared/InputRowItem"; import { ICONS } from "../shared/icons"; import BasicRadio from "../shared/Radio/BasicRadio"; -import { EditorProps } from "../sharedTypes"; +import { EditorProps } from "../shared/types"; import { MapAndLabel, parseContent } from "./model"; import { Trees } from "./schemas/Trees"; diff --git a/editor.planx.uk/src/@planx/components/MapAndLabel/Public/index.tsx b/editor.planx.uk/src/@planx/components/MapAndLabel/Public/index.tsx index bd6a536f40..5ffc2d2313 100644 --- a/editor.planx.uk/src/@planx/components/MapAndLabel/Public/index.tsx +++ b/editor.planx.uk/src/@planx/components/MapAndLabel/Public/index.tsx @@ -21,7 +21,7 @@ import ErrorWrapper from "ui/shared/ErrorWrapper"; import Card from "../../shared/Preview/Card"; import { CardHeader } from "../../shared/Preview/CardHeader/CardHeader"; import { MapContainer } from "../../shared/Preview/MapContainer"; -import { PublicProps } from "../../sharedTypes"; +import { PublicProps } from "../../shared/types"; import type { MapAndLabel } from "./../model"; import { MAP_ID, MapAndLabelProvider, useMapAndLabelContext } from "./Context"; import { CopyFeature } from "./CopyFeature"; diff --git a/editor.planx.uk/src/@planx/components/NextSteps/Editor.tsx b/editor.planx.uk/src/@planx/components/NextSteps/Editor.tsx index 98d5ed0421..8ac202989c 100644 --- a/editor.planx.uk/src/@planx/components/NextSteps/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/NextSteps/Editor.tsx @@ -2,7 +2,7 @@ import Box from "@mui/material/Box"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import type { NextSteps, Step } from "@planx/components/NextSteps/model"; import { parseNextSteps } from "@planx/components/NextSteps/model"; -import { EditorProps } from "@planx/components/sharedTypes"; +import { EditorProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; import React, { ChangeEvent } from "react"; import ListManager, { diff --git a/editor.planx.uk/src/@planx/components/NextSteps/Public.tsx b/editor.planx.uk/src/@planx/components/NextSteps/Public.tsx index 4023b76fab..3ae2b0fa4d 100644 --- a/editor.planx.uk/src/@planx/components/NextSteps/Public.tsx +++ b/editor.planx.uk/src/@planx/components/NextSteps/Public.tsx @@ -1,4 +1,4 @@ -import { PublicProps } from "@planx/components/sharedTypes"; +import { PublicProps } from "@planx/components/shared/types"; import React from "react"; import NextStepsList from "ui/public/NextStepsList"; diff --git a/editor.planx.uk/src/@planx/components/Notice/Editor.tsx b/editor.planx.uk/src/@planx/components/Notice/Editor.tsx index 1efc79afe0..3988ad511a 100644 --- a/editor.planx.uk/src/@planx/components/Notice/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Notice/Editor.tsx @@ -13,8 +13,8 @@ import RichTextInput from "ui/editor/RichTextInput/RichTextInput"; import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; -import { InternalNotes } from "../InternalNotes"; -import { MoreInformation } from "../MoreInformation/MoreInformation"; +import { InternalNotes } from "../../../ui/editor/InternalNotes"; +import { MoreInformation } from "../../../ui/editor/MoreInformation/MoreInformation"; import { ICONS } from "../shared/icons"; export interface Props { diff --git a/editor.planx.uk/src/@planx/components/Notice/Public.tsx b/editor.planx.uk/src/@planx/components/Notice/Public.tsx index b6283f6aec..2f5a875314 100644 --- a/editor.planx.uk/src/@planx/components/Notice/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Notice/Public.tsx @@ -9,7 +9,7 @@ import Card, { contentFlowSpacing, } from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; -import { PublicProps } from "@planx/components/sharedTypes"; +import { PublicProps } from "@planx/components/shared/types"; import { useAnalyticsTracking } from "pages/FlowEditor/lib/analytics/provider"; import React from "react"; import { getContrastTextColor } from "styleUtils"; diff --git a/editor.planx.uk/src/@planx/components/NumberInput/Editor.tsx b/editor.planx.uk/src/@planx/components/NumberInput/Editor.tsx index e37ad007ac..7ba24d3cff 100644 --- a/editor.planx.uk/src/@planx/components/NumberInput/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/NumberInput/Editor.tsx @@ -3,7 +3,7 @@ import Switch from "@mui/material/Switch"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import type { NumberInput } from "@planx/components/NumberInput/model"; import { parseNumberInput } from "@planx/components/NumberInput/model"; -import { EditorProps } from "@planx/components/sharedTypes"; +import { EditorProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; import React from "react"; import { ModalFooter } from "ui/editor/ModalFooter"; diff --git a/editor.planx.uk/src/@planx/components/NumberInput/Public.tsx b/editor.planx.uk/src/@planx/components/NumberInput/Public.tsx index 9f8f6f4a7d..ac35e9cdef 100644 --- a/editor.planx.uk/src/@planx/components/NumberInput/Public.tsx +++ b/editor.planx.uk/src/@planx/components/NumberInput/Public.tsx @@ -1,6 +1,6 @@ import Card from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; -import { PublicProps } from "@planx/components/sharedTypes"; +import { PublicProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; import isNil from "lodash/isNil"; import React, { useEffect, useRef } from "react"; diff --git a/editor.planx.uk/src/@planx/components/Page/Editor.tsx b/editor.planx.uk/src/@planx/components/Page/Editor.tsx index 470485ccfe..282e9087da 100644 --- a/editor.planx.uk/src/@planx/components/Page/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Page/Editor.tsx @@ -13,7 +13,7 @@ import InputRowItem from "ui/shared/InputRowItem"; import InputRowLabel from "ui/shared/InputRowLabel"; import { ICONS } from "../shared/icons"; -import { EditorProps } from "../sharedTypes"; +import { EditorProps } from "../shared/types"; import { Page, parsePage } from "./model"; import { ProposedAdvertisements } from "./schema/AdvertConsent"; diff --git a/editor.planx.uk/src/@planx/components/Page/Public.tsx b/editor.planx.uk/src/@planx/components/Page/Public.tsx index 22cf4476a7..62f1f49a89 100644 --- a/editor.planx.uk/src/@planx/components/Page/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Page/Public.tsx @@ -1,4 +1,4 @@ -import { PublicProps } from "@planx/components/sharedTypes"; +import { PublicProps } from "@planx/components/shared/types"; import { FormikConfig, useFormik } from "formik"; import React from "react"; diff --git a/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx b/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx index 01f376d36b..f9f4a4398c 100644 --- a/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx +++ b/editor.planx.uk/src/@planx/components/Pay/Public/Pay.tsx @@ -3,7 +3,7 @@ import { GovUKPayment, PaymentStatus, } from "@opensystemslab/planx-core/types"; -import { PublicProps } from "@planx/components/sharedTypes"; +import { PublicProps } from "@planx/components/shared/types"; import { logger } from "airbrake"; import axios from "axios"; import DelayedLoadingIndicator from "components/DelayedLoadingIndicator/DelayedLoadingIndicator"; diff --git a/editor.planx.uk/src/@planx/components/PlanningConstraints/Editor.tsx b/editor.planx.uk/src/@planx/components/PlanningConstraints/Editor.tsx index 074d4809a8..0e084932ed 100644 --- a/editor.planx.uk/src/@planx/components/PlanningConstraints/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/PlanningConstraints/Editor.tsx @@ -8,7 +8,7 @@ import TableHead from "@mui/material/TableHead"; import TableRow from "@mui/material/TableRow"; import Typography from "@mui/material/Typography"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { EditorProps } from "@planx/components/sharedTypes"; +import { EditorProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; import React from "react"; import { FONT_WEIGHT_BOLD } from "theme"; diff --git a/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.tsx b/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.tsx index b69d44242e..f622093b59 100644 --- a/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.tsx +++ b/editor.planx.uk/src/@planx/components/PlanningConstraints/Public.tsx @@ -4,7 +4,7 @@ import type { } from "@opensystemslab/planx-core/types"; import Card from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; -import type { PublicProps } from "@planx/components/sharedTypes"; +import type { PublicProps } from "@planx/components/shared/types"; import DelayedLoadingIndicator from "components/DelayedLoadingIndicator/DelayedLoadingIndicator"; import { GraphError } from "components/Error/GraphError"; import { useStore } from "pages/FlowEditor/lib/store"; diff --git a/editor.planx.uk/src/@planx/components/PropertyInformation/Editor.tsx b/editor.planx.uk/src/@planx/components/PropertyInformation/Editor.tsx index 9e7c2d1065..a968492ae8 100644 --- a/editor.planx.uk/src/@planx/components/PropertyInformation/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/PropertyInformation/Editor.tsx @@ -1,7 +1,7 @@ import FormControlLabel from "@mui/material/FormControlLabel"; import Switch from "@mui/material/Switch"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { EditorProps } from "@planx/components/sharedTypes"; +import { EditorProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; import React from "react"; import { ModalFooter } from "ui/editor/ModalFooter"; diff --git a/editor.planx.uk/src/@planx/components/PropertyInformation/Public.tsx b/editor.planx.uk/src/@planx/components/PropertyInformation/Public.tsx index 6f4741a942..5cc2e29352 100644 --- a/editor.planx.uk/src/@planx/components/PropertyInformation/Public.tsx +++ b/editor.planx.uk/src/@planx/components/PropertyInformation/Public.tsx @@ -5,7 +5,7 @@ import { visuallyHidden } from "@mui/utils"; import Card from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; import { SummaryListTable } from "@planx/components/shared/Preview/SummaryList"; -import type { PublicProps } from "@planx/components/sharedTypes"; +import type { PublicProps } from "@planx/components/shared/types"; import { GraphError } from "components/Error/GraphError"; import { Feature } from "geojson"; import { publicClient } from "lib/graphql"; diff --git a/editor.planx.uk/src/@planx/components/Question/Editor.tsx b/editor.planx.uk/src/@planx/components/Question/Editor.tsx index 19a56a33d2..b3dc67f196 100644 --- a/editor.planx.uk/src/@planx/components/Question/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Question/Editor.tsx @@ -12,8 +12,8 @@ import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; import InputRowItem from "ui/shared/InputRowItem"; -import { InternalNotes } from "../InternalNotes"; -import { MoreInformation } from "../MoreInformation/MoreInformation"; +import { InternalNotes } from "../../../ui/editor/InternalNotes"; +import { MoreInformation } from "../../../ui/editor/MoreInformation/MoreInformation"; import { BaseNodeData, Option, parseBaseNodeData } from "../shared"; import { ICONS } from "../shared/icons"; import PermissionSelect from "../shared/PermissionSelect"; diff --git a/editor.planx.uk/src/@planx/components/Result/Editor.tsx b/editor.planx.uk/src/@planx/components/Result/Editor.tsx index 548d5d6948..5423ac452b 100644 --- a/editor.planx.uk/src/@planx/components/Result/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Result/Editor.tsx @@ -15,7 +15,7 @@ import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; import { ICONS } from "../shared/icons"; -import { EditorProps } from "../sharedTypes"; +import { EditorProps } from "../shared/types"; import { FlagDisplayText, Result } from "./model"; type FlagWithValue = Flag & { value: NonNullable }; diff --git a/editor.planx.uk/src/@planx/components/Result/Public/index.tsx b/editor.planx.uk/src/@planx/components/Result/Public/index.tsx index 964d4eab81..ef90adedd8 100644 --- a/editor.planx.uk/src/@planx/components/Result/Public/index.tsx +++ b/editor.planx.uk/src/@planx/components/Result/Public/index.tsx @@ -6,7 +6,7 @@ import { DEFAULT_FLAG_CATEGORY } from "@opensystemslab/planx-core/types"; import Card from "@planx/components/shared/Preview/Card"; import SimpleExpand from "@planx/components/shared/Preview/SimpleExpand"; import { WarningContainer } from "@planx/components/shared/Preview/WarningContainer"; -import { PublicProps } from "@planx/components/sharedTypes"; +import { PublicProps } from "@planx/components/shared/types"; import { useStore } from "pages/FlowEditor/lib/store"; import { Response } from "pages/FlowEditor/lib/store/preview"; import React from "react"; diff --git a/editor.planx.uk/src/@planx/components/Review/Editor.tsx b/editor.planx.uk/src/@planx/components/Review/Editor.tsx index 2536a5e05e..0673d8176a 100644 --- a/editor.planx.uk/src/@planx/components/Review/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Review/Editor.tsx @@ -9,7 +9,7 @@ import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; import { ICONS } from "../shared/icons"; -import { EditorProps } from "../sharedTypes"; +import { EditorProps } from "../shared/types"; import { parseContent, Review } from "./model"; type Props = EditorProps; diff --git a/editor.planx.uk/src/@planx/components/Review/Public/index.tsx b/editor.planx.uk/src/@planx/components/Review/Public/index.tsx index 6bf742ed95..0295db3a9a 100644 --- a/editor.planx.uk/src/@planx/components/Review/Public/index.tsx +++ b/editor.planx.uk/src/@planx/components/Review/Public/index.tsx @@ -1,4 +1,4 @@ -import { PublicProps } from "@planx/components/sharedTypes"; +import { PublicProps } from "@planx/components/shared/types"; import { useStore } from "pages/FlowEditor/lib/store"; import React from "react"; diff --git a/editor.planx.uk/src/@planx/components/Section/Editor.tsx b/editor.planx.uk/src/@planx/components/Section/Editor.tsx index 995d82ba21..54d0dcb5c1 100644 --- a/editor.planx.uk/src/@planx/components/Section/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Section/Editor.tsx @@ -1,5 +1,5 @@ import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { EditorProps } from "@planx/components/sharedTypes"; +import { EditorProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; import React from "react"; import { ModalFooter } from "ui/editor/ModalFooter"; diff --git a/editor.planx.uk/src/@planx/components/Section/Public.tsx b/editor.planx.uk/src/@planx/components/Section/Public.tsx index e3c7ebd8ec..76224ea839 100644 --- a/editor.planx.uk/src/@planx/components/Section/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Section/Public.tsx @@ -4,7 +4,7 @@ import { styled } from "@mui/material/styles"; import Typography from "@mui/material/Typography"; import visuallyHidden from "@mui/utils/visuallyHidden"; import Tag, { TagType } from "@planx/components/shared/Buttons/Tag"; -import type { PublicProps } from "@planx/components/sharedTypes"; +import type { PublicProps } from "@planx/components/shared/types"; import { useAnalyticsTracking } from "pages/FlowEditor/lib/analytics/provider"; import { Store, useStore } from "pages/FlowEditor/lib/store"; import React from "react"; diff --git a/editor.planx.uk/src/@planx/components/Send/Editor.tsx b/editor.planx.uk/src/@planx/components/Send/Editor.tsx index 29c9274966..6cad4a9328 100644 --- a/editor.planx.uk/src/@planx/components/Send/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Send/Editor.tsx @@ -17,7 +17,7 @@ import InputRow from "ui/shared/InputRow"; import { array, object } from "yup"; import { ICONS } from "../shared/icons"; -import { EditorProps } from "../sharedTypes"; +import { EditorProps } from "../shared/types"; import { parseContent, Send } from "./model"; export type Props = EditorProps; diff --git a/editor.planx.uk/src/@planx/components/Send/Public.tsx b/editor.planx.uk/src/@planx/components/Send/Public.tsx index 44eb4ca304..22cf28488d 100644 --- a/editor.planx.uk/src/@planx/components/Send/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Send/Public.tsx @@ -10,7 +10,7 @@ import { AsyncState } from "react-use/lib/useAsyncFn"; import Card from "../shared/Preview/Card"; import { WarningContainer } from "../shared/Preview/WarningContainer"; -import { PublicProps } from "../sharedTypes"; +import { PublicProps } from "../shared/types"; import { DEFAULT_DESTINATION, getCombinedEventsPayload, Send } from "./model"; /** Response returned by /create-send-events endpoint */ diff --git a/editor.planx.uk/src/@planx/components/SetValue/Editor.tsx b/editor.planx.uk/src/@planx/components/SetValue/Editor.tsx index 15c9f7c3a1..6bf65d51ca 100644 --- a/editor.planx.uk/src/@planx/components/SetValue/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/SetValue/Editor.tsx @@ -3,7 +3,7 @@ import RadioGroup from "@mui/material/RadioGroup"; import Typography from "@mui/material/Typography"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import BasicRadio from "@planx/components/shared/Radio/BasicRadio"; -import { EditorProps } from "@planx/components/sharedTypes"; +import { EditorProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; import React from "react"; import { ModalFooter } from "ui/editor/ModalFooter"; diff --git a/editor.planx.uk/src/@planx/components/SetValue/Public.tsx b/editor.planx.uk/src/@planx/components/SetValue/Public.tsx index 9b1a65873d..c5484870d2 100644 --- a/editor.planx.uk/src/@planx/components/SetValue/Public.tsx +++ b/editor.planx.uk/src/@planx/components/SetValue/Public.tsx @@ -1,5 +1,5 @@ +import type { PublicProps } from "@planx/components/shared/types"; import { makeData } from "@planx/components/shared/utils"; -import type { PublicProps } from "@planx/components/sharedTypes"; import { useEffect } from "react"; import type { SetValue } from "./model"; diff --git a/editor.planx.uk/src/@planx/components/TaskList/Editor.tsx b/editor.planx.uk/src/@planx/components/TaskList/Editor.tsx index fc2d432223..b4da1112b0 100644 --- a/editor.planx.uk/src/@planx/components/TaskList/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/TaskList/Editor.tsx @@ -1,6 +1,6 @@ import Box from "@mui/material/Box"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { EditorProps } from "@planx/components/sharedTypes"; +import { EditorProps } from "@planx/components/shared/types"; import type { Task, TaskList } from "@planx/components/TaskList/model"; import { parseTaskList } from "@planx/components/TaskList/model"; import { useFormik } from "formik"; diff --git a/editor.planx.uk/src/@planx/components/TaskList/Public.tsx b/editor.planx.uk/src/@planx/components/TaskList/Public.tsx index 76fc7995c3..8dd61bc46b 100644 --- a/editor.planx.uk/src/@planx/components/TaskList/Public.tsx +++ b/editor.planx.uk/src/@planx/components/TaskList/Public.tsx @@ -1,6 +1,6 @@ import Card from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; -import { PublicProps } from "@planx/components/sharedTypes"; +import { PublicProps } from "@planx/components/shared/types"; import type { TaskList } from "@planx/components/TaskList/model"; import React from "react"; import NumberedList from "ui/public/NumberedList"; diff --git a/editor.planx.uk/src/@planx/components/TextInput/Editor.tsx b/editor.planx.uk/src/@planx/components/TextInput/Editor.tsx index 87231ddf5f..054c71f287 100644 --- a/editor.planx.uk/src/@planx/components/TextInput/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/TextInput/Editor.tsx @@ -2,7 +2,7 @@ import FormControl from "@mui/material/FormControl"; import RadioGroup from "@mui/material/RadioGroup"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import BasicRadio from "@planx/components/shared/Radio/BasicRadio"; -import { EditorProps } from "@planx/components/sharedTypes"; +import { EditorProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; import React from "react"; import { ModalFooter } from "ui/editor/ModalFooter"; diff --git a/editor.planx.uk/src/@planx/components/TextInput/Public.tsx b/editor.planx.uk/src/@planx/components/TextInput/Public.tsx index 210a2db24a..1c7e885e8d 100644 --- a/editor.planx.uk/src/@planx/components/TextInput/Public.tsx +++ b/editor.planx.uk/src/@planx/components/TextInput/Public.tsx @@ -1,6 +1,6 @@ import Card from "@planx/components/shared/Preview/Card"; import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader"; -import { PublicProps } from "@planx/components/sharedTypes"; +import { PublicProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; import React from "react"; import InputLabel from "ui/public/InputLabel"; diff --git a/editor.planx.uk/src/@planx/components/fixtures/Wrapper.tsx b/editor.planx.uk/src/@planx/components/fixtures/Wrapper.tsx index d5b73e9512..6bfd9381c3 100644 --- a/editor.planx.uk/src/@planx/components/fixtures/Wrapper.tsx +++ b/editor.planx.uk/src/@planx/components/fixtures/Wrapper.tsx @@ -1,5 +1,5 @@ import Button from "@mui/material/Button"; -import { EditorProps, PublicProps } from "@planx/components/sharedTypes"; +import { EditorProps, PublicProps } from "@planx/components/shared/types"; import React, { useState } from "react"; export default Wrapper; diff --git a/editor.planx.uk/src/@planx/components/sharedTypes.tsx b/editor.planx.uk/src/@planx/components/shared/types.tsx similarity index 100% rename from editor.planx.uk/src/@planx/components/sharedTypes.tsx rename to editor.planx.uk/src/@planx/components/shared/types.tsx diff --git a/editor.planx.uk/src/@planx/components/InternalNotes.tsx b/editor.planx.uk/src/ui/editor/InternalNotes.tsx similarity index 100% rename from editor.planx.uk/src/@planx/components/InternalNotes.tsx rename to editor.planx.uk/src/ui/editor/InternalNotes.tsx diff --git a/editor.planx.uk/src/ui/editor/ModalFooter.tsx b/editor.planx.uk/src/ui/editor/ModalFooter.tsx index 2d5a66e190..119096ac87 100644 --- a/editor.planx.uk/src/ui/editor/ModalFooter.tsx +++ b/editor.planx.uk/src/ui/editor/ModalFooter.tsx @@ -1,8 +1,8 @@ -import { InternalNotes } from "@planx/components/InternalNotes"; -import { MoreInformation } from "@planx/components/MoreInformation/MoreInformation"; import { BaseNodeData } from "@planx/components/shared"; import { useFormik } from "formik"; import React from "react"; +import { InternalNotes } from "ui/editor/InternalNotes"; +import { MoreInformation } from "ui/editor/MoreInformation/MoreInformation"; import { ComponentTagSelect } from "./ComponentTagSelect"; diff --git a/editor.planx.uk/src/@planx/components/MoreInformation/MoreInformation.tsx b/editor.planx.uk/src/ui/editor/MoreInformation/MoreInformation.tsx similarity index 100% rename from editor.planx.uk/src/@planx/components/MoreInformation/MoreInformation.tsx rename to editor.planx.uk/src/ui/editor/MoreInformation/MoreInformation.tsx diff --git a/editor.planx.uk/src/@planx/components/MoreInformation/types.ts b/editor.planx.uk/src/ui/editor/MoreInformation/types.ts similarity index 100% rename from editor.planx.uk/src/@planx/components/MoreInformation/types.ts rename to editor.planx.uk/src/ui/editor/MoreInformation/types.ts From f35a07e7c4facbfc476530d57d6a91230f2ea4ae Mon Sep 17 00:00:00 2001 From: Jo Humphrey <31373245+jamdelion@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:32:16 +0000 Subject: [PATCH 5/8] Fix issues --- .../components/Feedback/Editor/Editor.tsx | 44 ------------------- 1 file changed, 44 deletions(-) delete mode 100644 editor.planx.uk/src/@planx/components/Feedback/Editor/Editor.tsx diff --git a/editor.planx.uk/src/@planx/components/Feedback/Editor/Editor.tsx b/editor.planx.uk/src/@planx/components/Feedback/Editor/Editor.tsx deleted file mode 100644 index d496d89a0b..0000000000 --- a/editor.planx.uk/src/@planx/components/Feedback/Editor/Editor.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; -import { ICONS } from "@planx/components/shared/icons"; -import { useFormik } from "formik"; -import React from "react"; -import ModalSection from "ui/editor/ModalSection"; -import ModalSectionContent from "ui/editor/ModalSectionContent"; -import Input from "ui/shared/Input/Input"; -import InputRow from "ui/shared/InputRow"; - -import { EditorProps } from "../../shared/types"; -import { Feedback, parseFeedback } from "../model"; - -type Props = EditorProps; - -export const FeedbackEditor = (props: Props) => { - const formik = useFormik({ - initialValues: parseFeedback(props.node?.data), - onSubmit: (newValues) => { - props.handleSubmit?.({ - type: TYPES.Feedback, - data: newValues, - }); - }, - }); - - return ( - - ); -}; From 7399d687e61082957e961f7d3cd3ee6ed187edfd Mon Sep 17 00:00:00 2001 From: Jo Humphrey <31373245+jamdelion@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:37:29 +0000 Subject: [PATCH 6/8] fix lint --- editor.planx.uk/src/@planx/components/Pay/Editor.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor.planx.uk/src/@planx/components/Pay/Editor.tsx b/editor.planx.uk/src/@planx/components/Pay/Editor.tsx index b8291ce60d..c868660cb6 100644 --- a/editor.planx.uk/src/@planx/components/Pay/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Pay/Editor.tsx @@ -14,7 +14,6 @@ import { validationSchema, } from "@planx/components/Pay/model"; import { parseBaseNodeData } from "@planx/components/shared"; -import { EditorProps } from "@planx/components/sharedTypes"; import { Form, Formik, useFormikContext } from "formik"; import { useStore } from "pages/FlowEditor/lib/store"; import React from "react"; @@ -32,6 +31,7 @@ import InputRow from "ui/shared/InputRow"; import { InternalNotes } from "../InternalNotes"; import { MoreInformation } from "../MoreInformation/MoreInformation"; import { ICONS } from "../shared/icons"; +import { EditorProps } from "../shared/types"; type FormikGovPayMetadata = | Record[] From e68a635e61e8cd864305bbd5cb944d065c9e79c3 Mon Sep 17 00:00:00 2001 From: Jo Humphrey <31373245+jamdelion@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:40:40 +0000 Subject: [PATCH 7/8] Fix imports again --- editor.planx.uk/src/@planx/components/Pay/Editor.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/Pay/Editor.tsx b/editor.planx.uk/src/@planx/components/Pay/Editor.tsx index c868660cb6..2efb9c7b83 100644 --- a/editor.planx.uk/src/@planx/components/Pay/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Pay/Editor.tsx @@ -18,18 +18,18 @@ import { Form, Formik, useFormikContext } from "formik"; import { useStore } from "pages/FlowEditor/lib/store"; import React from "react"; import { ComponentTagSelect } from "ui/editor/ComponentTagSelect"; +import { InternalNotes } from "ui/editor/InternalNotes"; import ListManager, { EditorProps as ListManagerEditorProps, } from "ui/editor/ListManager/ListManager"; import ModalSection from "ui/editor/ModalSection"; import ModalSectionContent from "ui/editor/ModalSectionContent"; +import { MoreInformation } from "ui/editor/MoreInformation/MoreInformation"; import RichTextInput from "ui/editor/RichTextInput/RichTextInput"; import ErrorWrapper from "ui/shared/ErrorWrapper"; import Input from "ui/shared/Input/Input"; import InputRow from "ui/shared/InputRow"; -import { InternalNotes } from "../InternalNotes"; -import { MoreInformation } from "../MoreInformation/MoreInformation"; import { ICONS } from "../shared/icons"; import { EditorProps } from "../shared/types"; From 7cae337bb9981db586759f4e3f30582bfbfd39ab Mon Sep 17 00:00:00 2001 From: Jo Humphrey <31373245+jamdelion@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:45:36 +0000 Subject: [PATCH 8/8] Fix import --- editor.planx.uk/src/@planx/components/Filter/Public.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/Filter/Public.tsx b/editor.planx.uk/src/@planx/components/Filter/Public.tsx index b0d65628e8..44c9ee62ec 100644 --- a/editor.planx.uk/src/@planx/components/Filter/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Filter/Public.tsx @@ -1,16 +1,14 @@ -import type { PublicProps } from "@planx/components/ui"; import { useStore } from "pages/FlowEditor/lib/store"; import { useEffect } from "react"; +import { PublicProps } from "../shared/types"; import type { Props as Filter } from "./Editor"; export type Props = PublicProps; // Filters are always auto-answered and never seen by a user, but should still leave a breadcrumb export default function Component(props: Props) { - const autoAnswerableFlag = useStore( - (state) => state.autoAnswerableFlag, - ); + const autoAnswerableFlag = useStore((state) => state.autoAnswerableFlag); let idThatCanBeAutoAnswered: string | undefined; if (props.id) idThatCanBeAutoAnswered = autoAnswerableFlag(props.id);