Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: showInternalNotes in editor modals for portals #4091

Merged
merged 3 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ test("adding an external portal", async () => {
data: {
flowId: "b",
tags: [],
notes: "",
},
}),
);
Expand Down Expand Up @@ -65,6 +66,7 @@ test("changing an external portal", async () => {
data: {
flowId: "a",
tags: [],
notes: "",
},
}),
);
Expand Down
11 changes: 5 additions & 6 deletions editor.planx.uk/src/@planx/components/ExternalPortal/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from "@opensystemslab/planx-core/types";
import { useFormik } from "formik";
import React from "react";
import { ComponentTagSelect } from "ui/editor/ComponentTagSelect";
import { ModalFooter } from "ui/editor/ModalFooter";
import ModalSection from "ui/editor/ModalSection";
import ModalSectionContent from "ui/editor/ModalSectionContent";

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 Expand Up @@ -64,11 +66,8 @@ const ExternalPortalForm: React.FC<{
))}
</select>
</ModalSectionContent>
<ComponentTagSelect
value={formik.values.tags}
onChange={(value) => formik.setFieldValue("tags", value)}
/>
</ModalSection>
<ModalFooter formik={formik} showMoreInformation={false} />
</form>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ describe("adding an internal portal", () => {
flowId: "", // will be removed when saving the data
text: "new internal portal",
tags: [],
notes: "",
},
});
});
Expand Down Expand Up @@ -131,6 +132,7 @@ test("updating an internal portal", async () => {
flowId: "", // will be removed when saving the data
text: "new val",
tags: [],
notes: "",
},
});
});
Expand Down
18 changes: 12 additions & 6 deletions editor.planx.uk/src/@planx/components/InternalPortal/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from "@opensystemslab/planx-core/types";
import { useFormik } from "formik";
import React from "react";
import { ComponentTagSelect } from "ui/editor/ComponentTagSelect";
import { ModalFooter } from "ui/editor/ModalFooter";
import ModalSection from "ui/editor/ModalSection";
import ModalSectionContent from "ui/editor/ModalSectionContent";
import SelectInput from "ui/editor/SelectInput/SelectInput";
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 Expand Up @@ -101,11 +110,8 @@ const InternalPortalForm: React.FC<{
</SelectInput>
</ModalSectionContent>
)}
<ComponentTagSelect
value={formik.values.tags}
onChange={(value) => formik.setFieldValue("tags", value)}
/>
</ModalSection>
<ModalFooter formik={formik} showMoreInformation={false} />
</form>
);
};
Expand Down
Loading