diff --git a/editor.planx.uk/src/@planx/components/MapAndLabel/Public/Context.tsx b/editor.planx.uk/src/@planx/components/MapAndLabel/Public/Context.tsx index cedbfa6aa8..cf4b59dacb 100644 --- a/editor.planx.uk/src/@planx/components/MapAndLabel/Public/Context.tsx +++ b/editor.planx.uk/src/@planx/components/MapAndLabel/Public/Context.tsx @@ -34,6 +34,7 @@ interface MapAndLabelContextValue { addInitialFeaturesToMap: (features: Feature[]) => void; editFeature: (index: number) => void; copyFeature: (sourceIndex: number, destinationIndex: number) => void; + saveFeature: (index: number) => void; removeFeature: (index: number) => void; mapAndLabelProps: PresentationalProps; errors: { @@ -218,6 +219,11 @@ export const MapAndLabelProvider: React.FC = ( setActiveIndex((features && features.length - 2) || 0); }; + const saveFeature = (index: number) => { + // TODO separate schema field validation from "Continue" + formik.handleSubmit(); + }; + return ( = ( addInitialFeaturesToMap, editFeature, copyFeature, + saveFeature, removeFeature, isFeatureInvalid, errors: { 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 f55921d07f..e0a13822fe 100644 --- a/editor.planx.uk/src/@planx/components/MapAndLabel/Public/index.tsx +++ b/editor.planx.uk/src/@planx/components/MapAndLabel/Public/index.tsx @@ -64,6 +64,7 @@ const VerticalFeatureTabs: React.FC = () => { editFeature, isFeatureInvalid, removeFeature, + saveFeature, } = useMapAndLabelContext(); if (!features) { @@ -165,17 +166,23 @@ const VerticalFeatureTabs: React.FC = () => { activeIndex={activeIndex} formik={formik} /> - + + + + ))}