Skip to content

Commit

Permalink
Fix ts and linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
smb2268 committed Oct 10, 2024
1 parent cb18dfe commit 673e80d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion api-client/src/modules/api-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export interface HeaterShakerData {
status: HeaterShakerStatus
}
export interface AbsorbanceReaderData {
lidStatus: 'open' | 'closed' | 'unknown'
lidStatus: 'on' | 'off' | 'unknown'
platePresence: 'present' | 'absent' | 'unknown'
sampleWavelength: number | null
status: AbsorbanceReaderStatus
Expand Down
18 changes: 8 additions & 10 deletions app/src/organisms/ModuleCard/ModuleOverflowMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import {
} from '@opentrons/components'

import {
ABSORBANCE_READER_TYPE,
HEATERSHAKER_MODULE_TYPE,
MODULE_MODELS_OT2_ONLY,
TEMPERATURE_MODULE_TYPE,
THERMOCYCLER_MODULE_TYPE,
ABSORBANCE_READER_TYPE,
} from '@opentrons/shared-data'
import { useCurrentRunId, useRunStatuses } from '/app/resources/runs'
import { useIsLegacySessionInProgress } from '/app/resources/legacy_sessions'
Expand Down Expand Up @@ -148,15 +148,13 @@ export const ModuleOverflowMenu = (
(item: any, index: number) => {
return (
<Fragment key={`${index}_${String(module.moduleType)}`}>
{item.setSetting ? (
<MenuItem
onClick={() => item.onClick(item.isSecondary)}
disabled={item.disabledReason || isDisabled}
whiteSpace="nowrap"
>
{item.setSetting}
</MenuItem>
) : null}
<MenuItem
onClick={() => item.onClick(item.isSecondary)}
disabled={item.disabledReason || isDisabled}
whiteSpace={NO_WRAP}
>
{item.setSetting}
</MenuItem>
{item.menuButtons}
</Fragment>
)
Expand Down
11 changes: 7 additions & 4 deletions app/src/organisms/ModuleCard/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ export function useLatchControls(module: AttachedModule): LatchControls {
}
export type MenuItemsByModuleType = {
[moduleType in AttachedModule['moduleType']]: Array<{
setSetting?: string
isSecondary?: boolean
setSetting: string
isSecondary: boolean
menuButtons: JSX.Element[] | null
onClick?: (isSecondary: boolean) => void
onClick: (isSecondary: boolean) => void
}>
}
interface ModuleOverflowMenu {
Expand Down Expand Up @@ -356,7 +356,10 @@ export function useModuleOverflowMenu(
],
absorbanceReaderType: [
{
menuButtons: [aboutModuleBtn],
setSetting: t('overflow_menu_about'),
isSecondary: false,
menuButtons: [],
onClick: handleAboutClick,
},
],
}
Expand Down
15 changes: 7 additions & 8 deletions app/src/organisms/ModuleCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,8 @@ export const ModuleCard = (props: ModuleCardProps): JSX.Element | null => {
const requireModuleCalibration =
isFlex &&
!MODULE_MODELS_OT2_ONLY.some(modModel => modModel === module.moduleModel) &&
module.moduleOffset?.last_modified == null &&
!(module.moduleType === 'absorbanceReaderType')

module.moduleType !== ABSORBANCE_READER_TYPE &&
module.moduleOffset?.last_modified == null
const isPipetteReady =
!Boolean(attachPipetteRequired) &&
!Boolean(calibratePipetteRequired) &&
Expand Down Expand Up @@ -174,7 +173,7 @@ export const ModuleCard = (props: ModuleCardProps): JSX.Element | null => {

let moduleData: JSX.Element = <div></div>
switch (module.moduleType) {
case 'magneticModuleType': {
case MAGNETIC_MODULE_TYPE: {
moduleData = (
<MagneticModuleData
moduleStatus={module.data.status}
Expand All @@ -185,7 +184,7 @@ export const ModuleCard = (props: ModuleCardProps): JSX.Element | null => {
break
}

case 'temperatureModuleType': {
case TEMPERATURE_MODULE_TYPE: {
moduleData = (
<TemperatureModuleData
moduleStatus={module.data.status}
Expand All @@ -196,12 +195,12 @@ export const ModuleCard = (props: ModuleCardProps): JSX.Element | null => {
break
}

case 'thermocyclerModuleType': {
case THERMOCYCLER_MODULE_TYPE: {
moduleData = <ThermocyclerModuleData data={module.data} />
break
}

case 'heaterShakerModuleType': {
case HEATERSHAKER_MODULE_TYPE: {
moduleData = (
<HeaterShakerModuleData
moduleData={module.data}
Expand All @@ -211,7 +210,7 @@ export const ModuleCard = (props: ModuleCardProps): JSX.Element | null => {
break
}

case 'absorbanceReaderType': {
case ABSORBANCE_READER_TYPE: {
moduleData = <AbsorbanceReaderData moduleData={module.data} />
break
}
Expand Down
1 change: 1 addition & 0 deletions app/src/redux/modules/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export {
TEMPERATURE_MODULE_TYPE,
THERMOCYCLER_MODULE_TYPE,
HEATERSHAKER_MODULE_TYPE,
ABSORBANCE_READER_TYPE,
} from '@opentrons/shared-data'

// http paths
Expand Down

0 comments on commit 673e80d

Please sign in to comment.