Skip to content

Commit

Permalink
fix(app): Remove holdover /calibrate/instruments missed by #1765 (#1787)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcous authored Jul 2, 2018
1 parent 7ce12b3 commit 03dd305
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 66 deletions.
81 changes: 17 additions & 64 deletions app/src/components/TipProbe/ContinuePanel.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,25 @@
// @flow
import * as React from 'react'
import type {Dispatch} from 'redux'
import {connect} from 'react-redux'
import {push} from 'react-router-redux'
import {Link} from 'react-router-dom'

import type {State} from '../../types'
import {PrimaryButton} from '@opentrons/components'
import CalibrationInfoContent from '../CalibrationInfoContent'

import {selectors as robotSelectors} from '../../robot'

type StateProps = {
type SP = {
done: boolean,
_button: ?{
href: string,
text: string
}
buttonText: string,
}

type DispatchProps = {
dispatch: Dispatch<*>
}

type RemoveTipProps = {
done: boolean,
button: ?{
text: string,
onClick: () => void
}
}
type Props = SP

export default connect(mapStateToProps, null, mergeProps)(RemoveTipPanel)
export default connect(mapStateToProps)(RemoveTipPanel)

function RemoveTipPanel (props: RemoveTipProps) {
const {done, button} = props
function RemoveTipPanel (props: Props) {
const {done, buttonText} = props

return (
<CalibrationInfoContent leftChildren={(
Expand All @@ -41,55 +28,21 @@ function RemoveTipPanel (props: RemoveTipProps) {
{done && (
<p>Replace trash bin on top of tip probe before continuing</p>
)}
{button && (
<PrimaryButton onClick={button.onClick}>
{button.text}
</PrimaryButton>
)}
{!button && (
<p>
Your protocol is ready to run!
</p>
)}
{/* redirect for next pipette or labware lives in /calibrate */}
<PrimaryButton Component={Link} to='/calibrate'>
{buttonText}
</PrimaryButton>
</div>
)} />
)
}

function mapStateToProps (state): StateProps {
function mapStateToProps (state: State): SP {
const instruments = robotSelectors.getInstruments(state)
const nextLabware = robotSelectors.getNextLabware(state)
const nextInstrument = instruments.find((inst) => !inst.probed)
const buttonText = nextInstrument
? 'Continue to next pipette'
: 'Continue to labware setup'

let _button = null

if (nextInstrument) {
_button = {
href: `/calibrate/instruments/${nextInstrument.mount}`,
text: 'Continue to Next Pipette'
}
} else if (nextLabware) {
_button = {
href: `/calibrate/labware/${nextLabware.slot}`,
text: 'Continue to Labware setup'
}
}

return {_button, done: nextInstrument == null}
}

function mergeProps (
stateProps: StateProps,
dispatchProps: DispatchProps
): RemoveTipProps {
const {done, _button} = stateProps
const {dispatch} = dispatchProps

return {
done,
button: _button && {
text: _button.text,
onClick: () => dispatch(push(_button.href))
}
}
return {buttonText, done: nextInstrument == null}
}
2 changes: 1 addition & 1 deletion app/src/components/calibrate-pipettes/PipetteTabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function PipetteTabs (props: Props) {

const pages = robotConstants.INSTRUMENT_MOUNTS.map((mount) => ({
title: mount,
href: `/calibrate/instruments/${mount}`,
href: `./${mount}`,
isActive: currentInstrument != null && mount === currentInstrument.mount,
isDisabled: !instruments.some((inst) => inst.mount === mount)
}))
Expand Down
2 changes: 1 addition & 1 deletion app/src/pages/Calibrate/Pipettes.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function CalibratePipettesPage (props: Props) {
const {instruments, currentInstrument, match: {url, params}} = props
const confirmTipProbeUrl = `${url}/confirm-tip-probe`

// redirect back to /calibrate/instruments if mount doesn't exist
// redirect back to mountless route if mount doesn't exist
if (params.mount && !currentInstrument) {
return (<Redirect to={url.replace(`/${params.mount}`, '')} />)
}
Expand Down

0 comments on commit 03dd305

Please sign in to comment.