Skip to content

Commit

Permalink
fix(app): add remove probe prompt when LPC errors (#14574)
Browse files Browse the repository at this point in the history
  • Loading branch information
smb2268 authored Feb 29, 2024
1 parent 4360083 commit be51dfc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
17 changes: 14 additions & 3 deletions app/src/organisms/LabwarePositionCheck/FatalErrorModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ const SUPPORT_EMAIL = '[email protected]'

interface FatalErrorModalProps {
errorMessage: string
shouldUseMetalProbe: boolean
onClose: () => void
}
export function FatalErrorModal(props: FatalErrorModalProps): JSX.Element {
const { errorMessage, shouldUseMetalProbe, onClose } = props
const { t } = useTranslation(['labware_position_check', 'shared'])
return (
<Portal level="top">
Expand All @@ -38,7 +40,7 @@ export function FatalErrorModal(props: FatalErrorModalProps): JSX.Element {
header={
<WizardHeader
title={t('labware_position_check_title')}
onExit={props.onClose}
onExit={onClose}
/>
}
>
Expand All @@ -58,20 +60,29 @@ export function FatalErrorModal(props: FatalErrorModalProps): JSX.Element {
<ErrorHeader>
{i18n.format(t('shared:something_went_wrong'), 'sentenceCase')}
</ErrorHeader>
{shouldUseMetalProbe ? (
<StyledText
as="p"
fontWeight={TYPOGRAPHY.fontWeightSemiBold}
textAlign={TEXT_ALIGN_CENTER}
>
{t('remove_probe_before_exit')}
</StyledText>
) : null}
<StyledText as="p" textAlign={TEXT_ALIGN_CENTER}>
{t('shared:help_us_improve_send_error_report', {
support_email: SUPPORT_EMAIL,
})}
</StyledText>
<ErrorTextArea
readOnly
value={props.errorMessage ?? ''}
value={errorMessage ?? ''}
spellCheck={false}
/>
<PrimaryButton
textTransform={TEXT_TRANSFORM_CAPITALIZE}
alignSelf={ALIGN_FLEX_END}
onClick={props.onClose}
onClick={onClose}
>
{t('shared:exit')}
</PrimaryButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ export const LabwarePositionCheckComponent = (
modalContent = (
<FatalErrorModal
errorMessage={fatalError}
shouldUseMetalProbe={shouldUseMetalProbe}
onClose={handleCleanUpAndClose}
/>
)
Expand Down
9 changes: 7 additions & 2 deletions app/src/organisms/LabwarePositionCheck/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { useLogger } from '../../logger'
import { LabwarePositionCheckComponent } from './LabwarePositionCheckComponent'
import { FatalErrorModal } from './FatalErrorModal'

import type {
import {
CompletedProtocolAnalysis,
FLEX_ROBOT_TYPE,
RobotType,
} from '@opentrons/shared-data'
import type { LabwareOffset } from '@opentrons/api-client'
Expand Down Expand Up @@ -34,6 +35,7 @@ export const LabwarePositionCheck = (
<ErrorBoundary
logger={logger}
ErrorComponent={FatalErrorModal}
shouldUseMetalProbe={props.robotType === FLEX_ROBOT_TYPE}
onClose={props.onCloseClick}
>
<LabwarePositionCheckComponent {...props} />
Expand All @@ -44,9 +46,11 @@ export const LabwarePositionCheck = (
interface ErrorBoundaryProps {
children: React.ReactNode
onClose: () => void
shouldUseMetalProbe: boolean
logger: ReturnType<typeof useLogger>
ErrorComponent: (props: {
errorMessage: string
shouldUseMetalProbe: boolean
onClose: () => void
}) => JSX.Element
}
Expand All @@ -70,12 +74,13 @@ class ErrorBoundary extends React.Component<
}

render(): ErrorBoundaryProps['children'] | JSX.Element {
const { ErrorComponent, children } = this.props
const { ErrorComponent, children, shouldUseMetalProbe } = this.props
const { error } = this.state
if (error != null)
return (
<ErrorComponent
errorMessage={error.message}
shouldUseMetalProbe={shouldUseMetalProbe}
onClose={this.props.onClose}
/>
)
Expand Down

0 comments on commit be51dfc

Please sign in to comment.