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

fix(app): add remove probe prompt when LPC errors #14574

Merged
merged 3 commits into from
Feb 29, 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
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 @@

interface FatalErrorModalProps {
errorMessage: string
shouldUseMetalProbe: boolean
onClose: () => void
}
export function FatalErrorModal(props: FatalErrorModalProps): JSX.Element {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

const { errorMessage, shouldUseMetalProbe, onClose } = props

const { errorMessage, shouldUseMetalProbe, onClose } = props

Check warning on line 34 in app/src/organisms/LabwarePositionCheck/FatalErrorModal.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/LabwarePositionCheck/FatalErrorModal.tsx#L34

Added line #L34 was not covered by tests
const { t } = useTranslation(['labware_position_check', 'shared'])
return (
<Portal level="top">
Expand All @@ -38,7 +40,7 @@
header={
<WizardHeader
title={t('labware_position_check_title')}
onExit={props.onClose}
onExit={onClose}
/>
}
>
Expand All @@ -58,20 +60,29 @@
<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 { 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 @@
<ErrorBoundary
logger={logger}
ErrorComponent={FatalErrorModal}
shouldUseMetalProbe={props.robotType === FLEX_ROBOT_TYPE}
onClose={props.onCloseClick}
>
<LabwarePositionCheckComponent {...props} />
Expand All @@ -44,9 +46,11 @@
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 @@
}

render(): ErrorBoundaryProps['children'] | JSX.Element {
const { ErrorComponent, children } = this.props
const { ErrorComponent, children, shouldUseMetalProbe } = this.props

Check warning on line 77 in app/src/organisms/LabwarePositionCheck/index.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/LabwarePositionCheck/index.tsx#L77

Added line #L77 was not covered by tests
const { error } = this.state
if (error != null)
return (
<ErrorComponent
errorMessage={error.message}
shouldUseMetalProbe={shouldUseMetalProbe}
onClose={this.props.onClose}
/>
)
Expand Down
Loading