-
Notifications
You must be signed in to change notification settings - Fork 179
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
feat(app): oDD banners for pipette calibration warning #13624
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,10 +1,15 @@ | ||||||
import { format, parseISO } from 'date-fns' | ||||||
import { INCONSISTENT_PIPETTE_OFFSET } from '@opentrons/api-client' | ||||||
import type { | ||||||
FetchPipettesResponseBody, | ||||||
FetchPipettesResponsePipette, | ||||||
Mount, | ||||||
} from '../../redux/pipettes/types' | ||||||
import type { PipetteOffsetCalibration } from '@opentrons/api-client' | ||||||
import type { | ||||||
Instruments, | ||||||
PipetteData, | ||||||
PipetteOffsetCalibration, | ||||||
} from '@opentrons/api-client' | ||||||
|
||||||
/** | ||||||
* formats a string if it is in ISO 8601 date format | ||||||
|
@@ -68,3 +73,19 @@ export function getOffsetCalibrationForMount( | |||||
) | ||||||
} | ||||||
} | ||||||
|
||||||
export function getShowPipetteCalibrationWarning( | ||||||
attachedInstruments?: Instruments | ||||||
): boolean { | ||||||
return ( | ||||||
attachedInstruments?.data.some((i): i is PipetteData => { | ||||||
const failuresList = | ||||||
i.ok && i.data.calibratedOffset?.reasonability_check_failures != null | ||||||
? i.data.calibratedOffset?.reasonability_check_failures | ||||||
: [] | ||||||
if (failuresList.length > 0) { | ||||||
return failuresList[0]?.kind === INCONSISTENT_PIPETTE_OFFSET | ||||||
} else return false | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit
Suggested change
|
||||||
}) ?? false | ||||||
) | ||||||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please ignore the comments I left. |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,56 @@ | ||||||
import * as React from 'react' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. file should probably be |
||||||
import { useTranslation, Trans } from 'react-i18next' | ||||||
import { | ||||||
Flex, | ||||||
Icon, | ||||||
Btn, | ||||||
SPACING, | ||||||
COLORS, | ||||||
JUSTIFY_SPACE_BETWEEN, | ||||||
ALIGN_CENTER, | ||||||
BORDERS, | ||||||
JUSTIFY_FLEX_START, | ||||||
} from '@opentrons/components' | ||||||
import { StyledText } from '../../atoms/text' | ||||||
|
||||||
export const PipetteRecalibrationODDWarning = (): JSX.Element | null => { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
const { t } = useTranslation('instruments_dashboard') | ||||||
const [showBanner, setShowBanner] = React.useState<boolean>(true) | ||||||
if (!showBanner) return null | ||||||
|
||||||
return ( | ||||||
<Flex | ||||||
justifyContent={JUSTIFY_SPACE_BETWEEN} | ||||||
alignItems={ALIGN_CENTER} | ||||||
borderRadius={BORDERS.borderRadiusSize3} | ||||||
backgroundColor={COLORS.yellow3} | ||||||
padding={`${SPACING.spacing12} ${SPACING.spacing16}`} | ||||||
height="5.76rem" | ||||||
width="60rem" | ||||||
> | ||||||
<Flex justifyContent={JUSTIFY_FLEX_START}> | ||||||
<Icon | ||||||
name="alert-circle" | ||||||
color={COLORS.yellow2} | ||||||
width="45px" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
marginRight={SPACING.spacing12} | ||||||
/> | ||||||
<StyledText as="p"> | ||||||
<Trans | ||||||
t={t} | ||||||
i18nKey="pipette_calibrations_differ" | ||||||
components={{ bold: <strong /> }} | ||||||
/> | ||||||
</StyledText> | ||||||
</Flex> | ||||||
<Btn onClick={() => setShowBanner(false)}> | ||||||
<Icon | ||||||
width={SPACING.spacing32} | ||||||
height={SPACING.spacing32} | ||||||
Comment on lines
+48
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
name="close" | ||||||
aria-label="close_icon" | ||||||
/> | ||||||
</Btn> | ||||||
</Flex> | ||||||
) | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.