diff --git a/app/src/organisms/LabwareDetails/images/agilent_1_reservoir_290ml_side_view.jpg b/app/src/assets/images/labware/agilent_1_reservoir_290ml_side_view.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/agilent_1_reservoir_290ml_side_view.jpg rename to app/src/assets/images/labware/agilent_1_reservoir_290ml_side_view.jpg diff --git a/app/src/organisms/LabwareDetails/images/appliedbiosystemsmicroamp_384_wellplate_40ul.jpg b/app/src/assets/images/labware/appliedbiosystemsmicroamp_384_wellplate_40ul.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/appliedbiosystemsmicroamp_384_wellplate_40ul.jpg rename to app/src/assets/images/labware/appliedbiosystemsmicroamp_384_wellplate_40ul.jpg diff --git a/app/src/organisms/LabwareDetails/images/axygen_1_reservoir_90ml_side_view.jpg b/app/src/assets/images/labware/axygen_1_reservoir_90ml_side_view.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/axygen_1_reservoir_90ml_side_view.jpg rename to app/src/assets/images/labware/axygen_1_reservoir_90ml_side_view.jpg diff --git a/app/src/organisms/LabwareDetails/images/biorad_384_wellplate_50ul.jpg b/app/src/assets/images/labware/biorad_384_wellplate_50ul.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/biorad_384_wellplate_50ul.jpg rename to app/src/assets/images/labware/biorad_384_wellplate_50ul.jpg diff --git a/app/src/organisms/LabwareDetails/images/biorad_96_wellplate_200ul_pcr_photo_three_quarters.jpg b/app/src/assets/images/labware/biorad_96_wellplate_200ul_pcr_photo_three_quarters.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/biorad_96_wellplate_200ul_pcr_photo_three_quarters.jpg rename to app/src/assets/images/labware/biorad_96_wellplate_200ul_pcr_photo_three_quarters.jpg diff --git a/app/src/organisms/LabwareDetails/images/circularWell.svg b/app/src/assets/images/labware/circularWell.svg similarity index 100% rename from app/src/organisms/LabwareDetails/images/circularWell.svg rename to app/src/assets/images/labware/circularWell.svg diff --git a/app/src/organisms/LabwareDetails/images/corning_12_wellplate_6.9ml_flat_photo_three_quarters.jpg b/app/src/assets/images/labware/corning_12_wellplate_6.9ml_flat_photo_three_quarters.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/corning_12_wellplate_6.9ml_flat_photo_three_quarters.jpg rename to app/src/assets/images/labware/corning_12_wellplate_6.9ml_flat_photo_three_quarters.jpg diff --git a/app/src/organisms/LabwareDetails/images/corning_24_wellplate_3.4ml_flat_photo_three_quarters.jpg b/app/src/assets/images/labware/corning_24_wellplate_3.4ml_flat_photo_three_quarters.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/corning_24_wellplate_3.4ml_flat_photo_three_quarters.jpg rename to app/src/assets/images/labware/corning_24_wellplate_3.4ml_flat_photo_three_quarters.jpg diff --git a/app/src/organisms/LabwareDetails/images/corning_384_wellplate_112ul_flat_photo_three_quarters.jpg b/app/src/assets/images/labware/corning_384_wellplate_112ul_flat_photo_three_quarters.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/corning_384_wellplate_112ul_flat_photo_three_quarters.jpg rename to app/src/assets/images/labware/corning_384_wellplate_112ul_flat_photo_three_quarters.jpg diff --git a/app/src/organisms/LabwareDetails/images/corning_48_wellplate_1.6ml_flat_photo_three_quarters.jpg b/app/src/assets/images/labware/corning_48_wellplate_1.6ml_flat_photo_three_quarters.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/corning_48_wellplate_1.6ml_flat_photo_three_quarters.jpg rename to app/src/assets/images/labware/corning_48_wellplate_1.6ml_flat_photo_three_quarters.jpg diff --git a/app/src/organisms/LabwareDetails/images/corning_6_wellplate_16.8ml_flat_photo_three_quarters.jpg b/app/src/assets/images/labware/corning_6_wellplate_16.8ml_flat_photo_three_quarters.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/corning_6_wellplate_16.8ml_flat_photo_three_quarters.jpg rename to app/src/assets/images/labware/corning_6_wellplate_16.8ml_flat_photo_three_quarters.jpg diff --git a/app/src/organisms/LabwareDetails/images/corning_96_wellplate_360ul_flat_three_quarters.jpg b/app/src/assets/images/labware/corning_96_wellplate_360ul_flat_three_quarters.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/corning_96_wellplate_360ul_flat_three_quarters.jpg rename to app/src/assets/images/labware/corning_96_wellplate_360ul_flat_three_quarters.jpg diff --git a/app/src/organisms/LabwareDetails/images/deep_well_plate_adapter.jpg b/app/src/assets/images/labware/deep_well_plate_adapter.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/deep_well_plate_adapter.jpg rename to app/src/assets/images/labware/deep_well_plate_adapter.jpg diff --git a/app/src/organisms/LabwareDetails/images/eppendorf_1.5ml_safelock_snapcap_tube.jpg b/app/src/assets/images/labware/eppendorf_1.5ml_safelock_snapcap_tube.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/eppendorf_1.5ml_safelock_snapcap_tube.jpg rename to app/src/assets/images/labware/eppendorf_1.5ml_safelock_snapcap_tube.jpg diff --git a/app/src/organisms/LabwareDetails/images/eppendorf_2ml_safelock_snapcap_tube.jpg b/app/src/assets/images/labware/eppendorf_2ml_safelock_snapcap_tube.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/eppendorf_2ml_safelock_snapcap_tube.jpg rename to app/src/assets/images/labware/eppendorf_2ml_safelock_snapcap_tube.jpg diff --git a/app/src/organisms/LabwareDetails/images/falcon_15ml_conical_tube.jpg b/app/src/assets/images/labware/falcon_15ml_conical_tube.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/falcon_15ml_conical_tube.jpg rename to app/src/assets/images/labware/falcon_15ml_conical_tube.jpg diff --git a/app/src/organisms/LabwareDetails/images/falcon_50ml_15ml_conical_tubes.jpg b/app/src/assets/images/labware/falcon_50ml_15ml_conical_tubes.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/falcon_50ml_15ml_conical_tubes.jpg rename to app/src/assets/images/labware/falcon_50ml_15ml_conical_tubes.jpg diff --git a/app/src/organisms/LabwareDetails/images/falcon_50ml_conical_tube.jpg b/app/src/assets/images/labware/falcon_50ml_conical_tube.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/falcon_50ml_conical_tube.jpg rename to app/src/assets/images/labware/falcon_50ml_conical_tube.jpg diff --git a/app/src/organisms/LabwareDetails/images/favicon.ico b/app/src/assets/images/labware/favicon.ico similarity index 100% rename from app/src/organisms/LabwareDetails/images/favicon.ico rename to app/src/assets/images/labware/favicon.ico diff --git a/app/src/organisms/LabwareDetails/images/flat_bottom_aluminum.png b/app/src/assets/images/labware/flat_bottom_aluminum.png similarity index 100% rename from app/src/organisms/LabwareDetails/images/flat_bottom_aluminum.png rename to app/src/assets/images/labware/flat_bottom_aluminum.png diff --git a/app/src/organisms/LabwareDetails/images/flat_bottom_plate_adapter.jpg b/app/src/assets/images/labware/flat_bottom_plate_adapter.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/flat_bottom_plate_adapter.jpg rename to app/src/assets/images/labware/flat_bottom_plate_adapter.jpg diff --git a/app/src/organisms/LabwareDetails/images/geb_1000ul_tip_side_view.jpg b/app/src/assets/images/labware/geb_1000ul_tip_side_view.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/geb_1000ul_tip_side_view.jpg rename to app/src/assets/images/labware/geb_1000ul_tip_side_view.jpg diff --git a/app/src/organisms/LabwareDetails/images/geb_10ul_tip_side_view.jpg b/app/src/assets/images/labware/geb_10ul_tip_side_view.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/geb_10ul_tip_side_view.jpg rename to app/src/assets/images/labware/geb_10ul_tip_side_view.jpg diff --git a/app/src/organisms/LabwareDetails/images/generic_2ml_screwcap_tube.jpg b/app/src/assets/images/labware/generic_2ml_screwcap_tube.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/generic_2ml_screwcap_tube.jpg rename to app/src/assets/images/labware/generic_2ml_screwcap_tube.jpg diff --git a/app/src/organisms/LabwareDetails/images/generic_pcr_strip_200ul_tubes.jpg b/app/src/assets/images/labware/generic_pcr_strip_200ul_tubes.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/generic_pcr_strip_200ul_tubes.jpg rename to app/src/assets/images/labware/generic_pcr_strip_200ul_tubes.jpg diff --git a/app/src/organisms/LabwareDetails/images/nest_0.5ml_screwcap_tube.jpg b/app/src/assets/images/labware/nest_0.5ml_screwcap_tube.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/nest_0.5ml_screwcap_tube.jpg rename to app/src/assets/images/labware/nest_0.5ml_screwcap_tube.jpg diff --git a/app/src/organisms/LabwareDetails/images/nest_1.5ml_screwcap_tube.jpg b/app/src/assets/images/labware/nest_1.5ml_screwcap_tube.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/nest_1.5ml_screwcap_tube.jpg rename to app/src/assets/images/labware/nest_1.5ml_screwcap_tube.jpg diff --git a/app/src/organisms/LabwareDetails/images/nest_1.5ml_snapcap_tube.jpg b/app/src/assets/images/labware/nest_1.5ml_snapcap_tube.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/nest_1.5ml_snapcap_tube.jpg rename to app/src/assets/images/labware/nest_1.5ml_snapcap_tube.jpg diff --git a/app/src/organisms/LabwareDetails/images/nest_12_reservoir_15ml_three_quarters.jpg b/app/src/assets/images/labware/nest_12_reservoir_15ml_three_quarters.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/nest_12_reservoir_15ml_three_quarters.jpg rename to app/src/assets/images/labware/nest_12_reservoir_15ml_three_quarters.jpg diff --git a/app/src/organisms/LabwareDetails/images/nest_15ml_conical_tube.jpg b/app/src/assets/images/labware/nest_15ml_conical_tube.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/nest_15ml_conical_tube.jpg rename to app/src/assets/images/labware/nest_15ml_conical_tube.jpg diff --git a/app/src/organisms/LabwareDetails/images/nest_1_reservoir_195ml_three_quarters.jpg b/app/src/assets/images/labware/nest_1_reservoir_195ml_three_quarters.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/nest_1_reservoir_195ml_three_quarters.jpg rename to app/src/assets/images/labware/nest_1_reservoir_195ml_three_quarters.jpg diff --git a/app/src/organisms/LabwareDetails/images/nest_1_reservoir_290ml.jpg b/app/src/assets/images/labware/nest_1_reservoir_290ml.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/nest_1_reservoir_290ml.jpg rename to app/src/assets/images/labware/nest_1_reservoir_290ml.jpg diff --git a/app/src/organisms/LabwareDetails/images/nest_2ml_screwcap_tube.jpg b/app/src/assets/images/labware/nest_2ml_screwcap_tube.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/nest_2ml_screwcap_tube.jpg rename to app/src/assets/images/labware/nest_2ml_screwcap_tube.jpg diff --git a/app/src/organisms/LabwareDetails/images/nest_2ml_snapcap_tube.jpg b/app/src/assets/images/labware/nest_2ml_snapcap_tube.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/nest_2ml_snapcap_tube.jpg rename to app/src/assets/images/labware/nest_2ml_snapcap_tube.jpg diff --git a/app/src/organisms/LabwareDetails/images/nest_50ml_15ml_conical_tubes.jpg b/app/src/assets/images/labware/nest_50ml_15ml_conical_tubes.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/nest_50ml_15ml_conical_tubes.jpg rename to app/src/assets/images/labware/nest_50ml_15ml_conical_tubes.jpg diff --git a/app/src/organisms/LabwareDetails/images/nest_50ml_conical_tube.jpg b/app/src/assets/images/labware/nest_50ml_conical_tube.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/nest_50ml_conical_tube.jpg rename to app/src/assets/images/labware/nest_50ml_conical_tube.jpg diff --git a/app/src/organisms/LabwareDetails/images/nest_96_wellplate_100ul_pcr_full_skirt_three_quarters.jpg b/app/src/assets/images/labware/nest_96_wellplate_100ul_pcr_full_skirt_three_quarters.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/nest_96_wellplate_100ul_pcr_full_skirt_three_quarters.jpg rename to app/src/assets/images/labware/nest_96_wellplate_100ul_pcr_full_skirt_three_quarters.jpg diff --git a/app/src/organisms/LabwareDetails/images/nest_96_wellplate_200ul_flat_three_quarters.jpg b/app/src/assets/images/labware/nest_96_wellplate_200ul_flat_three_quarters.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/nest_96_wellplate_200ul_flat_three_quarters.jpg rename to app/src/assets/images/labware/nest_96_wellplate_200ul_flat_three_quarters.jpg diff --git a/app/src/organisms/LabwareDetails/images/nest_96_wellplate_2ml_deep.jpg b/app/src/assets/images/labware/nest_96_wellplate_2ml_deep.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/nest_96_wellplate_2ml_deep.jpg rename to app/src/assets/images/labware/nest_96_wellplate_2ml_deep.jpg diff --git a/app/src/organisms/LabwareDetails/images/opentrons_10_tuberack_4_6_side_view.jpg b/app/src/assets/images/labware/opentrons_10_tuberack_4_6_side_view.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/opentrons_10_tuberack_4_6_side_view.jpg rename to app/src/assets/images/labware/opentrons_10_tuberack_4_6_side_view.jpg diff --git a/app/src/organisms/LabwareDetails/images/opentrons_15_tuberack_side_view.jpg b/app/src/assets/images/labware/opentrons_15_tuberack_side_view.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/opentrons_15_tuberack_side_view.jpg rename to app/src/assets/images/labware/opentrons_15_tuberack_side_view.jpg diff --git a/app/src/organisms/LabwareDetails/images/opentrons_24_aluminumblock_side_view.jpg b/app/src/assets/images/labware/opentrons_24_aluminumblock_side_view.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/opentrons_24_aluminumblock_side_view.jpg rename to app/src/assets/images/labware/opentrons_24_aluminumblock_side_view.jpg diff --git a/app/src/organisms/LabwareDetails/images/opentrons_24_tuberack_side_view.jpg b/app/src/assets/images/labware/opentrons_24_tuberack_side_view.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/opentrons_24_tuberack_side_view.jpg rename to app/src/assets/images/labware/opentrons_24_tuberack_side_view.jpg diff --git a/app/src/organisms/LabwareDetails/images/opentrons_6_tuberack_side_view.jpg b/app/src/assets/images/labware/opentrons_6_tuberack_side_view.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/opentrons_6_tuberack_side_view.jpg rename to app/src/assets/images/labware/opentrons_6_tuberack_side_view.jpg diff --git a/app/src/organisms/LabwareDetails/images/opentrons_96_aluminumblock_side_view.jpg b/app/src/assets/images/labware/opentrons_96_aluminumblock_side_view.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/opentrons_96_aluminumblock_side_view.jpg rename to app/src/assets/images/labware/opentrons_96_aluminumblock_side_view.jpg diff --git a/app/src/organisms/LabwareDetails/images/opentrons_96_deep_well_temp_mod_adapter.png b/app/src/assets/images/labware/opentrons_96_deep_well_temp_mod_adapter.png similarity index 100% rename from app/src/organisms/LabwareDetails/images/opentrons_96_deep_well_temp_mod_adapter.png rename to app/src/assets/images/labware/opentrons_96_deep_well_temp_mod_adapter.png diff --git a/app/src/organisms/LabwareDetails/images/opentrons_flat_aluminumblock_side_view.jpg b/app/src/assets/images/labware/opentrons_flat_aluminumblock_side_view.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/opentrons_flat_aluminumblock_side_view.jpg rename to app/src/assets/images/labware/opentrons_flat_aluminumblock_side_view.jpg diff --git a/app/src/organisms/LabwareDetails/images/pcr_plate_adapter.jpg b/app/src/assets/images/labware/pcr_plate_adapter.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/pcr_plate_adapter.jpg rename to app/src/assets/images/labware/pcr_plate_adapter.jpg diff --git a/app/src/organisms/LabwareDetails/images/rectangularWell.svg b/app/src/assets/images/labware/rectangularWell.svg similarity index 100% rename from app/src/organisms/LabwareDetails/images/rectangularWell.svg rename to app/src/assets/images/labware/rectangularWell.svg diff --git a/app/src/organisms/LabwareDetails/images/thermoscientificnunc_96_wellplate_1300ul.jpg b/app/src/assets/images/labware/thermoscientificnunc_96_wellplate_1300ul.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/thermoscientificnunc_96_wellplate_1300ul.jpg rename to app/src/assets/images/labware/thermoscientificnunc_96_wellplate_1300ul.jpg diff --git a/app/src/organisms/LabwareDetails/images/thermoscientificnunc_96_wellplate_2000ul.jpg b/app/src/assets/images/labware/thermoscientificnunc_96_wellplate_2000ul.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/thermoscientificnunc_96_wellplate_2000ul.jpg rename to app/src/assets/images/labware/thermoscientificnunc_96_wellplate_2000ul.jpg diff --git a/app/src/organisms/LabwareDetails/images/tipone_200ul_tip_side_view.jpg b/app/src/assets/images/labware/tipone_200ul_tip_side_view.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/tipone_200ul_tip_side_view.jpg rename to app/src/assets/images/labware/tipone_200ul_tip_side_view.jpg diff --git a/app/src/assets/images/labware/tipone_96_tiprack_200ul_side_view.jpg b/app/src/assets/images/labware/tipone_96_tiprack_200ul_side_view.jpg old mode 100755 new mode 100644 diff --git a/app/src/organisms/LabwareDetails/images/universal_flat_adapter.jpg b/app/src/assets/images/labware/universal_flat_adapter.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/universal_flat_adapter.jpg rename to app/src/assets/images/labware/universal_flat_adapter.jpg diff --git a/app/src/organisms/LabwareDetails/images/usascientific_12_reservoir_22ml_side_view.jpg b/app/src/assets/images/labware/usascientific_12_reservoir_22ml_side_view.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/usascientific_12_reservoir_22ml_side_view.jpg rename to app/src/assets/images/labware/usascientific_12_reservoir_22ml_side_view.jpg diff --git a/app/src/organisms/LabwareDetails/images/usascientific_96_wellplate_2.4ml_deep_side_view.jpg b/app/src/assets/images/labware/usascientific_96_wellplate_2.4ml_deep_side_view.jpg similarity index 100% rename from app/src/organisms/LabwareDetails/images/usascientific_96_wellplate_2.4ml_deep_side_view.jpg rename to app/src/assets/images/labware/usascientific_96_wellplate_2.4ml_deep_side_view.jpg diff --git a/app/src/organisms/LabwareDetails/images/wellShapeFlat.svg b/app/src/assets/images/labware/wellShapeFlat.svg similarity index 100% rename from app/src/organisms/LabwareDetails/images/wellShapeFlat.svg rename to app/src/assets/images/labware/wellShapeFlat.svg diff --git a/app/src/organisms/LabwareDetails/images/wellShapeU.svg b/app/src/assets/images/labware/wellShapeU.svg similarity index 100% rename from app/src/organisms/LabwareDetails/images/wellShapeU.svg rename to app/src/assets/images/labware/wellShapeU.svg diff --git a/app/src/organisms/LabwareDetails/images/wellShapeV.svg b/app/src/assets/images/labware/wellShapeV.svg similarity index 100% rename from app/src/organisms/LabwareDetails/images/wellShapeV.svg rename to app/src/assets/images/labware/wellShapeV.svg diff --git a/app/src/local-resources/labware/hooks/index.ts b/app/src/local-resources/labware/hooks/index.ts new file mode 100644 index 00000000000..86c1116e270 --- /dev/null +++ b/app/src/local-resources/labware/hooks/index.ts @@ -0,0 +1 @@ +export * from './useAllLabware' diff --git a/app/src/local-resources/labware/hooks/useAllLabware.ts b/app/src/local-resources/labware/hooks/useAllLabware.ts new file mode 100644 index 00000000000..28d4325b2eb --- /dev/null +++ b/app/src/local-resources/labware/hooks/useAllLabware.ts @@ -0,0 +1,50 @@ +import { useSelector } from 'react-redux' +import { getValidCustomLabware } from '/app/redux/custom-labware' +import { getAllDefinitions } from '../utils' +import type { LabwareSort, LabwareFilter, LabwareDefAndDate } from '../types' + +export function useAllLabware( + sortBy: LabwareSort, + filterBy: LabwareFilter +): LabwareDefAndDate[] { + const fullLabwareList: LabwareDefAndDate[] = [] + const labwareDefinitions = getAllDefinitions() + labwareDefinitions.forEach(def => fullLabwareList.push({ definition: def })) + const customLabwareList = useSelector(getValidCustomLabware) + customLabwareList.forEach(customLabware => + 'definition' in customLabware + ? fullLabwareList.push({ + modified: customLabware.modified, + definition: customLabware.definition, + filename: customLabware.filename, + }) + : null + ) + const sortLabware = (a: LabwareDefAndDate, b: LabwareDefAndDate): number => { + if ( + a.definition.metadata.displayName.toUpperCase() < + b.definition.metadata.displayName.toUpperCase() + ) { + return sortBy === 'alphabetical' ? -1 : 1 + } + if ( + a.definition.metadata.displayName.toUpperCase() > + b.definition.metadata.displayName.toUpperCase() + ) { + return sortBy === 'alphabetical' ? 1 : -1 + } + return 0 + } + + if (filterBy === 'customLabware') { + return (customLabwareList as LabwareDefAndDate[]).sort(sortLabware) + } + fullLabwareList.sort(sortLabware) + if (filterBy !== 'all') { + return fullLabwareList.filter( + labwareItem => + labwareItem.definition.metadata.displayCategory === filterBy + ) + } + return fullLabwareList +} diff --git a/app/src/local-resources/labware/index.ts b/app/src/local-resources/labware/index.ts new file mode 100644 index 00000000000..505591b2909 --- /dev/null +++ b/app/src/local-resources/labware/index.ts @@ -0,0 +1,3 @@ +export * from './hooks' +export * from './utils' +export type * from './types' diff --git a/app/src/pages/Desktop/Labware/types.ts b/app/src/local-resources/labware/types.ts similarity index 66% rename from app/src/pages/Desktop/Labware/types.ts rename to app/src/local-resources/labware/types.ts index 24696b11844..99ea299573d 100644 --- a/app/src/pages/Desktop/Labware/types.ts +++ b/app/src/local-resources/labware/types.ts @@ -5,35 +5,12 @@ import type { LabwareBrand, } from '@opentrons/shared-data' -export type { - LabwareDefinition2 as LabwareDefinition, - LabwareParameters, - LabwareOffset, - LabwareWell, - LabwareWellShapeProperties, - LabwareWellProperties, - LabwareWellMap, - LabwareWellGroupMetadata, - LabwareVolumeUnits, - LabwareDisplayCategory, - LabwareBrand, -} from '@opentrons/shared-data' - -export interface LabwareWellGroupProperties { - xOffsetFromLeft: number - yOffsetFromTop: number - xSpacing: number | null - ySpacing: number | null - wellCount: number - shape: LabwareWellShapeProperties | null - depth: number | null - totalLiquidVolume: number | null - metadata: LabwareWellGroupMetadata - brand: LabwareBrand | null +export interface LabwareDefAndDate { + definition: LabwareDefinition + modified?: number + filename?: string } -export type LabwareList = LabwareDefinition[] - export type LabwareFilter = | 'all' | 'wellPlate' @@ -45,3 +22,16 @@ export type LabwareFilter = | 'adapter' export type LabwareSort = 'alphabetical' | 'reverse' + +export interface LabwareWellGroupProperties { + xOffsetFromLeft: number + yOffsetFromTop: number + xSpacing: number | null + ySpacing: number | null + wellCount: number + shape: LabwareWellShapeProperties | null + depth: number | null + totalLiquidVolume: number | null + metadata: LabwareWellGroupMetadata + brand: LabwareBrand | null +} diff --git a/app/src/pages/Desktop/Labware/helpers/__mocks__/getAllDefs.ts b/app/src/local-resources/labware/utils/__mocks__/getAllDefs.ts similarity index 100% rename from app/src/pages/Desktop/Labware/helpers/__mocks__/getAllDefs.ts rename to app/src/local-resources/labware/utils/__mocks__/getAllDefs.ts diff --git a/app/src/pages/Desktop/Labware/helpers/definitions.ts b/app/src/local-resources/labware/utils/getAllDefinitions.ts similarity index 97% rename from app/src/pages/Desktop/Labware/helpers/definitions.ts rename to app/src/local-resources/labware/utils/getAllDefinitions.ts index bab954a8151..db25fde06a1 100644 --- a/app/src/pages/Desktop/Labware/helpers/definitions.ts +++ b/app/src/local-resources/labware/utils/getAllDefinitions.ts @@ -1,9 +1,9 @@ import groupBy from 'lodash/groupBy' import { LABWAREV2_DO_NOT_LIST } from '@opentrons/shared-data' -import { getAllDefs } from './getAllDefs' import type { LabwareDefinition2 } from '@opentrons/shared-data' +import { getAllDefs } from './getAllDefs' -const getOnlyLatestDefs = ( +export const getOnlyLatestDefs = ( labwareList: LabwareDefinition2[] ): LabwareDefinition2[] => { // group by namespace + loadName diff --git a/app/src/pages/Desktop/Labware/helpers/getAllDefs.ts b/app/src/local-resources/labware/utils/getAllDefs.ts similarity index 100% rename from app/src/pages/Desktop/Labware/helpers/getAllDefs.ts rename to app/src/local-resources/labware/utils/getAllDefs.ts diff --git a/app/src/local-resources/labware/utils/index.ts b/app/src/local-resources/labware/utils/index.ts new file mode 100644 index 00000000000..f1368b03c6f --- /dev/null +++ b/app/src/local-resources/labware/utils/index.ts @@ -0,0 +1 @@ +export * from './getAllDefinitions' diff --git a/app/src/organisms/AddCustomLabwareSlideout/__tests__/AddCustomLabwareSlideout.test.tsx b/app/src/organisms/Desktop/Labware/AddCustomLabwareSlideout/__tests__/AddCustomLabwareSlideout.test.tsx similarity index 96% rename from app/src/organisms/AddCustomLabwareSlideout/__tests__/AddCustomLabwareSlideout.test.tsx rename to app/src/organisms/Desktop/Labware/AddCustomLabwareSlideout/__tests__/AddCustomLabwareSlideout.test.tsx index 9ae38c45961..451e63491fd 100644 --- a/app/src/organisms/AddCustomLabwareSlideout/__tests__/AddCustomLabwareSlideout.test.tsx +++ b/app/src/organisms/Desktop/Labware/AddCustomLabwareSlideout/__tests__/AddCustomLabwareSlideout.test.tsx @@ -11,7 +11,7 @@ import { renderWithProviders } from '/app/__testing-utils__' import { AddCustomLabwareSlideout } from '..' vi.mock('/app/redux/custom-labware') -vi.mock('/app/pages/Desktop/Labware/helpers/getAllDefs') +vi.mock('/app/local-resources/labware') vi.mock('/app/redux/analytics') let mockTrackEvent: any diff --git a/app/src/organisms/AddCustomLabwareSlideout/index.tsx b/app/src/organisms/Desktop/Labware/AddCustomLabwareSlideout/index.tsx similarity index 100% rename from app/src/organisms/AddCustomLabwareSlideout/index.tsx rename to app/src/organisms/Desktop/Labware/AddCustomLabwareSlideout/index.tsx diff --git a/app/src/organisms/LabwareCard/CustomLabwareOverflowMenu.tsx b/app/src/organisms/Desktop/Labware/LabwareCard/CustomLabwareOverflowMenu.tsx similarity index 99% rename from app/src/organisms/LabwareCard/CustomLabwareOverflowMenu.tsx rename to app/src/organisms/Desktop/Labware/LabwareCard/CustomLabwareOverflowMenu.tsx index 13dfb3f3804..6183fdf00de 100644 --- a/app/src/organisms/LabwareCard/CustomLabwareOverflowMenu.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareCard/CustomLabwareOverflowMenu.tsx @@ -30,7 +30,7 @@ import { } from '@opentrons/components' import { Divider } from '/app/atoms/structure' -import { getTopPortalEl } from '../../App/portal' +import { getTopPortalEl } from '/app/App/portal' import { deleteCustomLabwareFile, openCustomLabwareDirectory, diff --git a/app/src/organisms/LabwareCard/__tests__/CustomLabwareOverflowMenu.test.tsx b/app/src/organisms/Desktop/Labware/LabwareCard/__tests__/CustomLabwareOverflowMenu.test.tsx similarity index 100% rename from app/src/organisms/LabwareCard/__tests__/CustomLabwareOverflowMenu.test.tsx rename to app/src/organisms/Desktop/Labware/LabwareCard/__tests__/CustomLabwareOverflowMenu.test.tsx diff --git a/app/src/organisms/LabwareCard/__tests__/LabwareCard.test.tsx b/app/src/organisms/Desktop/Labware/LabwareCard/__tests__/LabwareCard.test.tsx similarity index 94% rename from app/src/organisms/LabwareCard/__tests__/LabwareCard.test.tsx rename to app/src/organisms/Desktop/Labware/LabwareCard/__tests__/LabwareCard.test.tsx index 652d89386a5..35423948e56 100644 --- a/app/src/organisms/LabwareCard/__tests__/LabwareCard.test.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareCard/__tests__/LabwareCard.test.tsx @@ -3,14 +3,14 @@ import { screen } from '@testing-library/react' import { describe, it, vi, beforeEach } from 'vitest' import { renderWithProviders, nestedTextMatcher } from '/app/__testing-utils__' import { i18n } from '/app/i18n' -import { useAllLabware } from '/app/pages/Desktop/Labware/hooks' +import { useAllLabware } from '/app/local-resources/labware' import { mockDefinition } from '/app/redux/custom-labware/__fixtures__' import { CustomLabwareOverflowMenu } from '../CustomLabwareOverflowMenu' import { LabwareCard } from '..' import type * as OpentronsComponents from '@opentrons/components' -vi.mock('/app/pages/Desktop/Labware/hooks') +vi.mock('/app/local-resources/labware') vi.mock('../CustomLabwareOverflowMenu') vi.mock('@opentrons/components', async importOriginal => { diff --git a/app/src/organisms/LabwareCard/hooks.tsx b/app/src/organisms/Desktop/Labware/LabwareCard/hooks.tsx similarity index 100% rename from app/src/organisms/LabwareCard/hooks.tsx rename to app/src/organisms/Desktop/Labware/LabwareCard/hooks.tsx diff --git a/app/src/organisms/LabwareCard/index.tsx b/app/src/organisms/Desktop/Labware/LabwareCard/index.tsx similarity index 98% rename from app/src/organisms/LabwareCard/index.tsx rename to app/src/organisms/Desktop/Labware/LabwareCard/index.tsx index 35af480c91f..b94f088d87a 100644 --- a/app/src/organisms/LabwareCard/index.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareCard/index.tsx @@ -23,7 +23,7 @@ import { import { UNIVERSAL_FLAT_ADAPTER_X_DIMENSION } from '../LabwareDetails/Gallery' import { CustomLabwareOverflowMenu } from './CustomLabwareOverflowMenu' -import type { LabwareDefAndDate } from '/app/pages/Desktop/Labware/hooks' +import type { LabwareDefAndDate } from '/app/local-resources/labware' export interface LabwareCardProps { labware: LabwareDefAndDate diff --git a/app/src/organisms/LabwareDetails/Dimensions.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/Dimensions.tsx similarity index 94% rename from app/src/organisms/LabwareDetails/Dimensions.tsx rename to app/src/organisms/Desktop/Labware/LabwareDetails/Dimensions.tsx index c0f5fc18d20..61e3cd422d5 100644 --- a/app/src/organisms/LabwareDetails/Dimensions.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareDetails/Dimensions.tsx @@ -4,7 +4,7 @@ import round from 'lodash/round' import { Box, SPACING, getFootprintDiagram } from '@opentrons/components' import { LabeledValue } from './StyledComponents/LabeledValue' import { ExpandingTitle } from './StyledComponents/ExpandingTitle' -import type { LabwareDefinition } from '/app/pages/Desktop/Labware/types' +import type { LabwareDefinition2 as LabwareDefinition } from '@opentrons/shared-data' const toFixed = (n: number): string => round(n, 2).toFixed(2) diff --git a/app/src/organisms/LabwareDetails/Gallery.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/Gallery.tsx similarity index 96% rename from app/src/organisms/LabwareDetails/Gallery.tsx rename to app/src/organisms/Desktop/Labware/LabwareDetails/Gallery.tsx index 3feddb482c5..ca5f7b89de6 100644 --- a/app/src/organisms/LabwareDetails/Gallery.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareDetails/Gallery.tsx @@ -11,9 +11,10 @@ import { SPACING_AUTO, SPACING, } from '@opentrons/components' + import { labwareImages } from './labware-images' -import type { LabwareDefinition } from '/app/pages/Desktop/Labware/types' +import type { LabwareDefinition2 as LabwareDefinition } from '@opentrons/shared-data' export const UNIVERSAL_FLAT_ADAPTER_X_DIMENSION = 127.4 diff --git a/app/src/organisms/LabwareDetails/InsertDetails.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/InsertDetails.tsx similarity index 95% rename from app/src/organisms/LabwareDetails/InsertDetails.tsx rename to app/src/organisms/Desktop/Labware/LabwareDetails/InsertDetails.tsx index 705c6f7b49d..93035580764 100644 --- a/app/src/organisms/LabwareDetails/InsertDetails.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareDetails/InsertDetails.tsx @@ -12,7 +12,7 @@ import { WellProperties } from './WellProperties' import { WellDimensions } from './WellDimensions' import { ManufacturerDetails } from './ManufacturerDetails' -import type { LabwareDefinition } from '/app/pages/Desktop/Labware/types' +import type { LabwareDefinition2 as LabwareDefinition } from '@opentrons/shared-data' export interface InsertDetailsProps { definition: LabwareDefinition diff --git a/app/src/organisms/LabwareDetails/ManufacturerDetails.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/ManufacturerDetails.tsx similarity index 96% rename from app/src/organisms/LabwareDetails/ManufacturerDetails.tsx rename to app/src/organisms/Desktop/Labware/LabwareDetails/ManufacturerDetails.tsx index bacccd4a951..7f0443f50b1 100644 --- a/app/src/organisms/LabwareDetails/ManufacturerDetails.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareDetails/ManufacturerDetails.tsx @@ -12,7 +12,7 @@ import { SPACING, LegacyStyledText, } from '@opentrons/components' -import type { LabwareBrand } from '/app/pages/Desktop/Labware/types' +import type { LabwareBrand } from '@opentrons/shared-data' export interface ManufacturerDetailsProps { brand: LabwareBrand diff --git a/app/src/organisms/LabwareDetails/StyledComponents/ExpandingTitle.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/StyledComponents/ExpandingTitle.tsx similarity index 100% rename from app/src/organisms/LabwareDetails/StyledComponents/ExpandingTitle.tsx rename to app/src/organisms/Desktop/Labware/LabwareDetails/StyledComponents/ExpandingTitle.tsx diff --git a/app/src/organisms/LabwareDetails/StyledComponents/LabeledValue.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/StyledComponents/LabeledValue.tsx similarity index 100% rename from app/src/organisms/LabwareDetails/StyledComponents/LabeledValue.tsx rename to app/src/organisms/Desktop/Labware/LabwareDetails/StyledComponents/LabeledValue.tsx diff --git a/app/src/organisms/LabwareDetails/StyledComponents/__tests__/ExpandingTitle.test.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/StyledComponents/__tests__/ExpandingTitle.test.tsx similarity index 100% rename from app/src/organisms/LabwareDetails/StyledComponents/__tests__/ExpandingTitle.test.tsx rename to app/src/organisms/Desktop/Labware/LabwareDetails/StyledComponents/__tests__/ExpandingTitle.test.tsx diff --git a/app/src/organisms/LabwareDetails/StyledComponents/__tests__/LabeledValue.test.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/StyledComponents/__tests__/LabeledValue.test.tsx similarity index 100% rename from app/src/organisms/LabwareDetails/StyledComponents/__tests__/LabeledValue.test.tsx rename to app/src/organisms/Desktop/Labware/LabwareDetails/StyledComponents/__tests__/LabeledValue.test.tsx diff --git a/app/src/organisms/LabwareDetails/WellCount.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/WellCount.tsx similarity index 100% rename from app/src/organisms/LabwareDetails/WellCount.tsx rename to app/src/organisms/Desktop/Labware/LabwareDetails/WellCount.tsx diff --git a/app/src/organisms/LabwareDetails/WellDimensions.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/WellDimensions.tsx similarity index 93% rename from app/src/organisms/LabwareDetails/WellDimensions.tsx rename to app/src/organisms/Desktop/Labware/LabwareDetails/WellDimensions.tsx index 5fdea6cadf9..b1cf98a147a 100644 --- a/app/src/organisms/LabwareDetails/WellDimensions.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareDetails/WellDimensions.tsx @@ -5,10 +5,8 @@ import { Box, SPACING, getMeasurementDiagram } from '@opentrons/components' import { LabeledValue } from './StyledComponents/LabeledValue' import { ExpandingTitle } from './StyledComponents/ExpandingTitle' -import type { - LabwareWellGroupProperties, - LabwareParameters, -} from '/app/pages/Desktop/Labware/types' +import type { LabwareParameters } from '@opentrons/shared-data' +import type { LabwareWellGroupProperties } from '/app/local-resources/labware' const toFixed = (n: number): string => round(n, 2).toFixed(2) diff --git a/app/src/organisms/LabwareDetails/WellProperties.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/WellProperties.tsx similarity index 94% rename from app/src/organisms/LabwareDetails/WellProperties.tsx rename to app/src/organisms/Desktop/Labware/LabwareDetails/WellProperties.tsx index 75da0a5edce..71f7ef4b3a7 100644 --- a/app/src/organisms/LabwareDetails/WellProperties.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareDetails/WellProperties.tsx @@ -13,11 +13,12 @@ import { } from '@opentrons/components' import { getDisplayVolume } from '@opentrons/shared-data' +import type { LabwareWellGroupProperties } from '/app/local-resources/labware' + import type { - LabwareDefinition, - LabwareWellGroupProperties, + LabwareDefinition2 as LabwareDefinition, LabwareVolumeUnits, -} from '/app/pages/Desktop/Labware/types' +} from '@opentrons/shared-data' export interface AllWellPropertiesProps { definition: LabwareDefinition diff --git a/app/src/organisms/LabwareDetails/WellSpacing.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/WellSpacing.tsx similarity index 95% rename from app/src/organisms/LabwareDetails/WellSpacing.tsx rename to app/src/organisms/Desktop/Labware/LabwareDetails/WellSpacing.tsx index 94ccccfb046..e7a268d9ff7 100644 --- a/app/src/organisms/LabwareDetails/WellSpacing.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareDetails/WellSpacing.tsx @@ -5,7 +5,7 @@ import { getSpacingDiagram } from '@opentrons/components' import { LabeledValue } from './StyledComponents/LabeledValue' import { ExpandingTitle } from './StyledComponents/ExpandingTitle' -import type { LabwareWellGroupProperties } from '/app/pages/Desktop/Labware/types' +import type { LabwareWellGroupProperties } from '/app/local-resources/labware' const toFixed = (n: number): string => round(n, 2).toFixed(2) diff --git a/app/src/organisms/LabwareDetails/__tests__/Dimensions.test.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/Dimensions.test.tsx similarity index 100% rename from app/src/organisms/LabwareDetails/__tests__/Dimensions.test.tsx rename to app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/Dimensions.test.tsx diff --git a/app/src/organisms/LabwareDetails/__tests__/Gallery.test.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/Gallery.test.tsx similarity index 100% rename from app/src/organisms/LabwareDetails/__tests__/Gallery.test.tsx rename to app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/Gallery.test.tsx diff --git a/app/src/organisms/LabwareDetails/__tests__/LabwareDetails.test.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/LabwareDetails.test.tsx similarity index 97% rename from app/src/organisms/LabwareDetails/__tests__/LabwareDetails.test.tsx rename to app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/LabwareDetails.test.tsx index 5c7ed3e868b..1c06bc0e5ce 100644 --- a/app/src/organisms/LabwareDetails/__tests__/LabwareDetails.test.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/LabwareDetails.test.tsx @@ -4,7 +4,7 @@ import { describe, it, beforeEach, afterEach, vi, expect } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' -import { useAllLabware } from '/app/pages/Desktop/Labware/hooks' +import { useAllLabware } from '/app/local-resources/labware' import { mockOpentronsLabwareDetailsDefinition } from '/app/redux/custom-labware/__fixtures__' import { CustomLabwareOverflowMenu } from '../../LabwareCard/CustomLabwareOverflowMenu' import { Dimensions } from '../Dimensions' @@ -17,7 +17,7 @@ import { WellSpacing } from '../WellSpacing' import { LabwareDetails } from '..' -vi.mock('/app/pages/Desktop/Labware/hooks') +vi.mock('/app/local-resources/labware') vi.mock('../../LabwareCard/CustomLabwareOverflowMenu') vi.mock('../Dimensions') vi.mock('../Gallery') diff --git a/app/src/organisms/LabwareDetails/__tests__/ManufacturerDetails.test.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/ManufacturerDetails.test.tsx similarity index 100% rename from app/src/organisms/LabwareDetails/__tests__/ManufacturerDetails.test.tsx rename to app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/ManufacturerDetails.test.tsx diff --git a/app/src/organisms/LabwareDetails/__tests__/WellCount.test.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellCount.test.tsx similarity index 100% rename from app/src/organisms/LabwareDetails/__tests__/WellCount.test.tsx rename to app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellCount.test.tsx diff --git a/app/src/organisms/LabwareDetails/__tests__/WellDimensions.test.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellDimensions.test.tsx similarity index 100% rename from app/src/organisms/LabwareDetails/__tests__/WellDimensions.test.tsx rename to app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellDimensions.test.tsx diff --git a/app/src/organisms/LabwareDetails/__tests__/WellProperties.test.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellProperties.test.tsx similarity index 100% rename from app/src/organisms/LabwareDetails/__tests__/WellProperties.test.tsx rename to app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellProperties.test.tsx diff --git a/app/src/organisms/LabwareDetails/__tests__/WellSpacing.test.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellSpacing.test.tsx similarity index 100% rename from app/src/organisms/LabwareDetails/__tests__/WellSpacing.test.tsx rename to app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellSpacing.test.tsx diff --git a/app/src/organisms/LabwareDetails/helpers/labels.ts b/app/src/organisms/Desktop/Labware/LabwareDetails/helpers/labels.ts similarity index 86% rename from app/src/organisms/LabwareDetails/helpers/labels.ts rename to app/src/organisms/Desktop/Labware/LabwareDetails/helpers/labels.ts index 27cf6d76bb8..204c9114dc6 100644 --- a/app/src/organisms/LabwareDetails/helpers/labels.ts +++ b/app/src/organisms/Desktop/Labware/LabwareDetails/helpers/labels.ts @@ -1,8 +1,7 @@ import uniqBy from 'lodash/uniqBy' -import type { - LabwareWellGroupProperties, - LabwareDefinition, -} from '/app/pages/Desktop/Labware/types' +import type { LabwareWellGroupProperties } from '/app/local-resources/labware' +import type { LabwareDefinition2 as LabwareDefinition } from '@opentrons/shared-data' + const WELL_TYPE_BY_CATEGORY = { tubeRack: 'tube', tipRack: 'tip', diff --git a/app/src/organisms/LabwareDetails/index.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/index.tsx similarity index 99% rename from app/src/organisms/LabwareDetails/index.tsx rename to app/src/organisms/Desktop/Labware/LabwareDetails/index.tsx index fc8e73a16a4..2b0f252bfc6 100644 --- a/app/src/organisms/LabwareDetails/index.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareDetails/index.tsx @@ -35,7 +35,7 @@ import { ManufacturerDetails } from './ManufacturerDetails' import { InsertDetails } from './InsertDetails' import { Gallery } from './Gallery' import { CustomLabwareOverflowMenu } from '../LabwareCard/CustomLabwareOverflowMenu' -import type { LabwareDefAndDate } from '/app/pages/Desktop/Labware/hooks' +import type { LabwareDefAndDate } from '/app/local-resources/labware' const CLOSE_ICON_STYLE = css` border-radius: 50%; diff --git a/app/src/organisms/LabwareDetails/labware-images.ts b/app/src/organisms/Desktop/Labware/LabwareDetails/labware-images.ts similarity index 56% rename from app/src/organisms/LabwareDetails/labware-images.ts rename to app/src/organisms/Desktop/Labware/LabwareDetails/labware-images.ts index 294ec2f1420..c8125c0bf50 100644 --- a/app/src/organisms/LabwareDetails/labware-images.ts +++ b/app/src/organisms/Desktop/Labware/LabwareDetails/labware-images.ts @@ -1,65 +1,64 @@ // images by labware load name -// TODO(mc, 2019-05-29): shared-data? components-library? -import agilent_1_reservoir_290ml_side_view from './images/agilent_1_reservoir_290ml_side_view.jpg' -import axygen_1_reservoir_90ml_side_view from './images/axygen_1_reservoir_90ml_side_view.jpg' -import biorad_96_wellplate_200ul_pcr_photo_three_quarters from './images/biorad_96_wellplate_200ul_pcr_photo_three_quarters.jpg' -import corning_12_wellplate_6_9ml_flat_photo_three_quarters from './images/corning_12_wellplate_6.9ml_flat_photo_three_quarters.jpg' -import corning_24_wellplate_3_4ml_flat_photo_three_quarters from './images/corning_24_wellplate_3.4ml_flat_photo_three_quarters.jpg' -import corning_384_wellplate_112ul_flat_photo_three_quarters from './images/corning_384_wellplate_112ul_flat_photo_three_quarters.jpg' -import corning_96_wellplate_360ul_flat_three_quarters from './images/corning_96_wellplate_360ul_flat_three_quarters.jpg' -import corning_48_wellplate_1_6ml_flat_photo_three_quarters from './images/corning_48_wellplate_1.6ml_flat_photo_three_quarters.jpg' -import corning_6_wellplate_16_8ml_flat_photo_three_quarters from './images/corning_6_wellplate_16.8ml_flat_photo_three_quarters.jpg' -import eppendorf_1000ul_tip_eptips_side_view from './images/eppendorf_1000ul_tip_eptips_side_view.jpg' -import eppendorf_10ul_tips_eptips_side_view from './images/eppendorf_10ul_tips_eptips_side_view.jpg' -import geb_96_tiprack_1000ul_side_view from './images/geb_96_tiprack_1000ul_side_view.jpg' -import geb_1000ul_tip_side_view from './images/geb_1000ul_tip_side_view.jpg' -import geb_96_tiprack_10ul_side_view from './images/geb_96_tiprack_10ul_side_view.jpg' -import geb_10ul_tip_side_view from './images/geb_10ul_tip_side_view.jpg' -import nest_1_reservoir_195ml_three_quarters from './images/nest_1_reservoir_195ml_three_quarters.jpg' -import nest_1_reservoir_290ml from './images/nest_1_reservoir_290ml.jpg' -import nest_12_reservoir_15ml_three_quarters from './images/nest_12_reservoir_15ml_three_quarters.jpg' -import nest_96_wellplate_100ul_pcr_full_skirt_three_quarters from './images/nest_96_wellplate_100ul_pcr_full_skirt_three_quarters.jpg' -import nest_96_wellplate_200ul_flat_three_quarters from './images/nest_96_wellplate_200ul_flat_three_quarters.jpg' -import nest_96_wellplate_2ml_deep from './images/nest_96_wellplate_2ml_deep.jpg' -import opentrons_10_tuberack_4_6_side_view from './images/opentrons_10_tuberack_4_6_side_view.jpg' -import falcon_50ml_15ml_conical_tubes from './images/falcon_50ml_15ml_conical_tubes.jpg' -import opentrons_15_tuberack_side_view from './images/opentrons_15_tuberack_side_view.jpg' -import falcon_15ml_conical_tube from './images/falcon_15ml_conical_tube.jpg' -import nest_50ml_15ml_conical_tubes from './images/nest_50ml_15ml_conical_tubes.jpg' -import nest_15ml_conical_tube from './images/nest_15ml_conical_tube.jpg' -import opentrons_6_tuberack_side_view from './images/opentrons_6_tuberack_side_view.jpg' -import nest_50ml_conical_tube from './images/nest_50ml_conical_tube.jpg' -import opentrons_24_aluminumblock_side_view from './images/opentrons_24_aluminumblock_side_view.jpg' -import generic_2ml_screwcap_tube from './images/generic_2ml_screwcap_tube.jpg' -import nest_0_5ml_screwcap_tube from './images/nest_0.5ml_screwcap_tube.jpg' -import nest_1_5ml_screwcap_tube from './images/nest_1.5ml_screwcap_tube.jpg' -import nest_1_5ml_snapcap_tube from './images/nest_1.5ml_snapcap_tube.jpg' -import nest_2ml_screwcap_tube from './images/nest_2ml_screwcap_tube.jpg' -import nest_2ml_snapcap_tube from './images/nest_2ml_snapcap_tube.jpg' -import opentrons_24_tuberack_side_view from './images/opentrons_24_tuberack_side_view.jpg' -import eppendorf_1_5ml_safelock_snapcap_tube from './images/eppendorf_1.5ml_safelock_snapcap_tube.jpg' -import eppendorf_2ml_safelock_snapcap_tube from './images/eppendorf_2ml_safelock_snapcap_tube.jpg' -import falcon_50ml_conical_tube from './images/falcon_50ml_conical_tube.jpg' -import generic_pcr_strip_200ul_tubes from './images/generic_pcr_strip_200ul_tubes.jpg' -import opentrons_96_tiprack_1000ul_side_view from './images/opentrons_96_tiprack_1000ul_side_view.jpg' -import opentrons_96_tiprack_10ul_side_view from './images/opentrons_96_tiprack_10ul_side_view.jpg' -import opentrons_96_tiprack_300ul_side_view from './images/opentrons_96_tiprack_300ul_side_view.jpg' -import tipone_96_tiprack_200ul_side_view from './images/tipone_96_tiprack_200ul_side_view.jpg' -import tipone_200ul_tip_side_view from './images/tipone_200ul_tip_side_view.jpg' -import usascientific_12_reservoir_22ml_side_view from './images/usascientific_12_reservoir_22ml_side_view.jpg' -import usascientific_96_wellplate_2_4ml_deep_side_view from './images/usascientific_96_wellplate_2.4ml_deep_side_view.jpg' -import thermoscientificnunc_96_wellplate_1300ul from './images/thermoscientificnunc_96_wellplate_1300ul.jpg' -import thermoscientificnunc_96_wellplate_2000ul from './images/thermoscientificnunc_96_wellplate_2000ul.jpg' -import appliedbiosystemsmicroamp_384_wellplate_40ul from './images/appliedbiosystemsmicroamp_384_wellplate_40ul.jpg' -import biorad_384_wellplate_50ul from './images/biorad_384_wellplate_50ul.jpg' -import deep_well_plate_adapter from './images/deep_well_plate_adapter.jpg' -import flat_bottom_plate_adapter from './images/flat_bottom_plate_adapter.jpg' -import pcr_plate_adapter from './images/pcr_plate_adapter.jpg' -import universal_flat_adapter from './images/universal_flat_adapter.jpg' -import flat_bottom_aluminum from './images/flat_bottom_aluminum.png' -import opentrons_96_aluminumblock_side_view from './images/opentrons_96_aluminumblock_side_view.jpg' -import opentrons_96_deep_well_temp_mod_adapter_img from './images/opentrons_96_deep_well_temp_mod_adapter.png' +import agilent_1_reservoir_290ml_side_view from '/app/assets/images/labware/agilent_1_reservoir_290ml_side_view.jpg' +import axygen_1_reservoir_90ml_side_view from '/app/assets/images/labware/axygen_1_reservoir_90ml_side_view.jpg' +import biorad_96_wellplate_200ul_pcr_photo_three_quarters from '/app/assets/images/labware/biorad_96_wellplate_200ul_pcr_photo_three_quarters.jpg' +import corning_12_wellplate_6_9ml_flat_photo_three_quarters from '/app/assets/images/labware/corning_12_wellplate_6.9ml_flat_photo_three_quarters.jpg' +import corning_24_wellplate_3_4ml_flat_photo_three_quarters from '/app/assets/images/labware/corning_24_wellplate_3.4ml_flat_photo_three_quarters.jpg' +import corning_384_wellplate_112ul_flat_photo_three_quarters from '/app/assets/images/labware/corning_384_wellplate_112ul_flat_photo_three_quarters.jpg' +import corning_96_wellplate_360ul_flat_three_quarters from '/app/assets/images/labware/corning_96_wellplate_360ul_flat_three_quarters.jpg' +import corning_48_wellplate_1_6ml_flat_photo_three_quarters from '/app/assets/images/labware/corning_48_wellplate_1.6ml_flat_photo_three_quarters.jpg' +import corning_6_wellplate_16_8ml_flat_photo_three_quarters from '/app/assets/images/labware/corning_6_wellplate_16.8ml_flat_photo_three_quarters.jpg' +import eppendorf_1000ul_tip_eptips_side_view from '/app/assets/images/labware/eppendorf_1000ul_tip_eptips_side_view.jpg' +import eppendorf_10ul_tips_eptips_side_view from '/app/assets/images/labware/eppendorf_10ul_tips_eptips_side_view.jpg' +import geb_96_tiprack_1000ul_side_view from '/app/assets/images/labware/geb_96_tiprack_1000ul_side_view.jpg' +import geb_1000ul_tip_side_view from '/app/assets/images/labware/geb_1000ul_tip_side_view.jpg' +import geb_96_tiprack_10ul_side_view from '/app/assets/images/labware/geb_96_tiprack_10ul_side_view.jpg' +import geb_10ul_tip_side_view from '/app/assets/images/labware/geb_10ul_tip_side_view.jpg' +import nest_1_reservoir_195ml_three_quarters from '/app/assets/images/labware/nest_1_reservoir_195ml_three_quarters.jpg' +import nest_1_reservoir_290ml from '/app/assets/images/labware/nest_1_reservoir_290ml.jpg' +import nest_12_reservoir_15ml_three_quarters from '/app/assets/images/labware/nest_12_reservoir_15ml_three_quarters.jpg' +import nest_96_wellplate_100ul_pcr_full_skirt_three_quarters from '/app/assets/images/labware/nest_96_wellplate_100ul_pcr_full_skirt_three_quarters.jpg' +import nest_96_wellplate_200ul_flat_three_quarters from '/app/assets/images/labware/nest_96_wellplate_200ul_flat_three_quarters.jpg' +import nest_96_wellplate_2ml_deep from '/app/assets/images/labware/nest_96_wellplate_2ml_deep.jpg' +import opentrons_10_tuberack_4_6_side_view from '/app/assets/images/labware/opentrons_10_tuberack_4_6_side_view.jpg' +import falcon_50ml_15ml_conical_tubes from '/app/assets/images/labware/falcon_50ml_15ml_conical_tubes.jpg' +import opentrons_15_tuberack_side_view from '/app/assets/images/labware/opentrons_15_tuberack_side_view.jpg' +import falcon_15ml_conical_tube from '/app/assets/images/labware/falcon_15ml_conical_tube.jpg' +import nest_50ml_15ml_conical_tubes from '/app/assets/images/labware/nest_50ml_15ml_conical_tubes.jpg' +import nest_15ml_conical_tube from '/app/assets/images/labware/nest_15ml_conical_tube.jpg' +import opentrons_6_tuberack_side_view from '/app/assets/images/labware/opentrons_6_tuberack_side_view.jpg' +import nest_50ml_conical_tube from '/app/assets/images/labware/nest_50ml_conical_tube.jpg' +import opentrons_24_aluminumblock_side_view from '/app/assets/images/labware/opentrons_24_aluminumblock_side_view.jpg' +import generic_2ml_screwcap_tube from '/app/assets/images/labware/generic_2ml_screwcap_tube.jpg' +import nest_0_5ml_screwcap_tube from '/app/assets/images/labware/nest_0.5ml_screwcap_tube.jpg' +import nest_1_5ml_screwcap_tube from '/app/assets/images/labware/nest_1.5ml_screwcap_tube.jpg' +import nest_1_5ml_snapcap_tube from '/app/assets/images/labware/nest_1.5ml_snapcap_tube.jpg' +import nest_2ml_screwcap_tube from '/app/assets/images/labware/nest_2ml_screwcap_tube.jpg' +import nest_2ml_snapcap_tube from '/app/assets/images/labware/nest_2ml_snapcap_tube.jpg' +import opentrons_24_tuberack_side_view from '/app/assets/images/labware/opentrons_24_tuberack_side_view.jpg' +import eppendorf_1_5ml_safelock_snapcap_tube from '/app/assets/images/labware/eppendorf_1.5ml_safelock_snapcap_tube.jpg' +import eppendorf_2ml_safelock_snapcap_tube from '/app/assets/images/labware/eppendorf_2ml_safelock_snapcap_tube.jpg' +import falcon_50ml_conical_tube from '/app/assets/images/labware/falcon_50ml_conical_tube.jpg' +import generic_pcr_strip_200ul_tubes from '/app/assets/images/labware/generic_pcr_strip_200ul_tubes.jpg' +import opentrons_96_tiprack_1000ul_side_view from '/app/assets/images/labware/opentrons_96_tiprack_1000ul_side_view.jpg' +import opentrons_96_tiprack_10ul_side_view from '/app/assets/images/labware/opentrons_96_tiprack_10ul_side_view.jpg' +import opentrons_96_tiprack_300ul_side_view from '/app/assets/images/labware/opentrons_96_tiprack_300ul_side_view.jpg' +import tipone_96_tiprack_200ul_side_view from '/app/assets/images/labware/tipone_96_tiprack_200ul_side_view.jpg' +import tipone_200ul_tip_side_view from '/app/assets/images/labware/tipone_200ul_tip_side_view.jpg' +import usascientific_12_reservoir_22ml_side_view from '/app/assets/images/labware/usascientific_12_reservoir_22ml_side_view.jpg' +import usascientific_96_wellplate_2_4ml_deep_side_view from '/app/assets/images/labware/usascientific_96_wellplate_2.4ml_deep_side_view.jpg' +import thermoscientificnunc_96_wellplate_1300ul from '/app/assets/images/labware/thermoscientificnunc_96_wellplate_1300ul.jpg' +import thermoscientificnunc_96_wellplate_2000ul from '/app/assets/images/labware/thermoscientificnunc_96_wellplate_2000ul.jpg' +import appliedbiosystemsmicroamp_384_wellplate_40ul from '/app/assets/images/labware/appliedbiosystemsmicroamp_384_wellplate_40ul.jpg' +import biorad_384_wellplate_50ul from '/app/assets/images/labware/biorad_384_wellplate_50ul.jpg' +import deep_well_plate_adapter from '/app/assets/images/labware/deep_well_plate_adapter.jpg' +import flat_bottom_plate_adapter from '/app/assets/images/labware/flat_bottom_plate_adapter.jpg' +import pcr_plate_adapter from '/app/assets/images/labware/pcr_plate_adapter.jpg' +import universal_flat_adapter from '/app/assets/images/labware/universal_flat_adapter.jpg' +import flat_bottom_aluminum from '/app/assets/images/labware/flat_bottom_aluminum.png' +import opentrons_96_aluminumblock_side_view from '/app/assets/images/labware/opentrons_96_aluminumblock_side_view.jpg' +import opentrons_96_deep_well_temp_mod_adapter_img from '/app/assets/images/labware/opentrons_96_deep_well_temp_mod_adapter.png' export const labwareImages: Record = { agilent_1_reservoir_290ml: [agilent_1_reservoir_290ml_side_view], axygen_1_reservoir_90ml: [axygen_1_reservoir_90ml_side_view], diff --git a/app/src/organisms/LabwareDetails/images/eppendorf_1000ul_tip_eptips_side_view.jpg b/app/src/organisms/LabwareDetails/images/eppendorf_1000ul_tip_eptips_side_view.jpg deleted file mode 100644 index 9aaaf771e12..00000000000 Binary files a/app/src/organisms/LabwareDetails/images/eppendorf_1000ul_tip_eptips_side_view.jpg and /dev/null differ diff --git a/app/src/organisms/LabwareDetails/images/eppendorf_10ul_tips_eptips_side_view.jpg b/app/src/organisms/LabwareDetails/images/eppendorf_10ul_tips_eptips_side_view.jpg deleted file mode 100644 index 718c6bd1ac6..00000000000 Binary files a/app/src/organisms/LabwareDetails/images/eppendorf_10ul_tips_eptips_side_view.jpg and /dev/null differ diff --git a/app/src/organisms/LabwareDetails/images/geb_96_tiprack_1000ul_side_view.jpg b/app/src/organisms/LabwareDetails/images/geb_96_tiprack_1000ul_side_view.jpg deleted file mode 100644 index c201e8363fb..00000000000 Binary files a/app/src/organisms/LabwareDetails/images/geb_96_tiprack_1000ul_side_view.jpg and /dev/null differ diff --git a/app/src/organisms/LabwareDetails/images/geb_96_tiprack_10ul_side_view.jpg b/app/src/organisms/LabwareDetails/images/geb_96_tiprack_10ul_side_view.jpg deleted file mode 100644 index 2273fa6248f..00000000000 Binary files a/app/src/organisms/LabwareDetails/images/geb_96_tiprack_10ul_side_view.jpg and /dev/null differ diff --git a/app/src/organisms/LabwareDetails/images/opentrons_96_tiprack_1000ul_side_view.jpg b/app/src/organisms/LabwareDetails/images/opentrons_96_tiprack_1000ul_side_view.jpg deleted file mode 100644 index eccd58b346d..00000000000 Binary files a/app/src/organisms/LabwareDetails/images/opentrons_96_tiprack_1000ul_side_view.jpg and /dev/null differ diff --git a/app/src/organisms/LabwareDetails/images/opentrons_96_tiprack_10ul_side_view.jpg b/app/src/organisms/LabwareDetails/images/opentrons_96_tiprack_10ul_side_view.jpg deleted file mode 100644 index cfcd1521639..00000000000 Binary files a/app/src/organisms/LabwareDetails/images/opentrons_96_tiprack_10ul_side_view.jpg and /dev/null differ diff --git a/app/src/organisms/LabwareDetails/images/opentrons_96_tiprack_300ul_side_view.jpg b/app/src/organisms/LabwareDetails/images/opentrons_96_tiprack_300ul_side_view.jpg deleted file mode 100644 index 9ac4d287cf2..00000000000 Binary files a/app/src/organisms/LabwareDetails/images/opentrons_96_tiprack_300ul_side_view.jpg and /dev/null differ diff --git a/app/src/organisms/LabwareDetails/images/tipone_96_tiprack_200ul_side_view.jpg b/app/src/organisms/LabwareDetails/images/tipone_96_tiprack_200ul_side_view.jpg deleted file mode 100644 index 45a5adc05ad..00000000000 Binary files a/app/src/organisms/LabwareDetails/images/tipone_96_tiprack_200ul_side_view.jpg and /dev/null differ diff --git a/app/src/organisms/ProtocolDetails/ProtocolLabwareDetails.tsx b/app/src/organisms/ProtocolDetails/ProtocolLabwareDetails.tsx index 4c180b59f88..3a9ae7e5db8 100644 --- a/app/src/organisms/ProtocolDetails/ProtocolLabwareDetails.tsx +++ b/app/src/organisms/ProtocolDetails/ProtocolLabwareDetails.tsx @@ -20,11 +20,11 @@ import { } from '@opentrons/components' import { getLabwareDefURI } from '@opentrons/shared-data' import { Divider } from '/app/atoms/structure' -import { getTopPortalEl } from '../../App/portal' -import { LabwareDetails } from '../LabwareDetails' +import { getTopPortalEl } from '/app/App/portal' +import { LabwareDetails } from '../Desktop/Labware/LabwareDetails' import type { LoadLabwareRunTimeCommand } from '@opentrons/shared-data' -import type { LabwareDefAndDate } from '/app/pages/Desktop/Labware/hooks' +import type { LabwareDefAndDate } from '/app/local-resources/labware' interface ProtocolLabwareDetailsProps { requiredLabwareDetails: LoadLabwareRunTimeCommand[] | null diff --git a/app/src/organisms/QuickTransferFlow/SelectDestLabware.tsx b/app/src/organisms/QuickTransferFlow/SelectDestLabware.tsx index bdc89e6a79d..5cb809fd041 100644 --- a/app/src/organisms/QuickTransferFlow/SelectDestLabware.tsx +++ b/app/src/organisms/QuickTransferFlow/SelectDestLabware.tsx @@ -17,7 +17,7 @@ import { getCompatibleLabwareByCategory } from './utils' import type { LabwareDefinition2 } from '@opentrons/shared-data' import type { SmallButton } from '/app/atoms/buttons' -import type { LabwareFilter } from '/app/pages/Desktop/Labware/types' +import type { LabwareFilter } from '/app/local-resources/labware' import type { QuickTransferWizardState, QuickTransferWizardAction, diff --git a/app/src/organisms/QuickTransferFlow/SelectSourceLabware.tsx b/app/src/organisms/QuickTransferFlow/SelectSourceLabware.tsx index 7f6fd371c14..7807fe46b89 100644 --- a/app/src/organisms/QuickTransferFlow/SelectSourceLabware.tsx +++ b/app/src/organisms/QuickTransferFlow/SelectSourceLabware.tsx @@ -17,7 +17,7 @@ import { getCompatibleLabwareByCategory } from './utils' import type { LabwareDefinition2 } from '@opentrons/shared-data' import type { SmallButton } from '/app/atoms/buttons' -import type { LabwareFilter } from '/app/pages/Desktop/Labware/types' +import type { LabwareFilter } from '/app/local-resources/labware' import type { QuickTransferWizardState, QuickTransferWizardAction, diff --git a/app/src/organisms/QuickTransferFlow/utils/generateCompatibleLabwareForPipette.ts b/app/src/organisms/QuickTransferFlow/utils/generateCompatibleLabwareForPipette.ts index 64a9bf84e1e..29e0847bf02 100644 --- a/app/src/organisms/QuickTransferFlow/utils/generateCompatibleLabwareForPipette.ts +++ b/app/src/organisms/QuickTransferFlow/utils/generateCompatibleLabwareForPipette.ts @@ -1,5 +1,5 @@ import { makeWellSetHelpers, getLabwareDefURI } from '@opentrons/shared-data' -import { getAllDefinitions as getAllLatestDefValues } from '/app/pages/Desktop/Labware/helpers/definitions' +import { getAllDefinitions as getAllLatestDefValues } from '/app/local-resources/labware' import type { PipetteV2Specs, WellSetHelpers } from '@opentrons/shared-data' diff --git a/app/src/organisms/QuickTransferFlow/utils/getCompatibleLabwareByCategory.ts b/app/src/organisms/QuickTransferFlow/utils/getCompatibleLabwareByCategory.ts index 84321eaf944..cb52a095a33 100644 --- a/app/src/organisms/QuickTransferFlow/utils/getCompatibleLabwareByCategory.ts +++ b/app/src/organisms/QuickTransferFlow/utils/getCompatibleLabwareByCategory.ts @@ -6,7 +6,7 @@ import { } from '../constants' import type { LabwareDefinition2 } from '@opentrons/shared-data' -import type { LabwareFilter } from '/app/pages/Desktop/Labware/types' +import type { LabwareFilter } from '/app/local-resources/labware' export function getCompatibleLabwareByCategory( pipetteChannels: 1 | 8 | 96, diff --git a/app/src/pages/Desktop/Labware/__tests__/Labware.test.tsx b/app/src/pages/Desktop/Labware/__tests__/Labware.test.tsx index 1a4182966f4..b5133473704 100644 --- a/app/src/pages/Desktop/Labware/__tests__/Labware.test.tsx +++ b/app/src/pages/Desktop/Labware/__tests__/Labware.test.tsx @@ -8,18 +8,20 @@ import { useTrackEvent, ANALYTICS_OPEN_LABWARE_CREATOR_FROM_BOTTOM_OF_LABWARE_LIBRARY_LIST, } from '/app/redux/analytics' -import { LabwareCard } from '/app/organisms/LabwareCard' -import { AddCustomLabwareSlideout } from '/app/organisms/AddCustomLabwareSlideout' +import { LabwareCard } from '/app/organisms/Desktop/Labware/LabwareCard' +import { AddCustomLabwareSlideout } from '/app/organisms/Desktop/Labware/AddCustomLabwareSlideout' import { useToaster } from '/app/organisms/ToasterOven' -import { useAllLabware, useLabwareFailure, useNewLabwareName } from '../hooks' +import { useLabwareFailure, useNewLabwareName } from '../hooks' import { Labware } from '..' +import { useAllLabware } from '/app/local-resources/labware' import { mockDefinition } from '/app/redux/custom-labware/__fixtures__' -vi.mock('/app/organisms/LabwareCard') -vi.mock('/app/organisms/AddCustomLabwareSlideout') +vi.mock('/app/organisms/Desktop/Labware/LabwareCard') +vi.mock('/app/organisms/Desktop/Labware/AddCustomLabwareSlideout') vi.mock('/app/organisms/ToasterOven') vi.mock('../hooks') vi.mock('/app/redux/analytics') +vi.mock('/app/local-resources/labware') const mockTrackEvent = vi.fn() const mockMakeSnackbar = vi.fn() diff --git a/app/src/pages/Desktop/Labware/__tests__/hooks.test.tsx b/app/src/pages/Desktop/Labware/__tests__/hooks.test.tsx index 23ef20d72b3..14783cd6fe5 100644 --- a/app/src/pages/Desktop/Labware/__tests__/hooks.test.tsx +++ b/app/src/pages/Desktop/Labware/__tests__/hooks.test.tsx @@ -5,7 +5,7 @@ import { vi, it, describe, expect, beforeEach, afterEach } from 'vitest' import { renderHook } from '@testing-library/react' import { i18n } from '/app/i18n' import { I18nextProvider } from 'react-i18next' -import { getAllDefs } from '../helpers/getAllDefs' +import { getAllDefs } from '/app/local-resources/labware/utils/getAllDefs' import { getValidCustomLabware, @@ -17,14 +17,15 @@ import { mockValidLabware, } from '/app/redux/custom-labware/__fixtures__' -import { useAllLabware, useLabwareFailure, useNewLabwareName } from '../hooks' +import { useLabwareFailure, useNewLabwareName } from '../hooks' +import { useAllLabware } from '/app/local-resources/labware' import type { Store } from 'redux' import type { State } from '/app/redux/types' import type { FailedLabwareFile } from '/app/redux/custom-labware/types' vi.mock('/app/redux/custom-labware') -vi.mock('../helpers/getAllDefs') +vi.mock('/app/local-resources/labware/utils/getAllDefs') describe('useAllLabware hook', () => { const store: Store = createStore(vi.fn(), {}) diff --git a/app/src/pages/Desktop/Labware/hooks.tsx b/app/src/pages/Desktop/Labware/hooks.tsx index d9c9d1a1ed1..f6cac84c9f1 100644 --- a/app/src/pages/Desktop/Labware/hooks.tsx +++ b/app/src/pages/Desktop/Labware/hooks.tsx @@ -5,66 +5,9 @@ import { clearAddCustomLabwareFailure, getAddNewLabwareName, clearNewLabwareName, - getValidCustomLabware, } from '/app/redux/custom-labware' -import { getAllDefinitions } from './helpers/definitions' import type { Dispatch } from '/app/redux/types' -import type { LabwareDefinition2 as LabwareDefinition } from '@opentrons/shared-data' -import type { LabwareFilter, LabwareSort } from './types' - -export interface LabwareDefAndDate { - definition: LabwareDefinition - modified?: number - filename?: string -} - -export function useAllLabware( - sortBy: LabwareSort, - filterBy: LabwareFilter -): LabwareDefAndDate[] { - const fullLabwareList: LabwareDefAndDate[] = [] - const labwareDefinitions = getAllDefinitions() - labwareDefinitions.forEach(def => fullLabwareList.push({ definition: def })) - const customLabwareList = useSelector(getValidCustomLabware) - customLabwareList.forEach(customLabware => - 'definition' in customLabware - ? fullLabwareList.push({ - modified: customLabware.modified, - definition: customLabware.definition, - filename: customLabware.filename, - }) - : null - ) - const sortLabware = (a: LabwareDefAndDate, b: LabwareDefAndDate): number => { - if ( - a.definition.metadata.displayName.toUpperCase() < - b.definition.metadata.displayName.toUpperCase() - ) { - return sortBy === 'alphabetical' ? -1 : 1 - } - if ( - a.definition.metadata.displayName.toUpperCase() > - b.definition.metadata.displayName.toUpperCase() - ) { - return sortBy === 'alphabetical' ? 1 : -1 - } - return 0 - } - - if (filterBy === 'customLabware') { - return (customLabwareList as LabwareDefAndDate[]).sort(sortLabware) - } - fullLabwareList.sort(sortLabware) - if (filterBy !== 'all') { - return fullLabwareList.filter( - labwareItem => - labwareItem.definition.metadata.displayCategory === filterBy - ) - } - return fullLabwareList -} - export function useLabwareFailure(): { labwareFailureMessage: string | null clearLabwareFailure: () => unknown diff --git a/app/src/pages/Desktop/Labware/index.tsx b/app/src/pages/Desktop/Labware/index.tsx index 819e0b37b2f..955f8a26fc1 100644 --- a/app/src/pages/Desktop/Labware/index.tsx +++ b/app/src/pages/Desktop/Labware/index.tsx @@ -35,16 +35,20 @@ import { ANALYTICS_OPEN_LABWARE_CREATOR_FROM_BOTTOM_OF_LABWARE_LIBRARY_LIST, } from '/app/redux/analytics' import { addCustomLabwareFileFromCreator } from '/app/redux/custom-labware' -import { LabwareCard } from '/app/organisms/LabwareCard' -import { AddCustomLabwareSlideout } from '/app/organisms/AddCustomLabwareSlideout' -import { LabwareDetails } from '/app/organisms/LabwareDetails' +import { LabwareCard } from '/app/organisms/Desktop/Labware/LabwareCard' +import { AddCustomLabwareSlideout } from '/app/organisms/Desktop/Labware/AddCustomLabwareSlideout' +import { LabwareDetails } from '/app/organisms/Desktop/Labware/LabwareDetails' import { useToaster } from '/app/organisms/ToasterOven' import { useFeatureFlag } from '/app/redux/config' -import { useAllLabware, useLabwareFailure, useNewLabwareName } from './hooks' +import { useLabwareFailure, useNewLabwareName } from './hooks' +import { useAllLabware } from '/app/local-resources/labware' import type { DropdownOption } from '@opentrons/components' -import type { LabwareFilter, LabwareSort } from './types' -import type { LabwareDefAndDate } from './hooks' +import type { + LabwareFilter, + LabwareSort, + LabwareDefAndDate, +} from '/app/local-resources/labware' const LABWARE_CREATOR_HREF = 'https://labware.opentrons.com/create/' const labwareDisplayCategoryFilters: LabwareFilter[] = [ diff --git a/app/src/redux/custom-labware/__fixtures__/index.ts b/app/src/redux/custom-labware/__fixtures__/index.ts index ba7db7d218f..56954b88652 100644 --- a/app/src/redux/custom-labware/__fixtures__/index.ts +++ b/app/src/redux/custom-labware/__fixtures__/index.ts @@ -1,5 +1,5 @@ import type { LabwareDefinition2 } from '@opentrons/shared-data' -import type { LabwareWellGroupProperties } from '/app/pages/Desktop/Labware/types' +import type { LabwareWellGroupProperties } from '/app/local-resources/labware' import type * as Types from '../types' export const mockDefinition: LabwareDefinition2 = {