diff --git a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/HomeAndRetry.tsx b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/HomeAndRetry.tsx new file mode 100644 index 00000000000..86840c7592c --- /dev/null +++ b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/HomeAndRetry.tsx @@ -0,0 +1,98 @@ +import { Trans, useTranslation } from 'react-i18next' +import { LegacyStyledText } from '@opentrons/components' +import { RECOVERY_MAP } from '../constants' +import { TwoColTextAndFailedStepNextStep } from '../shared' +import { RetryStep } from './RetryStep' +import { ManageTips } from './ManageTips' +import { SelectRecoveryOption } from './SelectRecoveryOption' + +import type { RecoveryContentProps } from '../types' + +const { HOME_AND_RETRY } = RECOVERY_MAP +export function HomeAndRetry(props: RecoveryContentProps): JSX.Element { + const { recoveryMap } = props + const { route, step } = recoveryMap + switch (step) { + case HOME_AND_RETRY.STEPS.PREPARE_DECK_FOR_HOME: { + return + } + case HOME_AND_RETRY.STEPS.REMOVE_TIPS_FROM_PIPETTE: { + return + } + case HOME_AND_RETRY.STEPS.HOME_BEFORE_RETRY: { + return + } + case HOME_AND_RETRY.STEPS.CONFIRM_RETRY: { + return + } + default: + console.warn( + `HomeAndRetry: ${step} in ${route} not explicitly handled. Rerouting.}` + ) + return + } +} + +export function PrepareDeckForHome(props: RecoveryContentProps): JSX.Element { + const { t } = useTranslation('error_recovery') + const { routeUpdateActions } = props + const { proceedToRouteAndStep } = routeUpdateActions + const primaryBtnOnClick = (): Promise => + proceedToRouteAndStep( + RECOVERY_MAP.HOME_AND_RETRY.ROUTE, + RECOVERY_MAP.HOME_AND_RETRY.STEPS.REMOVE_TIPS_FROM_PIPETTE + ) + const buildBodyText = (): JSX.Element => ( + }} + /> + ) + return ( + + ) +} + +export function HomeGantryBeforeRetry( + props: RecoveryContentProps +): JSX.Element { + const { t } = useTranslation('error_recovery') + const { recoveryCommands, routeUpdateActions } = props + const { homeAll } = recoveryCommands + const { handleMotionRouting, proceedToRouteAndStep } = routeUpdateActions + const { HOME_AND_RETRY } = RECOVERY_MAP + const buildBodyText = (): JSX.Element => ( + }} + /> + ) + const primaryBtnOnClick = (): Promise => + handleMotionRouting(true) + .then(() => homeAll()) + .then(() => handleMotionRouting(false)) + .then(() => + proceedToRouteAndStep( + HOME_AND_RETRY.ROUTE, + HOME_AND_RETRY.STEPS.CONFIRM_RETRY + ) + ) + + return ( + + ) +} diff --git a/app/src/organisms/ErrorRecoveryFlows/hooks/useRecoveryCommands.ts b/app/src/organisms/ErrorRecoveryFlows/hooks/useRecoveryCommands.ts index 4ce5194aca4..4961d363903 100644 --- a/app/src/organisms/ErrorRecoveryFlows/hooks/useRecoveryCommands.ts +++ b/app/src/organisms/ErrorRecoveryFlows/hooks/useRecoveryCommands.ts @@ -72,6 +72,9 @@ export interface UseRecoveryCommandsResult { homeExceptPlungers: () => Promise /* A non-terminal recovery command */ moveLabwareWithoutPause: () => Promise + + /* Home all attached axes */ + homeAll: () => Promise } // TODO(jh, 07-24-24): Create tighter abstractions for terminal vs. non-terminal commands. @@ -349,6 +352,12 @@ export const RELEASE_GRIPPER_JAW: CreateCommand = { intent: 'fixit', } +export const HOME_ALL: CreateCommand = { + commandType: 'home', + params: {}, + intent: 'fixit', +} + // in case the gripper does not know the position after a stall/collision we must update the position. export const UPDATE_ESTIMATORS_EXCEPT_PLUNGERS: CreateCommand = { commandType: 'unsafe/updatePositionEstimators',