From 7f9b706a2cf87afa501ee53538928cdf65d3ebbe Mon Sep 17 00:00:00 2001 From: koji Date: Tue, 28 Jan 2025 14:44:30 -0500 Subject: [PATCH 01/11] modifying the containers --- .../pages/Designer/DeckSetup/DeckSetupContainer.tsx | 13 ++++++++----- .../src/pages/Designer/ProtocolSteps/index.tsx | 1 + protocol-designer/src/pages/Designer/index.tsx | 12 +++++++++--- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/protocol-designer/src/pages/Designer/DeckSetup/DeckSetupContainer.tsx b/protocol-designer/src/pages/Designer/DeckSetup/DeckSetupContainer.tsx index 53874bb8dc0..c23be8dda36 100644 --- a/protocol-designer/src/pages/Designer/DeckSetup/DeckSetupContainer.tsx +++ b/protocol-designer/src/pages/Designer/DeckSetup/DeckSetupContainer.tsx @@ -214,14 +214,17 @@ export function DeckSetupContainer(props: DeckSetupTabType): JSX.Element { ) return ( - + // + <> ) : null} - + ) } diff --git a/protocol-designer/src/pages/Designer/ProtocolSteps/index.tsx b/protocol-designer/src/pages/Designer/ProtocolSteps/index.tsx index 38f4979b0cf..aaa9aa0fe94 100644 --- a/protocol-designer/src/pages/Designer/ProtocolSteps/index.tsx +++ b/protocol-designer/src/pages/Designer/ProtocolSteps/index.tsx @@ -97,6 +97,7 @@ export function ProtocolSteps(): JSX.Element { flex="2.85" paddingTop={showTimelineAlerts ? '0' : SPACING.spacing24} position={POSITION_RELATIVE} + backgroundColor={COLORS.red40} > {zoomIn.slot == null ? ( From 2a32f9504143308a0ec41fa9bcd9682cef388a43 Mon Sep 17 00:00:00 2001 From: koji Date: Fri, 31 Jan 2025 10:21:30 -0500 Subject: [PATCH 02/11] fix(protocol-designer,components): fix deck view size issue fix deck view size issue close AUTH- --- .../src/atoms/buttons/EmptySelectorButton.tsx | 4 +- .../RobotCoordinateSpaceWithRef.tsx | 2 + protocol-designer/src/ProtocolEditor.tsx | 2 +- protocol-designer/src/ProtocolRoutes.tsx | 2 +- .../Designer/DeckSetup/DeckSetupContainer.tsx | 287 +++++++++--------- .../pages/Designer/Offdeck/OffDeckDetails.tsx | 99 ++++-- .../src/pages/Designer/Offdeck/Offdeck.tsx | 119 ++++---- .../Offdeck/__tests__/Offdeck.test.tsx | 2 +- .../src/pages/Designer/Offdeck/index.ts | 2 +- .../ProtocolSteps/DraggableSidebar.tsx | 2 +- .../pages/Designer/ProtocolSteps/index.tsx | 43 ++- .../src/pages/Designer/index.tsx | 28 +- 12 files changed, 358 insertions(+), 234 deletions(-) diff --git a/components/src/atoms/buttons/EmptySelectorButton.tsx b/components/src/atoms/buttons/EmptySelectorButton.tsx index da34a8ba710..ec3e3be0aa4 100644 --- a/components/src/atoms/buttons/EmptySelectorButton.tsx +++ b/components/src/atoms/buttons/EmptySelectorButton.tsx @@ -62,8 +62,8 @@ interface ButtonProps { const StyledButton = styled.button` border: none; - width: ${FLEX_MAX_CONTENT}; - height: ${FLEX_MAX_CONTENT}; + width: 100%; + height: 100%; cursor: ${CURSOR_POINTER}; background-color: ${COLORS.blue30}; border-radius: ${BORDERS.borderRadius8}; diff --git a/components/src/hardware-sim/RobotCoordinateSpace/RobotCoordinateSpaceWithRef.tsx b/components/src/hardware-sim/RobotCoordinateSpace/RobotCoordinateSpaceWithRef.tsx index 659ccbbb350..44f055ab71e 100644 --- a/components/src/hardware-sim/RobotCoordinateSpace/RobotCoordinateSpaceWithRef.tsx +++ b/components/src/hardware-sim/RobotCoordinateSpace/RobotCoordinateSpaceWithRef.tsx @@ -36,6 +36,8 @@ export function RobotCoordinateSpaceWithRef( wholeDeckViewBox = `${viewBoxOriginX} ${viewBoxOriginY} ${deckXDimension} ${deckYDimension}` } + console.log('wholeDeckViewBox', wholeDeckViewBox) + return ( - + diff --git a/protocol-designer/src/ProtocolRoutes.tsx b/protocol-designer/src/ProtocolRoutes.tsx index 854eacfa993..63c31842bbe 100644 --- a/protocol-designer/src/ProtocolRoutes.tsx +++ b/protocol-designer/src/ProtocolRoutes.tsx @@ -73,7 +73,7 @@ export function ProtocolRoutes(): JSX.Element { > - + diff --git a/protocol-designer/src/pages/Designer/DeckSetup/DeckSetupContainer.tsx b/protocol-designer/src/pages/Designer/DeckSetup/DeckSetupContainer.tsx index c23be8dda36..9a43ee7232d 100644 --- a/protocol-designer/src/pages/Designer/DeckSetup/DeckSetupContainer.tsx +++ b/protocol-designer/src/pages/Designer/DeckSetup/DeckSetupContainer.tsx @@ -213,18 +213,24 @@ export function DeckSetupContainer(props: DeckSetupTabType): JSX.Element { aa => isAddressableAreaStandardSlot(aa.id, deckDef) ) + // console.log('ViewBox Adjusted:', viewBoxAdjusted) + // console.log('ViewBox Numerical:', viewBoxNumerical) + // console.log('Deck Map Ratio:', deckMapRatio) + // console.log('viewBox', viewBox) + return ( // <> {zoomIn.slot == null ? ( - + {hoverSlot != null && breakPointSize !== 'small' && LEFT_SLOTS.includes(hoverSlot) ? ( ) : null} - + ) : null} - - {() => ( - <> - {robotType === OT2_ROBOT_TYPE ? ( - - ) : ( - <> - {filteredAddressableAreas.map(addressableArea => { - const cutoutId = getCutoutIdForAddressableArea( - addressableArea.id, - deckDef.cutoutFixtures - ) - return cutoutId != null ? ( - - ) : null - })} - {stagingAreaFixtures.map(fixture => { - if ( - zoomIn.cutout == null || - zoomIn.cutout !== fixture.location - ) { - return ( - + + + {() => ( + <> + {robotType === OT2_ROBOT_TYPE ? ( + + ) : ( + <> + {filteredAddressableAreas.map(addressableArea => { + const cutoutId = getCutoutIdForAddressableArea( + addressableArea.id, + deckDef.cutoutFixtures ) - } - })} - {trash != null - ? trashBinFixtures.map(({ cutoutId }) => - cutoutId != null && - (zoomIn.cutout == null || - zoomIn.cutout !== cutoutId) ? ( - - - - - ) : null - ) - : null} - {wasteChuteFixtures.map(fixture => { - if ( - zoomIn.cutout == null || - zoomIn.cutout !== fixture.location - ) { - return ( - - ) - } - })} - {wasteChuteStagingAreaFixtures.map(fixture => { - if ( - zoomIn.cutout == null || - zoomIn.cutout !== fixture.location - ) { - return ( - - ) - } - })} - - )} - areas.location as CutoutId + ) : null + })} + {stagingAreaFixtures.map(fixture => { + if ( + zoomIn.cutout == null || + zoomIn.cutout !== fixture.location + ) { + return ( + + ) + } + })} + {trash != null + ? trashBinFixtures.map(({ cutoutId }) => + cutoutId != null && + (zoomIn.cutout == null || + zoomIn.cutout !== cutoutId) ? ( + + + + + ) : null + ) + : null} + {wasteChuteFixtures.map(fixture => { + if ( + zoomIn.cutout == null || + zoomIn.cutout !== fixture.location + ) { + return ( + + ) + } + })} + {wasteChuteStagingAreaFixtures.map(fixture => { + if ( + zoomIn.cutout == null || + zoomIn.cutout !== fixture.location + ) { + return ( + + ) + } + })} + )} - {...{ - deckDef, - showGen1MultichannelCollisionWarnings, - }} - /> - 0} - /> - - )} - + areas.location as CutoutId + )} + {...{ + deckDef, + showGen1MultichannelCollisionWarnings, + }} + /> + 0} + /> + + )} + + {zoomIn.slot == null ? ( {hoverSlot != null && diff --git a/protocol-designer/src/pages/Designer/Offdeck/OffDeckDetails.tsx b/protocol-designer/src/pages/Designer/Offdeck/OffDeckDetails.tsx index 5f219e8ecd1..99191e50c62 100644 --- a/protocol-designer/src/pages/Designer/Offdeck/OffDeckDetails.tsx +++ b/protocol-designer/src/pages/Designer/Offdeck/OffDeckDetails.tsx @@ -1,14 +1,19 @@ import { useState } from 'react' import { useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' +import styled from 'styled-components' import { ALIGN_CENTER, + ALIGN_START, + ALIGN_STRETCH, BORDERS, + Box, COLORS, DIRECTION_COLUMN, EmptySelectorButton, Flex, JUSTIFY_CENTER, + JUSTIFY_START, LabwareRender, OVERFLOW_AUTO, RobotWorkSpace, @@ -32,7 +37,8 @@ import { HighlightOffdeckSlot } from './HighlightOffdeckSlot' import type { CoordinateTuple, DeckSlotId } from '@opentrons/shared-data' import type { DeckSetupTabType } from '../types' -const OFFDECK_MAP_WIDTH = '41.625rem' +const OFF_DECK_MAP_WIDTH = '41.625rem' +const OFF_DECK_MAP_HEIGHT = '45.5rem' const ZERO_SLOT_POSITION: CoordinateTuple = [0, 0, 0] interface OffDeckDetailsProps extends DeckSetupTabType { addLabware: () => void @@ -53,27 +59,30 @@ export function OffDeckDetails(props: OffDeckDetailsProps): JSX.Element { const allWellContentsForActiveItem = useSelector( wellContentsSelectors.getAllWellContentsForActiveItem ) - const containerWidth = tab === 'startingDeck' ? '100vw' : '75vh' + const containerWidth = tab === 'startingDeck' ? '100vw' : '75vw' + console.log('containerWidth', containerWidth) const paddingLeftWithHover = hoverSlot == null - ? `calc((${containerWidth} - (${SPACING.spacing24} * 2) - ${OFFDECK_MAP_WIDTH}) / 2)` + ? `calc((${containerWidth} - (${SPACING.spacing24} * 2) - ${OFF_DECK_MAP_WIDTH}) / 2)` : SPACING.spacing24 const paddingLeft = tab === 'startingDeck' ? paddingLeftWithHover : undefined const padding = tab === 'protocolSteps' ? SPACING.spacing24 - : `${SPACING.spacing24} ${paddingLeft}` - const stepDetailsContainerWidth = `calc(((${containerWidth} - ${OFFDECK_MAP_WIDTH}) / 2) - (${SPACING.spacing24} * 3))` + : `${SPACING.spacing40} ${paddingLeft}` + const stepDetailsContainerWidth = `calc(((${containerWidth} - ${OFF_DECK_MAP_WIDTH}) / 2) - (${SPACING.spacing24} * 3))` return ( {hoverSlot != null ? ( @@ -85,27 +94,54 @@ export function OffDeckDetails(props: OffDeckDetailsProps): JSX.Element { ) : null} {i18n.format(t('off_deck_labware'), 'upperCase')} - + {/* */} + + {tab === 'startingDeck' ? ( + + + + ) : null} {offDeckLabware.map(lw => { const wellContents = allWellContentsForActiveItem ? allWellContentsForActiveItem[lw.id] @@ -123,13 +159,12 @@ export function OffDeckDetails(props: OffDeckDetailsProps): JSX.Element { const highlighted = hoveredDropdownItem.id === lw.id return ( - {tab === 'startingDeck' ? ( - + {/* {tab === 'startingDeck' ? ( + - ) : null} - + ) : null} */} + ) } + +// const LabwareWrapper = styled(Flex)` +// /* flex: 0 0 auto; */ +// flex-wrap: ${WRAP}; +// column-gap: ${SPACING.spacing32}; +// row-gap: ${SPACING.spacing40}; +// justify-content: ${JUSTIFY_CENTER}; +// align-items: ${ALIGN_STRETCH}; + +// & > :last-child { +// justify-content: ${JUSTIFY_START}; +// } +// ` + +const LabwareWrapper = styled(Box)` + display: grid; + grid-template-columns: repeat(auto-fill, minmax(9.5625rem, 1fr)); + row-gap: ${SPACING.spacing40}; + column-gap: ${SPACING.spacing32}; + justify-content: ${JUSTIFY_CENTER}; /* Center the grid within the container */ + align-items: ${ALIGN_START}; + width: 100%; + // Note(kk: 1/30/2025) this padding is to add space to the right edge and the left edge of the grid + // this is not a perfect solution, but it works for now + padding: 0 ${SPACING.spacing24}; +` diff --git a/protocol-designer/src/pages/Designer/Offdeck/Offdeck.tsx b/protocol-designer/src/pages/Designer/Offdeck/Offdeck.tsx index 7f3cb7deec1..4cc916413ef 100644 --- a/protocol-designer/src/pages/Designer/Offdeck/Offdeck.tsx +++ b/protocol-designer/src/pages/Designer/Offdeck/Offdeck.tsx @@ -27,6 +27,10 @@ import type { DeckSetupTabType } from '../types' const STANDARD_X_WIDTH = '127.76px' const STANDARD_Y_HEIGHT = '85.48px' +const VIEW_BOX = `-25 -32 182.5142857143 122.1142857143` +const OFF_DECK_CONTAINER_WIDTH = '39.4275rem' +const OFF_DECK_CONTAINER_HEIGHT = '32.125rem' +const SIZE_ADJUSTMENT = 0.7 export function OffDeck(props: DeckSetupTabType): JSX.Element { const { tab } = props @@ -47,30 +51,49 @@ export function OffDeck(props: DeckSetupTabType): JSX.Element { const offDeckLabware = selectedLabwareDefUri != null ? defs[selectedLabwareDefUri] ?? null : null + // let labware = ( + // + // {() => ( + // + // + // + // )} + // + // ) + let labware = ( - + {() => ( - - - + )} ) + + console.log(hoveredLabwareDef?.dimensions) + if (hoveredLabwareDef != null && hoveredLabwareDef !== offDeckLabware) { labware = ( {() => ( <> @@ -87,11 +110,13 @@ export function OffDeck(props: DeckSetupTabType): JSX.Element { ) } else if (offDeckLabware != null) { const def = offDeckLabware + + console.log('offDeckLabware', offDeckLabware) labware = ( {() => ( @@ -110,59 +135,47 @@ export function OffDeck(props: DeckSetupTabType): JSX.Element { ) } + console.log('selectedSlot', selectedSlot) + return ( {selectedSlot.slot === 'offDeck' ? ( - - - - {i18n.format(t('off_deck_labware'), 'upperCase')} - - - - {labware} - + + {i18n.format(t('off_deck_labware'), 'upperCase')} + + + {labware} - { - dispatch(selectZoomedIntoSlot({ slot: null, cutout: null })) - }} - /> + + { + dispatch(selectZoomedIntoSlot({ slot: null, cutout: null })) + }} + /> + ) : ( - + {showTimelineAlerts ? ( ) : null} - + {currentStep != null && hoveredTerminalItem == null ? ( {i18n.format(currentStep.stepName, 'capitalize')} @@ -137,7 +147,11 @@ export function ProtocolSteps(): JSX.Element { }} /> - + {deckView === leftString ? ( ) : ( @@ -151,7 +165,7 @@ export function ProtocolSteps(): JSX.Element { ) : null} - {enableHoyKeyDisplay ? ( + {enableHotKeyDisplay ? ( ) : null} - + + + + {isMultiSelectMode ? : null} ) diff --git a/protocol-designer/src/pages/Designer/index.tsx b/protocol-designer/src/pages/Designer/index.tsx index e11079261ab..ca2c93280e5 100644 --- a/protocol-designer/src/pages/Designer/index.tsx +++ b/protocol-designer/src/pages/Designer/index.tsx @@ -4,11 +4,13 @@ import { useTranslation } from 'react-i18next' import { useNavigate } from 'react-router-dom' import { ALIGN_END, + ALIGN_STRETCH, COLORS, DIRECTION_COLUMN, FLEX_MAX_CONTENT, Flex, INFO_TOAST, + JUSTIFY_FLEX_END, SPACING, ToggleGroup, useOnClickOutside, @@ -126,7 +128,9 @@ export function Designer(): JSX.Element { const deckViewItems = deckView === leftString ? ( - + + + ) : ( ) @@ -159,7 +163,11 @@ export function Designer(): JSX.Element { }} /> ) : null} - + {zoomIn.slot == null ? ( - + Date: Fri, 31 Jan 2025 11:17:58 -0500 Subject: [PATCH 03/11] fix test errors from the file path modification --- .../src/pages/Designer/Offdeck/__tests__/Offdeck.test.tsx | 2 +- protocol-designer/src/pages/Designer/Offdeck/index.ts | 1 - .../src/pages/Designer/Offdeck/{Offdeck.tsx => index.tsx} | 0 .../Designer/ProtocolSteps/__tests__/ProtocolSteps.test.tsx | 4 ++-- protocol-designer/src/pages/Designer/ProtocolSteps/index.tsx | 2 +- protocol-designer/src/pages/Designer/index.tsx | 2 +- 6 files changed, 5 insertions(+), 6 deletions(-) delete mode 100644 protocol-designer/src/pages/Designer/Offdeck/index.ts rename protocol-designer/src/pages/Designer/Offdeck/{Offdeck.tsx => index.tsx} (100%) diff --git a/protocol-designer/src/pages/Designer/Offdeck/__tests__/Offdeck.test.tsx b/protocol-designer/src/pages/Designer/Offdeck/__tests__/Offdeck.test.tsx index 43f7467ea92..11bea47d9d0 100644 --- a/protocol-designer/src/pages/Designer/Offdeck/__tests__/Offdeck.test.tsx +++ b/protocol-designer/src/pages/Designer/Offdeck/__tests__/Offdeck.test.tsx @@ -5,7 +5,7 @@ import { selectors } from '../../../../labware-ingred/selectors' import { getCustomLabwareDefsByURI } from '../../../../labware-defs/selectors' import { renderWithProviders } from '../../../../__testing-utils__' import { OffDeckDetails } from '../OffDeckDetails' -import { OffDeck } from '../OffDeck' +import { OffDeck } from '..' import type * as Components from '@opentrons/components' vi.mock('../OffDeckDetails') diff --git a/protocol-designer/src/pages/Designer/Offdeck/index.ts b/protocol-designer/src/pages/Designer/Offdeck/index.ts deleted file mode 100644 index 9d1b9daac86..00000000000 --- a/protocol-designer/src/pages/Designer/Offdeck/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './OffDeck' diff --git a/protocol-designer/src/pages/Designer/Offdeck/Offdeck.tsx b/protocol-designer/src/pages/Designer/Offdeck/index.tsx similarity index 100% rename from protocol-designer/src/pages/Designer/Offdeck/Offdeck.tsx rename to protocol-designer/src/pages/Designer/Offdeck/index.tsx diff --git a/protocol-designer/src/pages/Designer/ProtocolSteps/__tests__/ProtocolSteps.test.tsx b/protocol-designer/src/pages/Designer/ProtocolSteps/__tests__/ProtocolSteps.test.tsx index 31c1c93eafc..d333baf288d 100644 --- a/protocol-designer/src/pages/Designer/ProtocolSteps/__tests__/ProtocolSteps.test.tsx +++ b/protocol-designer/src/pages/Designer/ProtocolSteps/__tests__/ProtocolSteps.test.tsx @@ -18,14 +18,14 @@ import { } from '../../../../file-data/selectors' import { getEnableHotKeysDisplay } from '../../../../feature-flags/selectors' import { DeckSetupContainer } from '../../DeckSetup' -import { OffDeck } from '../../Offdeck' +import { OffDeck } from '../../OffDeck' import { SubStepsToolbox } from '../Timeline' import { DraggableSidebar } from '../DraggableSidebar' import { ProtocolSteps } from '..' import type { SavedStepFormState } from '../../../../step-forms' -vi.mock('../../Offdeck') +vi.mock('../../OffDeck') vi.mock('../../../../step-forms/selectors') vi.mock('../../../../ui/steps/selectors') vi.mock('../../../../ui/labware/selectors') diff --git a/protocol-designer/src/pages/Designer/ProtocolSteps/index.tsx b/protocol-designer/src/pages/Designer/ProtocolSteps/index.tsx index bee9f3e1234..92745e965ba 100644 --- a/protocol-designer/src/pages/Designer/ProtocolSteps/index.tsx +++ b/protocol-designer/src/pages/Designer/ProtocolSteps/index.tsx @@ -31,7 +31,7 @@ import { getHoveredTerminalItemId, } from '../../../ui/steps/selectors' import { DeckSetupContainer } from '../DeckSetup' -import { OffDeck } from '../Offdeck' +import { OffDeck } from '../OffDeck' import { SubStepsToolbox } from './Timeline' import { StepForm } from './StepForm' import { StepSummary } from './StepSummary' diff --git a/protocol-designer/src/pages/Designer/index.tsx b/protocol-designer/src/pages/Designer/index.tsx index ca2c93280e5..f194dae983f 100644 --- a/protocol-designer/src/pages/Designer/index.tsx +++ b/protocol-designer/src/pages/Designer/index.tsx @@ -27,7 +27,7 @@ import { selectDesignerTab } from '../../file-data/actions' import { getDesignerTab, getFileMetadata } from '../../file-data/selectors' import { DeckSetupContainer } from './DeckSetup' import { selectors } from '../../labware-ingred/selectors' -import { OffDeck } from './Offdeck' +import { OffDeck } from './OffDeck' import { LiquidsOverflowMenu } from './LiquidsOverflowMenu' import { ProtocolSteps } from './ProtocolSteps' From 2e22d979f15eacd26fec841a9d21cd6685e6298a Mon Sep 17 00:00:00 2001 From: koji Date: Fri, 31 Jan 2025 11:53:24 -0500 Subject: [PATCH 04/11] Update OffDeckDetails.tsx --- .../src/pages/Designer/Offdeck/OffDeckDetails.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/protocol-designer/src/pages/Designer/Offdeck/OffDeckDetails.tsx b/protocol-designer/src/pages/Designer/Offdeck/OffDeckDetails.tsx index 99191e50c62..a0b70e381e9 100644 --- a/protocol-designer/src/pages/Designer/Offdeck/OffDeckDetails.tsx +++ b/protocol-designer/src/pages/Designer/Offdeck/OffDeckDetails.tsx @@ -5,7 +5,7 @@ import styled from 'styled-components' import { ALIGN_CENTER, ALIGN_START, - ALIGN_STRETCH, + // ALIGN_STRETCH, BORDERS, Box, COLORS, @@ -13,13 +13,13 @@ import { EmptySelectorButton, Flex, JUSTIFY_CENTER, - JUSTIFY_START, + // JUSTIFY_START, LabwareRender, OVERFLOW_AUTO, RobotWorkSpace, SPACING, StyledText, - WRAP, + // WRAP, } from '@opentrons/components' import * as wellContentsSelectors from '../../../top-selectors/well-contents' import { selectors } from '../../../labware-ingred/selectors' From a712f68108027b394069fb39d255ce9fc770a949 Mon Sep 17 00:00:00 2001 From: koji Date: Mon, 3 Feb 2025 18:24:51 -0500 Subject: [PATCH 05/11] fix deck view position --- .../Designer/DeckSetup/DeckSetupContainer.tsx | 51 ++++---- .../pages/Designer/Offdeck/OffDeckDetails.tsx | 60 ++------- .../src/pages/Designer/Offdeck/index.tsx | 119 ++++++++---------- .../pages/Designer/ProtocolSteps/index.tsx | 14 +-- .../src/pages/Designer/index.tsx | 22 ++-- 5 files changed, 100 insertions(+), 166 deletions(-) diff --git a/protocol-designer/src/pages/Designer/DeckSetup/DeckSetupContainer.tsx b/protocol-designer/src/pages/Designer/DeckSetup/DeckSetupContainer.tsx index 9a43ee7232d..c9c351aebb1 100644 --- a/protocol-designer/src/pages/Designer/DeckSetup/DeckSetupContainer.tsx +++ b/protocol-designer/src/pages/Designer/DeckSetup/DeckSetupContainer.tsx @@ -6,15 +6,15 @@ import { BORDERS, Box, COLORS, - DIRECTION_COLUMN, DeckFromLayers, + DIRECTION_COLUMN, Flex, FlexTrash, JUSTIFY_CENTER, RobotCoordinateSpaceWithRef, - SPACING, SingleSlotFixture, SlotLabels, + SPACING, StagingAreaFixture, WasteChuteFixture, WasteChuteStagingAreaFixture, @@ -59,6 +59,9 @@ import type { Fixture } from './constants' const WASTE_CHUTE_SPACE = 30 const DETAILS_HOVER_SPACE = 60 +// Note (02/02/25:kk) the size is different from the design but the product team requested keep the current size +const STARTING_DECK_VIEW_MIN_WIDTH = '75%' + const OT2_STANDARD_DECK_VIEW_LAYER_BLOCK_LIST: string[] = [ 'calibrationMarkings', 'fixedBase', @@ -213,24 +216,24 @@ export function DeckSetupContainer(props: DeckSetupTabType): JSX.Element { aa => isAddressableAreaStandardSlot(aa.id, deckDef) ) - // console.log('ViewBox Adjusted:', viewBoxAdjusted) - // console.log('ViewBox Numerical:', viewBoxNumerical) - // console.log('Deck Map Ratio:', deckMapRatio) - // console.log('viewBox', viewBox) + let containerPadding = '0' + if (!isZoomed) { + if (tab === 'startingDeck') { + containerPadding = SPACING.spacing40 + } else { + containerPadding = SPACING.spacing60 + } + } return ( - // <> - {zoomIn.slot == null ? ( - + {zoomIn.slot == null && tab === 'startingDeck' ? ( + {hoverSlot != null && breakPointSize !== 'small' && LEFT_SLOTS.includes(hoverSlot) ? ( ) : null} - + ) : null} - + {() => ( <> @@ -394,7 +397,7 @@ export function DeckSetupContainer(props: DeckSetupTabType): JSX.Element { )} - {zoomIn.slot == null ? ( + {zoomIn.slot == null && tab === 'startingDeck' ? ( {hoverSlot != null && breakPointSize !== 'small' && diff --git a/protocol-designer/src/pages/Designer/Offdeck/OffDeckDetails.tsx b/protocol-designer/src/pages/Designer/Offdeck/OffDeckDetails.tsx index a0b70e381e9..b062915271c 100644 --- a/protocol-designer/src/pages/Designer/Offdeck/OffDeckDetails.tsx +++ b/protocol-designer/src/pages/Designer/Offdeck/OffDeckDetails.tsx @@ -5,7 +5,6 @@ import styled from 'styled-components' import { ALIGN_CENTER, ALIGN_START, - // ALIGN_STRETCH, BORDERS, Box, COLORS, @@ -13,13 +12,11 @@ import { EmptySelectorButton, Flex, JUSTIFY_CENTER, - // JUSTIFY_START, LabwareRender, OVERFLOW_AUTO, RobotWorkSpace, SPACING, StyledText, - // WRAP, } from '@opentrons/components' import * as wellContentsSelectors from '../../../top-selectors/well-contents' import { selectors } from '../../../labware-ingred/selectors' @@ -39,6 +36,7 @@ import type { DeckSetupTabType } from '../types' const OFF_DECK_MAP_WIDTH = '41.625rem' const OFF_DECK_MAP_HEIGHT = '45.5rem' +const OFF_DECK_MAP_HEIGHT_FOR_STEP = '31.4rem' const ZERO_SLOT_POSITION: CoordinateTuple = [0, 0, 0] interface OffDeckDetailsProps extends DeckSetupTabType { addLabware: () => void @@ -60,7 +58,7 @@ export function OffDeckDetails(props: OffDeckDetailsProps): JSX.Element { wellContentsSelectors.getAllWellContentsForActiveItem ) const containerWidth = tab === 'startingDeck' ? '100vw' : '75vw' - console.log('containerWidth', containerWidth) + const paddingLeftWithHover = hoverSlot == null ? `calc((${containerWidth} - (${SPACING.spacing24} * 2) - ${OFF_DECK_MAP_WIDTH}) / 2)` @@ -78,11 +76,10 @@ export function OffDeckDetails(props: OffDeckDetailsProps): JSX.Element { borderRadius={BORDERS.borderRadius12} width="100%" height="100%" - // height="65vh" padding={padding} gridGap={SPACING.spacing24} alignItems={ALIGN_CENTER} - id="container" + justifyContent={JUSTIFY_CENTER} > {hoverSlot != null ? ( @@ -96,8 +93,11 @@ export function OffDeckDetails(props: OffDeckDetailsProps): JSX.Element { - - {/* */} - + {tab === 'startingDeck' ? ( ) })} - - - {/* {tab === 'startingDeck' ? ( - - - - ) : null} */} ) } -// const LabwareWrapper = styled(Flex)` -// /* flex: 0 0 auto; */ -// flex-wrap: ${WRAP}; -// column-gap: ${SPACING.spacing32}; -// row-gap: ${SPACING.spacing40}; -// justify-content: ${JUSTIFY_CENTER}; -// align-items: ${ALIGN_STRETCH}; - -// & > :last-child { -// justify-content: ${JUSTIFY_START}; -// } -// ` - const LabwareWrapper = styled(Box)` display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5625rem, 1fr)); diff --git a/protocol-designer/src/pages/Designer/Offdeck/index.tsx b/protocol-designer/src/pages/Designer/Offdeck/index.tsx index 4cc916413ef..7f3cb7deec1 100644 --- a/protocol-designer/src/pages/Designer/Offdeck/index.tsx +++ b/protocol-designer/src/pages/Designer/Offdeck/index.tsx @@ -27,10 +27,6 @@ import type { DeckSetupTabType } from '../types' const STANDARD_X_WIDTH = '127.76px' const STANDARD_Y_HEIGHT = '85.48px' -const VIEW_BOX = `-25 -32 182.5142857143 122.1142857143` -const OFF_DECK_CONTAINER_WIDTH = '39.4275rem' -const OFF_DECK_CONTAINER_HEIGHT = '32.125rem' -const SIZE_ADJUSTMENT = 0.7 export function OffDeck(props: DeckSetupTabType): JSX.Element { const { tab } = props @@ -51,49 +47,30 @@ export function OffDeck(props: DeckSetupTabType): JSX.Element { const offDeckLabware = selectedLabwareDefUri != null ? defs[selectedLabwareDefUri] ?? null : null - // let labware = ( - // - // {() => ( - // - // - // - // )} - // - // ) - let labware = ( - + {() => ( - + + + )} ) - - console.log(hoveredLabwareDef?.dimensions) - if (hoveredLabwareDef != null && hoveredLabwareDef !== offDeckLabware) { labware = ( {() => ( <> @@ -110,13 +87,11 @@ export function OffDeck(props: DeckSetupTabType): JSX.Element { ) } else if (offDeckLabware != null) { const def = offDeckLabware - - console.log('offDeckLabware', offDeckLabware) labware = ( {() => ( @@ -135,47 +110,59 @@ export function OffDeck(props: DeckSetupTabType): JSX.Element { ) } - console.log('selectedSlot', selectedSlot) - return ( {selectedSlot.slot === 'offDeck' ? ( - - {i18n.format(t('off_deck_labware'), 'upperCase')} - - - {labware} + + + + {i18n.format(t('off_deck_labware'), 'upperCase')} + + + + {labware} + - - { - dispatch(selectZoomedIntoSlot({ slot: null, cutout: null })) - }} - /> - + { + dispatch(selectZoomedIntoSlot({ slot: null, cutout: null })) + }} + /> ) : ( @@ -147,11 +139,7 @@ export function ProtocolSteps(): JSX.Element { }} /> - + {deckView === leftString ? ( ) : ( diff --git a/protocol-designer/src/pages/Designer/index.tsx b/protocol-designer/src/pages/Designer/index.tsx index f194dae983f..5c0a4afcb6e 100644 --- a/protocol-designer/src/pages/Designer/index.tsx +++ b/protocol-designer/src/pages/Designer/index.tsx @@ -14,6 +14,8 @@ import { SPACING, ToggleGroup, useOnClickOutside, + JUSTIFY_CENTER, + ALIGN_CENTER, } from '@opentrons/components' import { selectDropdownItem, @@ -128,7 +130,12 @@ export function Designer(): JSX.Element { const deckViewItems = deckView === leftString ? ( - + ) : ( @@ -163,11 +170,7 @@ export function Designer(): JSX.Element { }} /> ) : null} - + {zoomIn.slot == null ? ( Date: Mon, 3 Feb 2025 19:22:54 -0500 Subject: [PATCH 06/11] fix step summary vertical shifting --- .../src/atoms/buttons/EmptySelectorButton.tsx | 1 - .../pages/Designer/ProtocolSteps/StepSummary.tsx | 7 ++----- .../src/pages/Designer/ProtocolSteps/index.tsx | 16 ++++++++++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/components/src/atoms/buttons/EmptySelectorButton.tsx b/components/src/atoms/buttons/EmptySelectorButton.tsx index ec3e3be0aa4..119ff041ba9 100644 --- a/components/src/atoms/buttons/EmptySelectorButton.tsx +++ b/components/src/atoms/buttons/EmptySelectorButton.tsx @@ -4,7 +4,6 @@ import { ALIGN_CENTER, CURSOR_DEFAULT, CURSOR_POINTER, - FLEX_MAX_CONTENT, Icon, JUSTIFY_CENTER, JUSTIFY_START, diff --git a/protocol-designer/src/pages/Designer/ProtocolSteps/StepSummary.tsx b/protocol-designer/src/pages/Designer/ProtocolSteps/StepSummary.tsx index 7077b1812be..1daf86148ee 100644 --- a/protocol-designer/src/pages/Designer/ProtocolSteps/StepSummary.tsx +++ b/protocol-designer/src/pages/Designer/ProtocolSteps/StepSummary.tsx @@ -40,11 +40,7 @@ function StyledTrans(props: StyledTransProps): JSX.Element { const { i18nKey, tagText, values } = props const { t } = useTranslation(['protocol_steps', 'application']) return ( - + {stepSummaryContent != null ? ( diff --git a/protocol-designer/src/pages/Designer/ProtocolSteps/index.tsx b/protocol-designer/src/pages/Designer/ProtocolSteps/index.tsx index 9bda8fa825e..8ef8f52d8e8 100644 --- a/protocol-designer/src/pages/Designer/ProtocolSteps/index.tsx +++ b/protocol-designer/src/pages/Designer/ProtocolSteps/index.tsx @@ -59,7 +59,8 @@ export function ProtocolSteps(): JSX.Element { const [deckView, setDeckView] = useState< typeof leftString | typeof rightString >(leftString) - const [targetWidth, setTargetWidth] = useState(350) + // Note (02/03/25:kk) use DrraggableSidebar's initial width + const [targetWidth, setTargetWidth] = useState(235) const currentHoveredStepId = useSelector(getHoveredStepId) const currentSelectedStepId = useSelector(getSelectedStepId) @@ -83,6 +84,8 @@ export function ProtocolSteps(): JSX.Element { backgroundColor={COLORS.grey10} height="calc(100vh - 4rem)" width="100%" + minHeight={FLEX_MAX_CONTENT} + id="container" > @@ -93,8 +96,8 @@ export function ProtocolSteps(): JSX.Element { gridGap={SPACING.spacing16} flex="2.85" paddingTop={showTimelineAlerts ? '0' : SPACING.spacing24} - paddingX="1.75rem" height="100%" + position={POSITION_RELATIVE} > )} - {formData == null ? ( + {/* avoid shifting the deck view container */} + - ) : null} + {enableHotKeyDisplay ? ( From 9c3517c8b8beac52fb3f0147a7e2b4731b8df47c Mon Sep 17 00:00:00 2001 From: koji Date: Mon, 3 Feb 2025 19:25:31 -0500 Subject: [PATCH 07/11] remove console.log --- .../RobotCoordinateSpace/RobotCoordinateSpaceWithRef.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/components/src/hardware-sim/RobotCoordinateSpace/RobotCoordinateSpaceWithRef.tsx b/components/src/hardware-sim/RobotCoordinateSpace/RobotCoordinateSpaceWithRef.tsx index 44f055ab71e..659ccbbb350 100644 --- a/components/src/hardware-sim/RobotCoordinateSpace/RobotCoordinateSpaceWithRef.tsx +++ b/components/src/hardware-sim/RobotCoordinateSpace/RobotCoordinateSpaceWithRef.tsx @@ -36,8 +36,6 @@ export function RobotCoordinateSpaceWithRef( wholeDeckViewBox = `${viewBoxOriginX} ${viewBoxOriginY} ${deckXDimension} ${deckYDimension}` } - console.log('wholeDeckViewBox', wholeDeckViewBox) - return ( Date: Mon, 3 Feb 2025 19:26:42 -0500 Subject: [PATCH 08/11] fix lint error --- protocol-designer/src/pages/Designer/index.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/protocol-designer/src/pages/Designer/index.tsx b/protocol-designer/src/pages/Designer/index.tsx index 5c0a4afcb6e..792d3f25f4f 100644 --- a/protocol-designer/src/pages/Designer/index.tsx +++ b/protocol-designer/src/pages/Designer/index.tsx @@ -3,19 +3,17 @@ import { useDispatch, useSelector } from 'react-redux' import { useTranslation } from 'react-i18next' import { useNavigate } from 'react-router-dom' import { - ALIGN_END, + ALIGN_CENTER, ALIGN_STRETCH, COLORS, DIRECTION_COLUMN, - FLEX_MAX_CONTENT, Flex, INFO_TOAST, + JUSTIFY_CENTER, JUSTIFY_FLEX_END, SPACING, ToggleGroup, useOnClickOutside, - JUSTIFY_CENTER, - ALIGN_CENTER, } from '@opentrons/components' import { selectDropdownItem, From 4a14086339d63da7db0fd68d665ad6f6f1624476 Mon Sep 17 00:00:00 2001 From: koji Date: Mon, 3 Feb 2025 19:41:54 -0500 Subject: [PATCH 09/11] Update Designer.test.tsx --- protocol-designer/src/pages/Designer/__tests__/Designer.test.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/protocol-designer/src/pages/Designer/__tests__/Designer.test.tsx b/protocol-designer/src/pages/Designer/__tests__/Designer.test.tsx index d7a05a8efe0..9480ebc2d45 100644 --- a/protocol-designer/src/pages/Designer/__tests__/Designer.test.tsx +++ b/protocol-designer/src/pages/Designer/__tests__/Designer.test.tsx @@ -16,6 +16,7 @@ import type { NavigateFunction } from 'react-router-dom' const mockNavigate = vi.fn() +vi.mock('../OffDeck') vi.mock('../ProtocolSteps') vi.mock('../../../labware-ingred/actions') vi.mock('../../../labware-ingred/selectors') From 3c6ff005d6fe1930381c0faf965f33990a841daa Mon Sep 17 00:00:00 2001 From: koji Date: Mon, 3 Feb 2025 19:56:02 -0500 Subject: [PATCH 10/11] Rename Offdeck.test.tsx to OffDeck.test.tsx --- .../Offdeck/__tests__/{Offdeck.test.tsx => OffDeck.test.tsx} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename protocol-designer/src/pages/Designer/Offdeck/__tests__/{Offdeck.test.tsx => OffDeck.test.tsx} (100%) diff --git a/protocol-designer/src/pages/Designer/Offdeck/__tests__/Offdeck.test.tsx b/protocol-designer/src/pages/Designer/Offdeck/__tests__/OffDeck.test.tsx similarity index 100% rename from protocol-designer/src/pages/Designer/Offdeck/__tests__/Offdeck.test.tsx rename to protocol-designer/src/pages/Designer/Offdeck/__tests__/OffDeck.test.tsx From a1bd38b1fa2c849a3994d0f214477fdc1f6bbf0c Mon Sep 17 00:00:00 2001 From: koji Date: Mon, 3 Feb 2025 22:25:44 -0500 Subject: [PATCH 11/11] fix test errors --- .../pages/Designer/{Offdeck => OffDeck}/HighlightOffdeckSlot.tsx | 0 .../src/pages/Designer/{Offdeck => OffDeck}/OffDeckDetails.tsx | 0 .../Designer/{Offdeck => OffDeck}/__tests__/OffDeck.test.tsx | 0 .../{Offdeck => OffDeck}/__tests__/OffDeckDetails.test.tsx | 0 .../src/pages/Designer/{Offdeck => OffDeck}/index.tsx | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename protocol-designer/src/pages/Designer/{Offdeck => OffDeck}/HighlightOffdeckSlot.tsx (100%) rename protocol-designer/src/pages/Designer/{Offdeck => OffDeck}/OffDeckDetails.tsx (100%) rename protocol-designer/src/pages/Designer/{Offdeck => OffDeck}/__tests__/OffDeck.test.tsx (100%) rename protocol-designer/src/pages/Designer/{Offdeck => OffDeck}/__tests__/OffDeckDetails.test.tsx (100%) rename protocol-designer/src/pages/Designer/{Offdeck => OffDeck}/index.tsx (100%) diff --git a/protocol-designer/src/pages/Designer/Offdeck/HighlightOffdeckSlot.tsx b/protocol-designer/src/pages/Designer/OffDeck/HighlightOffdeckSlot.tsx similarity index 100% rename from protocol-designer/src/pages/Designer/Offdeck/HighlightOffdeckSlot.tsx rename to protocol-designer/src/pages/Designer/OffDeck/HighlightOffdeckSlot.tsx diff --git a/protocol-designer/src/pages/Designer/Offdeck/OffDeckDetails.tsx b/protocol-designer/src/pages/Designer/OffDeck/OffDeckDetails.tsx similarity index 100% rename from protocol-designer/src/pages/Designer/Offdeck/OffDeckDetails.tsx rename to protocol-designer/src/pages/Designer/OffDeck/OffDeckDetails.tsx diff --git a/protocol-designer/src/pages/Designer/Offdeck/__tests__/OffDeck.test.tsx b/protocol-designer/src/pages/Designer/OffDeck/__tests__/OffDeck.test.tsx similarity index 100% rename from protocol-designer/src/pages/Designer/Offdeck/__tests__/OffDeck.test.tsx rename to protocol-designer/src/pages/Designer/OffDeck/__tests__/OffDeck.test.tsx diff --git a/protocol-designer/src/pages/Designer/Offdeck/__tests__/OffDeckDetails.test.tsx b/protocol-designer/src/pages/Designer/OffDeck/__tests__/OffDeckDetails.test.tsx similarity index 100% rename from protocol-designer/src/pages/Designer/Offdeck/__tests__/OffDeckDetails.test.tsx rename to protocol-designer/src/pages/Designer/OffDeck/__tests__/OffDeckDetails.test.tsx diff --git a/protocol-designer/src/pages/Designer/Offdeck/index.tsx b/protocol-designer/src/pages/Designer/OffDeck/index.tsx similarity index 100% rename from protocol-designer/src/pages/Designer/Offdeck/index.tsx rename to protocol-designer/src/pages/Designer/OffDeck/index.tsx