-
-
- {({
- handleChange,
- handleSubmit,
- errors,
- setFieldValue,
- touched,
- values,
- handleBlur,
- setFieldTouched,
- }: FormikProps) => {
- const { left, right } = values.pipettesByMount
-
- const pipetteSelectionIsValid =
- // at least one must not be none (empty string)
- left.pipetteName || right.pipetteName
-
- const hasCrashableMagnetModuleSelected = this.getCrashableModuleSelected(
- values.modulesByType,
- MAGNETIC_MODULE_TYPE
- )
- const hasCrashableTemperatureModuleSelected = this.getCrashableModuleSelected(
- values.modulesByType,
- TEMPERATURE_MODULE_TYPE
- )
- const hasHeaterShakerSelected = Boolean(
- values.modulesByType[HEATERSHAKER_MODULE_TYPE].onDeck
- )
+ return (
+
+
+
+
+ {({
+ handleChange,
+ handleSubmit,
+ errors,
+ setFieldValue,
+ touched,
+ values,
+ handleBlur,
+ setFieldTouched,
+ }: FormikProps) => {
+ const { left, right } = values.pipettesByMount
- const showHeaterShakerPipetteCollisions =
- hasHeaterShakerSelected &&
- [
- getPipetteNameSpecs(left.pipetteName as PipetteName),
- getPipetteNameSpecs(right.pipetteName as PipetteName),
- ].some(
- pipetteSpecs => pipetteSpecs && pipetteSpecs.channels !== 1
- )
-
- const crashablePipetteSelected = getIsCrashablePipetteSelected(
- values.pipettesByMount
+ const pipetteSelectionIsValid =
+ // at least one must not be none (empty string)
+ left.pipetteName || right.pipetteName
+
+ const hasCrashableMagnetModuleSelected = getCrashableModuleSelected(
+ values.modulesByType,
+ MAGNETIC_MODULE_TYPE
+ )
+ const hasCrashableTemperatureModuleSelected = getCrashableModuleSelected(
+ values.modulesByType,
+ TEMPERATURE_MODULE_TYPE
+ )
+ const hasHeaterShakerSelected = Boolean(
+ values.modulesByType[HEATERSHAKER_MODULE_TYPE].onDeck
+ )
+
+ const showHeaterShakerPipetteCollisions =
+ hasHeaterShakerSelected &&
+ [
+ getPipetteNameSpecs(left.pipetteName as PipetteName),
+ getPipetteNameSpecs(right.pipetteName as PipetteName),
+ ].some(
+ pipetteSpecs => pipetteSpecs && pipetteSpecs.channels !== 1
)
- const showTempPipetteCollisons =
- crashablePipetteSelected &&
- hasCrashableTemperatureModuleSelected
- const showMagPipetteCollisons =
- crashablePipetteSelected && hasCrashableMagnetModuleSelected
-
- return (
- <>
-
-
- {this.state.showEditPipetteConfirmation && (
-
)}
- >
- )
- }}
-
-
+
+
+ {t('button:cancel')}
+
+
+ {t('button:save')}
+
+
+
+
+ {showEditPipetteConfirmation ? (
+
setShowEditPipetteConfirmation(false)}
+ onConfirm={handleSubmit}
+ />
+ ) : null}
+ >
+ )
+ }}
+
-
- )
- }
+
+
+ )
}
diff --git a/protocol-designer/src/components/modals/LabwareUploadMessageModal/LabwareUploadMessageModal.tsx b/protocol-designer/src/components/modals/LabwareUploadMessageModal/LabwareUploadMessageModal.tsx
index 2286c68cdc8..08e88586940 100644
--- a/protocol-designer/src/components/modals/LabwareUploadMessageModal/LabwareUploadMessageModal.tsx
+++ b/protocol-designer/src/components/modals/LabwareUploadMessageModal/LabwareUploadMessageModal.tsx
@@ -62,12 +62,16 @@ const MessageBody = (props: {
{canOverwrite && (
{t('labware_upload_message.name_conflict.overwrite')}
)}
- {canOverwrite && message.isOverwriteMismatched && (
-
- {t('labware_upload_message.name_conflict.warning')}{' '}
- {t('labware_upload_message.name_conflict.mismatched')}
-
- )}
+ {canOverwrite &&
+ 'isOverwriteMismatched' in message &&
+ message.isOverwriteMismatched && (
+
+
+ {t('labware_upload_message.name_conflict.warning')}
+ {' '}
+ {t('labware_upload_message.name_conflict.mismatched')}
+
+ )}
>
)
}
diff --git a/protocol-designer/src/containers/ConnectedFilePage.ts b/protocol-designer/src/containers/ConnectedFilePage.ts
deleted file mode 100644
index 10bc951b5b1..00000000000
--- a/protocol-designer/src/containers/ConnectedFilePage.ts
+++ /dev/null
@@ -1,71 +0,0 @@
-import * as React from 'react'
-import { connect } from 'react-redux'
-import { useTranslation } from 'react-i18next'
-import mapValues from 'lodash/mapValues'
-import { FilePage } from '../components/FilePage'
-import {
- actions,
- selectors as fileSelectors,
- FileMetadataFields,
-} from '../file-data'
-import { selectors as stepFormSelectors, InitialDeckSetup } from '../step-forms'
-import { actions as steplistActions } from '../steplist'
-import { INITIAL_DECK_SETUP_STEP_ID } from '../constants'
-import { actions as navActions } from '../navigation'
-
-import type { BaseState, ThunkDispatch } from '../types'
-
-type Props = React.ComponentProps
-interface SP {
- instruments: Props['instruments']
- formValues: Props['formValues']
- _initialDeckSetup: InitialDeckSetup
- modules: Props['modules']
- t: any
-}
-
-const mapStateToProps = (state: BaseState): SP => {
- const { t } = useTranslation('button')
- return {
- formValues: fileSelectors.getFileMetadata(state),
- instruments: stepFormSelectors.getPipettesForInstrumentGroup(state),
- modules: stepFormSelectors.getModulesForEditModulesCard(state),
- _initialDeckSetup: stepFormSelectors.getInitialDeckSetup(state),
- t: t,
- }
-}
-
-function mergeProps(
- stateProps: SP,
- dispatchProps: {
- dispatch: ThunkDispatch
- }
-): Props {
- const { _initialDeckSetup, ...passThruProps } = stateProps
- const { dispatch } = dispatchProps
- const swapPipetteUpdate = mapValues(_initialDeckSetup.pipettes, pipette => {
- if (!pipette.mount) return pipette.mount
- return pipette.mount === 'left' ? 'right' : 'left'
- })
- return {
- ...passThruProps,
- goToNextPage: () => dispatch(navActions.navigateToPage('liquids')),
- saveFileMetadata: (nextFormValues: FileMetadataFields) =>
- dispatch(actions.saveFileMetadata(nextFormValues)),
- swapPipettes: () =>
- dispatch(
- steplistActions.changeSavedStepForm({
- stepId: INITIAL_DECK_SETUP_STEP_ID,
- update: {
- pipetteLocationUpdate: swapPipetteUpdate,
- },
- })
- ),
- }
-}
-
-export const ConnectedFilePage = connect(
- mapStateToProps,
- null,
- mergeProps
-)(FilePage)
diff --git a/protocol-designer/src/containers/ConnectedMainPanel.tsx b/protocol-designer/src/containers/ConnectedMainPanel.tsx
index 4a04fbb39f1..febe576eea2 100644
--- a/protocol-designer/src/containers/ConnectedMainPanel.tsx
+++ b/protocol-designer/src/containers/ConnectedMainPanel.tsx
@@ -4,14 +4,14 @@ import { Splash } from '@opentrons/components'
import { START_TERMINAL_ITEM_ID, TerminalItemId } from '../steplist'
import { Portal as MainPageModalPortal } from '../components/portals/MainPageModalPortal'
import { DeckSetupManager } from '../components/DeckSetupManager'
-import { ConnectedFilePage } from '../containers/ConnectedFilePage'
import { SettingsPage } from '../components/SettingsPage'
+import { FilePage } from '../components/FilePage'
import { LiquidsPage } from '../components/LiquidsPage'
import { Hints } from '../components/Hints'
import { LiquidPlacementModal } from '../components/LiquidPlacementModal'
import { LabwareSelectionModal } from '../components/LabwareSelectionModal'
import { FormManager } from '../components/FormManager'
-import { TimelineAlerts } from '../components/alerts/TimelineAlerts'
+import { Alerts } from '../components/alerts/Alerts'
import { getSelectedTerminalItemId } from '../ui/steps'
import { selectors as labwareIngredSelectors } from '../labware-ingred/selectors'
@@ -30,7 +30,7 @@ function MainPanelComponent(props: Props): JSX.Element {
case 'file-splash':
return
case 'file-detail':
- return
+ return
case 'liquids':
return
case 'settings-app':
@@ -41,7 +41,7 @@ function MainPanelComponent(props: Props): JSX.Element {
return (
<>
-
+
{startTerminalItemSelected && }
diff --git a/protocol-designer/src/containers/ConnectedSidebar.tsx b/protocol-designer/src/containers/ConnectedSidebar.tsx
index 3843cc5720e..092c288f4d1 100644
--- a/protocol-designer/src/containers/ConnectedSidebar.tsx
+++ b/protocol-designer/src/containers/ConnectedSidebar.tsx
@@ -5,7 +5,7 @@ import { selectors as labwareIngredSelectors } from '../labware-ingred/selectors
import { ConnectedStepList } from './ConnectedStepList'
import { IngredientsList } from './IngredientsList'
-import { FileSidebar } from '../components/FileSidebar'
+import { FileSidebar } from '../components/FileSidebar/FileSidebar'
import { LiquidsSidebar } from '../components/LiquidsSidebar'
import { SettingsSidebar } from '../components/SettingsPage'
diff --git a/protocol-designer/src/containers/ConnectedTitleBar.tsx b/protocol-designer/src/containers/ConnectedTitleBar.tsx
index 45415c861e1..61f5f59f6c3 100644
--- a/protocol-designer/src/containers/ConnectedTitleBar.tsx
+++ b/protocol-designer/src/containers/ConnectedTitleBar.tsx
@@ -1,8 +1,8 @@
import * as React from 'react'
-import { Dispatch } from 'redux'
-import { connect } from 'react-redux'
+import { useSelector, useDispatch } from 'react-redux'
+import { useTranslation } from 'react-i18next'
-import { TitleBar, Icon, IconName, TitleBarProps } from '@opentrons/components'
+import { TitleBar, Icon, IconName } from '@opentrons/components'
import { getLabwareDisplayName } from '@opentrons/shared-data'
import styles from './TitleBar.css'
import { START_TERMINAL_TITLE, END_TERMINAL_TITLE } from '../constants'
@@ -19,23 +19,7 @@ import { END_TERMINAL_ITEM_ID, START_TERMINAL_ITEM_ID } from '../steplist'
import { selectors as fileDataSelectors } from '../file-data'
import { closeIngredientSelector } from '../labware-ingred/actions'
import { stepIconsByType } from '../form-types'
-import { selectors, Page } from '../navigation'
-
-import { BaseState } from '../types'
-import { useTranslation } from 'react-i18next'
-
-type Props = React.ComponentProps
-
-interface DP {
- onBackClick: Props['onBackClick']
-}
-
-type SP = Omit & {
- _page: Page
- _liquidPlacementMode?: boolean
- _wellSelectionMode?: boolean
-}
-
+import { selectors } from '../navigation'
interface TitleWithIconProps {
iconName: IconName | null | undefined
text: string | null | undefined
@@ -61,18 +45,25 @@ const Title = (props: TitleProps): JSX.Element => (
)
-function mapStateToProps(state: BaseState): SP {
+export const ConnectedTitleBar = (): JSX.Element => {
const { t } = useTranslation(['nav', 'application'])
- const selectedLabwareId = labwareIngredSelectors.getSelectedLabwareId(state)
- const _page = selectors.getCurrentPage(state)
- const fileName = fileDataSelectors.protocolName(state)
- const selectedStepInfo = getSelectedStepTitleInfo(state)
- const selectedTerminalId = getSelectedTerminalItemId(state)
- const labwareNames = uiLabwareSelectors.getLabwareNicknamesById(state)
- const drilledDownLabwareId = labwareIngredSelectors.getDrillDownLabwareId(
- state
+ const dispatch = useDispatch()
+ const selectedLabwareId = useSelector(
+ labwareIngredSelectors.getSelectedLabwareId
+ )
+ const _page = useSelector(selectors.getCurrentPage)
+ const labwareNicknamesById = useSelector(
+ uiLabwareSelectors.getLabwareNicknamesById
)
- const wellSelectionLabwareKey = getWellSelectionLabwareKey(state)
+ const fileName = useSelector(fileDataSelectors.protocolName)
+ const labwareEntities = useSelector(stepFormSelectors.getLabwareEntities)
+ const selectedStepInfo = useSelector(getSelectedStepTitleInfo)
+ const selectedTerminalId = useSelector(getSelectedTerminalItemId)
+ const labwareNames = useSelector(uiLabwareSelectors.getLabwareNicknamesById)
+ const drilledDownLabwareId = useSelector(
+ labwareIngredSelectors.getDrillDownLabwareId
+ )
+ const wellSelectionLabwareKey = useSelector(getWellSelectionLabwareKey)
// TODO(mc, 2019-06-27): µL to uL replacement needed to handle CSS capitalization
const labwareNickname =
@@ -80,27 +71,30 @@ function mapStateToProps(state: BaseState): SP {
? labwareNames[selectedLabwareId].replace('µL', 'uL')
: null
const labwareEntity =
- selectedLabwareId != null
- ? stepFormSelectors.getLabwareEntities(state)[selectedLabwareId]
- : null
+ selectedLabwareId != null ? labwareEntities[selectedLabwareId] : null
+
const liquidPlacementMode = selectedLabwareId != null
+ let title: React.ReactNode = <>>
+ let subtitle: string | null = null
+ let backButtonLabel: string | undefined
+ let _wellSelectionMode: boolean = false
+ let _liquidPlacementMode: boolean = false
+
switch (_page) {
case 'liquids':
- case 'file-detail':
- return {
- _page,
- title: t([`title.${_page}`, fileName]),
- subtitle: t([`subtitle.${_page}`, '']),
- }
+ case 'file-detail': {
+ title = <>{t([`title.${_page}`, fileName])}>
+ subtitle = t([`subtitle.${_page}`, ''])
+ break
+ }
case 'file-splash':
case 'settings-features':
- case 'settings-app':
- return {
- _page,
- title: