Skip to content

Commit

Permalink
clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader committed Apr 5, 2024
1 parent 5158943 commit 74102a8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions protocol-designer/src/components/DeckSetup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ export const DeckSetupContents = (props: ContentsProps): JSX.Element => {
}, [])

const allModules: ModuleOnDeck[] = values(activeDeckSetup.modules)

// NOTE: naively hard-coded to show warning north of slots 1 or 3 when occupied by any module
const multichannelWarningSlotIds: AddressableAreaName[] = showGen1MultichannelCollisionWarnings
? compact([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export function ModulesAndOtherTile(props: WizardTileProps): JSX.Element {

function FlexModuleFields(props: WizardTileProps): JSX.Element {
const { watch, setValue } = props
const moamFf = useSelector(getEnableMoam)
const enableMoamFf = useSelector(getEnableMoam)
const modules = watch('modules')
const additionalEquipment = watch('additionalEquipment')
const moduleTypesOnDeck =
Expand Down Expand Up @@ -268,7 +268,10 @@ function FlexModuleFields(props: WizardTileProps): JSX.Element {
}

const handleOnClick = (): void => {
if (moduleType !== TEMPERATURE_MODULE_TYPE) {
if (
(moduleType !== TEMPERATURE_MODULE_TYPE && enableMoamFf) ||
!enableMoamFf
) {
if (moduleOnDeck) {
const updatedModules =
modules != null
Expand Down Expand Up @@ -302,7 +305,7 @@ function FlexModuleFields(props: WizardTileProps): JSX.Element {
disabled={isDisabled && !moduleOnDeck}
onClick={handleOnClick}
multiples={
moduleType === TEMPERATURE_MODULE_TYPE && moamFf
moduleType === TEMPERATURE_MODULE_TYPE && enableMoamFf
? {
maxItems: 7,
setValue: handleMultiplesClick,
Expand All @@ -316,7 +319,9 @@ function FlexModuleFields(props: WizardTileProps): JSX.Element {
}
: undefined
}
showCheckbox={moduleType !== TEMPERATURE_MODULE_TYPE}
showCheckbox={
enableMoamFf ? moduleType !== TEMPERATURE_MODULE_TYPE : true
}
/>
)
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { fireEvent, screen, cleanup } from '@testing-library/react'
import { FLEX_ROBOT_TYPE, OT2_ROBOT_TYPE } from '@opentrons/shared-data'
import { renderWithProviders } from '../../../../__testing-utils__'
import { i18n } from '../../../../localization'
import { getDisableModuleRestrictions } from '../../../../feature-flags/selectors'
import {
getDisableModuleRestrictions,
getEnableMoam,
} from '../../../../feature-flags/selectors'
import { CrashInfoBox } from '../../../modules'
import { ModuleFields } from '../../FilePipettesModal/ModuleFields'
import { ModulesAndOtherTile } from '../ModulesAndOtherTile'
Expand Down Expand Up @@ -58,6 +61,7 @@ describe('ModulesAndOtherTile', () => {
...props,
...mockWizardTileProps,
} as WizardTileProps
vi.mocked(getEnableMoam).mockReturnValue(true)
vi.mocked(CrashInfoBox).mockReturnValue(<div> mock CrashInfoBox</div>)
vi.mocked(EquipmentOption).mockReturnValue(<div>mock EquipmentOption</div>)
vi.mocked(getDisableModuleRestrictions).mockReturnValue(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,7 @@ export function CreateFileWizard(): JSX.Element | null {
{
type: formModule.type,
model: formModule.model || ('' as ModuleModel),
slot:
formModule.slot === ''
? getTrashSlot(values)
: formModule.slot,
slot: formModule.slot,
},
]
},
Expand Down

0 comments on commit 74102a8

Please sign in to comment.