diff --git a/src/pages/CellSegmentation.tsx b/src/pages/CellSegmentation.tsx index 04a0a851..2328820d 100644 --- a/src/pages/CellSegmentation.tsx +++ b/src/pages/CellSegmentation.tsx @@ -2,16 +2,17 @@ import AppShell from '../components/AppShell'; import { Form, Formik } from 'formik'; import { CommentFieldsFragment, + LabwareFieldsFragment, LabwareFlaggedFieldsFragment, SegmentationLabware, SegmentationMutation, SegmentationRequest, SlideCosting } from '../types/sdk'; -import { formatDateTimeForCore, getCurrentDateTime } from '../types/stan'; +import { createSessionStorageForLabwareAwaiting, formatDateTimeForCore, getCurrentDateTime } from '../types/stan'; import React, { useContext } from 'react'; import BlueButton from '../components/buttons/BlueButton'; -import { useLoaderData } from 'react-router-dom'; +import { useLoaderData, useNavigate } from 'react-router-dom'; import * as Yup from 'yup'; import OperationCompleteModal from '../components/modal/OperationCompleteModal'; import { StanCoreContext } from '../lib/sdk'; @@ -20,6 +21,7 @@ import { fromPromise } from 'xstate'; import { useMachine } from '@xstate/react'; import Warning from '../components/notifications/Warning'; import { Segmentation } from '../components/CellSegmentation/CellSegmentation'; +import WhiteButton from '../components/buttons/WhiteButton'; type CellSegmentationProps = { labware: LabwareFlaggedFieldsFragment; @@ -80,6 +82,7 @@ const toSegmentationRequest = (values: CellSegmentationFormProps): SegmentationR export const CellSegmentation = ({ initialFormValues = defaultFormValues }) => { const comments = useLoaderData() as CommentFieldsFragment[]; + const navigate = useNavigate(); const stanCore = useContext(StanCoreContext); const formMachine = React.useMemo(() => { return createFormMachine().provide({ @@ -114,28 +117,46 @@ export const CellSegmentation = ({ initialFormValues = defaultFormValues }) => { validateOnMount={true} > {({ isValid, values }) => ( -
- - {values.cellSegmentation.length > 0 && ( -
- - Save - -
- )} - + <> +
+ + {values.cellSegmentation.length > 0 && ( +
+ + Save + +
+ )} + + + { + createSessionStorageForLabwareAwaiting( + values.cellSegmentation.map((cellSeg) => cellSeg.labware as LabwareFieldsFragment) + ); + navigate('/store'); + }} + > + Store + + } + > +

+ If you wish to start the process again, click the "Reset Form" button. Otherwise you can return to + the Home screen. +

+
+ )} - -

- If you wish to start the process again, click the "Reset Form" button. Otherwise you can return to the - Home screen. -

-