Skip to content

Commit

Permalink
fix check-js and lint-js errors
Browse files Browse the repository at this point in the history
  • Loading branch information
koji committed Oct 21, 2024
1 parent 57cf81c commit a0db902
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 49 deletions.
14 changes: 7 additions & 7 deletions protocol-designer/src/components/EditModules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import { EditMultipleModulesModal } from './modals/EditModulesModal/EditMultiple
import { useBlockingHint } from './Hints/useBlockingHint'
import { MagneticModuleWarningModalContent } from './modals/EditModulesModal/MagneticModuleWarningModalContent'
import { EditModulesModal } from './modals/EditModulesModal'
import type { ModuleModel, ModuleType } from '@opentrons/shared-data'
import type { ModuleModel, } from '@opentrons/shared-data'

export interface EditModulesProps {
moduleToEdit: {
moduleId?: string | null
moduleType: ModuleType
:

Check failure on line 25 in protocol-designer/src/components/EditModules.tsx

View workflow job for this annotation

GitHub Actions / js checks

Property or signature expected.

Check failure on line 25 in protocol-designer/src/components/EditModules.tsx

View workflow job for this annotation

GitHub Actions / js checks

Property or signature expected.
}
onCloseClick: () => void
}
Expand All @@ -35,16 +35,16 @@ export interface ModelModuleInfo {
export const EditModules = (props: EditModulesProps): JSX.Element => {
const { onCloseClick, moduleToEdit } = props
const enableMoam = useSelector(getEnableMoam)
const { moduleId, moduleType } = moduleToEdit
const { moduleId, } = moduleToEdit
const _initialDeckSetup = useSelector(stepFormSelectors.getInitialDeckSetup)
const robotType = useSelector(getRobotType)

const MOAM_MODULE_TYPES: ModuleType[] = enableMoam
const MOAM_MODULE_TYPES: [] = enableMoam
? [TEMPERATURE_MODULE_TYPE, HEATERSHAKER_MODULE_TYPE, MAGNETIC_BLOCK_TYPE]
: [TEMPERATURE_MODULE_TYPE]

const showMultipleModuleModal =
robotType === FLEX_ROBOT_TYPE && MOAM_MODULE_TYPES.includes(moduleType)
robotType === FLEX_ROBOT_TYPE && MOAM_MODULE_TYPES.includes()

const moduleOnDeck = moduleId ? _initialDeckSetup.modules[moduleId] : null
const [
Expand Down Expand Up @@ -94,7 +94,7 @@ export const EditModules = (props: EditModulesProps): JSX.Element => {

let modal = (
<EditModulesModal
moduleType={moduleType}
={}
moduleOnDeck={moduleOnDeck}

Check failure on line 98 in protocol-designer/src/components/EditModules.tsx

View workflow job for this annotation

GitHub Actions / js checks

',' expected.

Check failure on line 98 in protocol-designer/src/components/EditModules.tsx

View workflow job for this annotation

GitHub Actions / js checks

',' expected.
onCloseClick={onCloseClick}

Check failure on line 99 in protocol-designer/src/components/EditModules.tsx

View workflow job for this annotation

GitHub Actions / js checks

',' expected.

Check failure on line 99 in protocol-designer/src/components/EditModules.tsx

View workflow job for this annotation

GitHub Actions / js checks

',' expected.
editModuleSlot={editModuleSlot}

Check failure on line 100 in protocol-designer/src/components/EditModules.tsx

View workflow job for this annotation

GitHub Actions / js checks

',' expected.

Check failure on line 100 in protocol-designer/src/components/EditModules.tsx

View workflow job for this annotation

GitHub Actions / js checks

',' expected.
Expand All @@ -107,7 +107,7 @@ export const EditModules = (props: EditModulesProps): JSX.Element => {
<EditMultipleModulesModal
onCloseClick={onCloseClick}
allModulesOnDeck={Object.values(_initialDeckSetup.modules)}
moduleType={moduleType}
={}

Check failure on line 110 in protocol-designer/src/components/EditModules.tsx

View workflow job for this annotation

GitHub Actions / js checks

Identifier expected.

Check failure on line 110 in protocol-designer/src/components/EditModules.tsx

View workflow job for this annotation

GitHub Actions / js checks

Identifier expected.
/>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
OT2_SUPPORTED_MODULE_MODELS,
} from './constants'
import {
getNumOptions,
getNumOptionsForModules,
getNumSlotsAvailable,
getModuleDistribution,
getAvailableSlots,
Expand All @@ -53,7 +53,6 @@ import type { FormModule, FormModules } from '../../step-forms'
import type { WizardTileProps } from './types'

const MAX_MAGNETIC_BLOCKS = 4
// const MAGNETIC_BLOCKS_ADJUSTMENT = 3

export function SelectModules(props: WizardTileProps): JSX.Element | null {
const { goBack, proceed, watch, setValue } = props
Expand Down Expand Up @@ -98,25 +97,6 @@ export function SelectModules(props: WizardTileProps): JSX.Element | null {
? [TEMPERATURE_MODULE_TYPE, HEATERSHAKER_MODULE_TYPE, MAGNETIC_BLOCK_TYPE]
: [TEMPERATURE_MODULE_TYPE]

// const handleAddModule = (moduleModel: ModuleModel): void => {
// // Need to fix since this condition isn't quite right
// if (hasNoAvailableSlots) {
// makeSnackbar(t('slots_limit_reached') as string)
// } else {
// setValue('modules', {
// ...modules,
// [uuid()]: {
// model: moduleModel,
// type: getModuleType(moduleModel),
// slot:
// robotType === FLEX_ROBOT_TYPE
// ? DEFAULT_SLOT_MAP_FLEX[moduleModel]
// : DEFAULT_SLOT_MAP_OT2[getModuleType(moduleModel)],
// },
// })
// }
// }

const handleAddModule = (moduleModel: ModuleModel): void => {
const moduleType = getModuleType(moduleModel)
const distribution = getModuleDistribution(modules)
Expand Down Expand Up @@ -289,14 +269,10 @@ export function SelectModules(props: WizardTileProps): JSX.Element | null {
)
},
dropdownType: 'neutral' as DropdownBorder,
// filterOptions: getNumOptions(
// module.model === 'magneticBlockV1'
// ? numSlotsAvailable +
// MAGNETIC_BLOCKS_ADJUSTMENT +
// module.count
// : numSlotsAvailable + module.count
// ),
filterOptions: getNumOptions(module.type, distribution),
filterOptions: getNumOptionsForModules(
module.type,
distribution
),
}
return (
<ListItem type="noActive" key={`${module.model}`}>
Expand Down
23 changes: 10 additions & 13 deletions protocol-designer/src/pages/CreateNewProtocolWizard/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ import type { FormModules } from '../../step-forms'
const TOTAL_MODULE_SLOTS = 8
const MIDDLE_SLOT_NUM = 4

// export const getNumOptions = (length: number): DropdownOption[] => {
// return Array.from({ length }, (_, i) => ({
// name: `${i + 1}`,
// value: `${i + 1}`,
// }))
// }

export const getNumOptions = (
export const getNumOptions = (length: number): DropdownOption[] => {
return Array.from({ length }, (_, i) => ({
name: `${i + 1}`,
value: `${i + 1}`,
}))
}

export const getNumOptionsForModules = (
moduleType: ModuleType,
distribution: ModuleDistribution
): DropdownOption[] => {
Expand Down Expand Up @@ -95,7 +95,7 @@ export const getNumSlotsAvailable = (
filteredModuleLength = filteredModuleLength + 1
}
if (magneticBlocks.length > 0) {
// once blocks exceed 4, then we dont' want to subtract the amount available
// once blocks exceed 4, then we don't want to subtract the amount available
// because block can go into the center slots where all other modules/trashes can not
const numBlocks =
magneticBlocks.length > 4 ? MIDDLE_SLOT_NUM : magneticBlocks.length
Expand Down Expand Up @@ -334,11 +334,7 @@ export const getAvailableSlots = (
if (distribution === null)
return { regular: TOTAL_SLOTS_WITHOUT_TWO_COL, magnetic: TWO_COL_SLOTS }
const { tc, hs, mb, tm } = distribution

// マグネティックブロック用のスロット
const availableMagneticSlots = 11 - (tc * 2 + hs + tm + mb)

// 通常のモジュール用のスロット
const availableRegularSlots = 7 - (hs + tm + (tc > 0 ? 2 : 0))

return {
Expand All @@ -352,6 +348,7 @@ export const getCanAddModule = (
distribution: ModuleDistribution
): boolean => {
const availableSlots = getAvailableSlots(distribution)
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { tc, hs, mb, tm } = distribution

switch (moduleType) {
Expand Down

0 comments on commit a0db902

Please sign in to comment.