-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app): prompt to open TC lid before labware calibration (#3853)
* save game * build new selector in modules * feat(app): prompt to open TC lid before labware calibration Provide a mechanism to open the lid of the Thermocycler Module during pre-run calibration, so that the contained labware can be calibrated. Closes #3066 * unneccessary changes removed * flow * useDispatch * no maybe type on PrepareModules
- Loading branch information
Showing
8 changed files
with
223 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// @flow | ||
import * as React from 'react' | ||
import { useDispatch } from 'react-redux' | ||
import some from 'lodash/some' | ||
import { | ||
useInterval, | ||
PrimaryButton, | ||
AlertModal, | ||
Icon, | ||
} from '@opentrons/components' | ||
|
||
import { | ||
fetchModules, | ||
sendModuleCommand, | ||
type Module, | ||
type RobotHost, | ||
} from '../../robot-api' | ||
import type { Dispatch } from '../../types' | ||
import DeckMap from '../DeckMap' | ||
import styles from './styles.css' | ||
import { Portal } from '../portal' | ||
|
||
const FETCH_MODULES_POLL_INTERVAL_MS = 1000 | ||
|
||
type Props = {| robot: RobotHost, modules: Array<Module> |} | ||
|
||
function PrepareModules(props: Props) { | ||
const { modules, robot } = props | ||
|
||
const dispatch = useDispatch<Dispatch>() | ||
|
||
// update on interval to respond to prepared modules | ||
useInterval( | ||
() => robot && dispatch(fetchModules(robot)), | ||
FETCH_MODULES_POLL_INTERVAL_MS | ||
) | ||
|
||
const handleOpenLidClick = () => { | ||
modules | ||
.filter(mod => mod.name === 'thermocycler') | ||
.forEach( | ||
mod => | ||
robot && | ||
dispatch( | ||
sendModuleCommand(robot, mod.serial, { command_type: 'open' }) | ||
) | ||
) | ||
} | ||
|
||
const isHandling = some( | ||
modules, | ||
mod => mod.name === 'thermocycler' && mod.data?.lid === 'in_between' | ||
) | ||
return ( | ||
<div className={styles.page_content_dark}> | ||
<div className={styles.deck_map_wrapper}> | ||
<DeckMap className={styles.deck_map} modulesRequired /> | ||
</div> | ||
<Portal> | ||
<AlertModal | ||
iconName={null} | ||
heading="Open Thermocycler Module lid for calibration" | ||
> | ||
<p> | ||
The Thermocycler Module's lid is closed. Please open the lid in | ||
order to proceed with calibration. | ||
</p> | ||
<PrimaryButton | ||
className={styles.open_lid_button} | ||
onClick={handleOpenLidClick} | ||
// disabled={isHandling} TODO: uncomment when optical latches report 'closed' | ||
> | ||
{isHandling ? ( | ||
<> | ||
<Icon | ||
name="ot-spinner" | ||
className={styles.in_progress_spinner} | ||
spin | ||
/> | ||
</> | ||
) : ( | ||
'Open Lid' | ||
)} | ||
</PrimaryButton> | ||
</AlertModal> | ||
</Portal> | ||
</div> | ||
) | ||
} | ||
|
||
export default PrepareModules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
@import '@opentrons/components'; | ||
|
||
.alert { | ||
position: absolute; | ||
top: 3rem; | ||
left: 0; | ||
right: 0; | ||
} | ||
|
||
.prompt { | ||
padding-top: 2rem; | ||
flex: none; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.prompt_text { | ||
@apply --font-header-light; | ||
|
||
font-weight: normal; | ||
margin: 0.5rem 0; | ||
text-align: center; | ||
} | ||
|
||
.prompt_button { | ||
display: block; | ||
width: auto; | ||
margin: 0.5rem 0 1rem 0; | ||
padding-left: 3rem; | ||
padding-right: 3rem; | ||
} | ||
|
||
.page_content_dark { | ||
display: flex; | ||
padding: 1rem; | ||
flex-direction: column; | ||
align-items: center; | ||
background-color: color(var(--c-black) alpha(0.99)); | ||
height: 100%; | ||
} | ||
|
||
.deck_map_wrapper { | ||
flex: 1 1 0; | ||
align-self: stretch; | ||
display: flex; | ||
background-color: var(--c-bg-light); | ||
border-radius: 6px; | ||
} | ||
|
||
.deck_map { | ||
flex: 1; | ||
} | ||
|
||
.in_progress_spinner { | ||
height: 1rem; | ||
} | ||
|
||
.open_lid_button { | ||
margin: 2rem 0 0.5rem 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.