Skip to content

Commit

Permalink
Add explicit handling of notes to portal components
Browse files Browse the repository at this point in the history
  • Loading branch information
augustlindemer committed Dec 18, 2024
1 parent 2738947 commit 4f2ba1c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
NodeTag,
ComponentType as TYPES,
NodeTag,
} from "@opensystemslab/planx-core/types";
import { useFormik } from "formik";
import React from "react";
Expand All @@ -18,14 +18,16 @@ interface Flow {
const ExternalPortalForm: React.FC<{
id?: string;
flowId?: string;
notes?: string;
handleSubmit?: (val: any) => void;
flows?: Array<Flow>;
tags?: NodeTag[];
}> = ({ id, handleSubmit, flowId = "", flows = [], tags = [] }) => {
}> = ({ id, handleSubmit, flowId = "", flows = [], tags = [], notes = "" }) => {
const formik = useFormik({
initialValues: {
flowId,
tags,
notes,
},
onSubmit: (values) => {
if (handleSubmit) {
Expand Down
13 changes: 11 additions & 2 deletions editor.planx.uk/src/@planx/components/InternalPortal/Editor.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import MenuItem from "@mui/material/MenuItem";
import {
NodeTag,
ComponentType as TYPES,
NodeTag,
} from "@opensystemslab/planx-core/types";
import { useFormik } from "formik";
import React from "react";
Expand All @@ -24,15 +24,24 @@ const InternalPortalForm: React.FC<{
id?: string;
text?: string;
flowId?: string;
notes?: string;
handleSubmit?: (val: any) => void;
flows?: Array<Flow>;
tags?: NodeTag[];
}> = ({ handleSubmit, text = "", flowId = "", flows = [], tags = [] }) => {
}> = ({
handleSubmit,
text = "",
flowId = "",
flows = [],
tags = [],
notes = "",
}) => {
const formik = useFormik({
initialValues: {
text,
flowId,
tags,
notes,
},
validate: (values) => {
const errors: Record<string, string> = {};
Expand Down

0 comments on commit 4f2ba1c

Please sign in to comment.