Skip to content

Commit 4535c43

Browse files
authored
fix(protocol-designer): align the overflow menus types the same over … (#18852)
…timeline closes RQA-4339
1 parent a8f9b4e commit 4535c43

File tree

7 files changed

+15
-14
lines changed

7 files changed

+15
-14
lines changed

protocol-designer/src/components/organisms/LiquidsOverflowMenu/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export function LiquidsOverflowMenu({
6060
right = undefined
6161
left =
6262
targetWidth !== undefined
63-
? `${targetWidth - OVERFLOW_MENU_POSITION_ADJUSTMENT}px`
63+
? `${targetWidth + OVERFLOW_MENU_POSITION_ADJUSTMENT}px`
6464
: undefined
6565
}
6666

protocol-designer/src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export const OFFDECK: 'offDeck' = 'offDeck'
205205
export const PROTOCOL_DESIGNER_SOURCE: 'Protocol Designer' = 'Protocol Designer' // protocolSource for tracking analytics in the app
206206

207207
export const DECK_SETUP_TOOLS_WIDTH_REM = 21.875
208-
export const OVERFLOW_MENU_POSITION_ADJUSTMENT = 4
208+
export const OVERFLOW_MENU_POSITION_ADJUSTMENT = 8
209209

210210
// Below values copied from opentrons/api/src/opentrons/config/defaults_ot[2/3].py
211211
export const FLEX_X_Y_MAX_SPEED = 300

protocol-designer/src/pages/Designer/ProtocolSteps/Timeline/AddStepButton.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useState } from 'react'
22
import { createPortal } from 'react-dom'
33
import { useTranslation } from 'react-i18next'
44
import { useDispatch, useSelector } from 'react-redux'
5-
import { last } from 'lodash'
5+
import last from 'lodash/last'
66
import { css } from 'styled-components'
77

88
import {
@@ -66,9 +66,13 @@ import type { BaseState } from '../../../../types'
6666

6767
interface AddStepButtonProps {
6868
hasText: boolean
69+
sidebarWidth: number
6970
}
7071

71-
export function AddStepButton({ hasText }: AddStepButtonProps): JSX.Element {
72+
export function AddStepButton({
73+
hasText,
74+
sidebarWidth,
75+
}: AddStepButtonProps): JSX.Element {
7276
const { t } = useTranslation(['tooltip', 'button', 'starting_deck_state'])
7377
const enableComment = useSelector(getEnableComment)
7478
const { makeSnackbar } = useKitchen()

protocol-designer/src/pages/Designer/ProtocolSteps/Timeline/AddStepOverflowButton.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ export function AddStepOverflowButton(
2525
): JSX.Element {
2626
const { onClick, stepType, isFirstStep = false, isLastStep = false } = props
2727
const { t, i18n } = useTranslation(['tooltip', 'application'])
28-
// TODO(ja): add or delete tooltips when designs are finalized
29-
// const [targetProps, tooltipProps] = useHoverTooltip({
30-
// placement: TOOLTIP_RIGHT,
31-
// })
32-
// const tooltipMessage = t(`step_description.${stepType}`)
3328

3429
const selectHoverStyle = (): string => {
3530
if (isFirstStep) {
@@ -52,7 +47,6 @@ export function AddStepOverflowButton(
5247
)}
5348
</StyledText>
5449
</MenuButton>
55-
{/* <Tooltip tooltipProps={tooltipProps}>{tooltipMessage}</Tooltip> */}
5650
</>
5751
)
5852
}

protocol-designer/src/pages/Designer/ProtocolSteps/Timeline/StepOverflowMenu.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414

1515
import { analyticsEvent } from '../../../../analytics/actions'
1616
import { OPEN_STEP_DETAILS_EVENT } from '../../../../analytics/constants'
17+
import { OVERFLOW_MENU_POSITION_ADJUSTMENT } from '../../../../constants'
1718
import {
1819
getBatchEditFormHasUnsavedChanges,
1920
getCurrentFormHasUnsavedChanges,
@@ -44,8 +45,6 @@ interface StepOverflowMenuProps {
4445
sidebarWidth: number // adjust the position of the overflow menu
4546
}
4647

47-
const POSITION_ADJUSTMENT = 4
48-
4948
export function StepOverflowMenu(props: StepOverflowMenuProps): JSX.Element {
5049
const {
5150
stepId,
@@ -102,7 +101,7 @@ export function StepOverflowMenu(props: StepOverflowMenuProps): JSX.Element {
102101
ref={menuRootRef}
103102
zIndex={12}
104103
top={top}
105-
left={sidebarWidth - POSITION_ADJUSTMENT} // the space between kebab menu button and overflow menu is 8px
104+
left={sidebarWidth + OVERFLOW_MENU_POSITION_ADJUSTMENT} // the space between kebab menu button and overflow menu is 8px
106105
position={POSITION_ABSOLUTE}
107106
whiteSpace={NO_WRAP}
108107
borderRadius={BORDERS.borderRadius8}

protocol-designer/src/pages/Designer/ProtocolSteps/Timeline/TimelineToolbox.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@ export function TimelineToolbox({
156156
childrenPadding="0px"
157157
confirmButton={
158158
formData != null ? undefined : (
159-
<AddStepButton hasText={sidebarWidth > SIDEBAR_MIN_WIDTH_FOR_ICON} />
159+
<AddStepButton
160+
hasText={sidebarWidth > SIDEBAR_MIN_WIDTH_FOR_ICON}
161+
sidebarWidth={sidebarWidth}
162+
/>
160163
)
161164
}
162165
>

protocol-designer/src/pages/Designer/ProtocolSteps/Timeline/__tests__/AddStepButton.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ describe('AddStepButton', () => {
106106
beforeEach(() => {
107107
props = {
108108
hasText: true,
109+
sidebarWidth: 10,
109110
}
110111
vi.mocked(getEnableComment).mockReturnValue(true)
111112
vi.mocked(getCurrentFormIsPresaved).mockReturnValue(false)

0 commit comments

Comments
 (0)