From 5a01be974d3611b3fca28a297dc48dcb6a39100a Mon Sep 17 00:00:00 2001 From: Jethary Date: Tue, 24 Oct 2023 22:02:44 -0400 Subject: [PATCH] clean up nested ternery --- .../top-selectors/labware-locations/index.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/protocol-designer/src/top-selectors/labware-locations/index.ts b/protocol-designer/src/top-selectors/labware-locations/index.ts index 2167acdb8ac..5db5f8f7509 100644 --- a/protocol-designer/src/top-selectors/labware-locations/index.ts +++ b/protocol-designer/src/top-selectors/labware-locations/index.ts @@ -142,6 +142,12 @@ export const getUnocuppiedLabwareLocationOptions: Selector< const modSlot = modIdWithAdapter != null ? modules[modIdWithAdapter].slot : null const isAdapter = getIsAdapter(labwareId, labwareEntities) + const moduleUnderAdapter = + modIdWithAdapter != null + ? getModuleDisplayName(moduleEntities[modIdWithAdapter].model) + : 'unknown module' + const moduleSlotInfo = modSlot ?? 'unknown slot' + const adapterSlotInfo = adapterSlot ?? 'unknown adapter' return labwareOnAdapter == null && isAdapter ? [ @@ -149,16 +155,8 @@ export const getUnocuppiedLabwareLocationOptions: Selector< { name: modIdWithAdapter != null - ? `${adapterDisplayName} on top of ${ - modIdWithAdapter != null - ? getModuleDisplayName( - moduleEntities[modIdWithAdapter].model - ) - : 'unknown module' - } in slot ${modSlot ?? 'unknown slot'}` - : `${adapterDisplayName} on slot ${ - adapterSlot ?? 'unknown' - }`, + ? `${adapterDisplayName} on top of ${moduleUnderAdapter} in slot ${moduleSlotInfo}` + : `${adapterDisplayName} on slot ${adapterSlotInfo}`, value: labwareId, }, ]