Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(protocol-designer) add components folder for atoms/molecules/organisms #17733

Merged
merged 8 commits into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions protocol-designer/cypress/support/MixSteps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ enum MixLocators {
PosFromBottom = '[id="TipPositionField_mix_touchTip_mmFromBottom"]',
RenameBtn = 'button:contains("Rename")',
StepNameInput = '[class="InputField__StyledInput-sc-1gyyvht-0 cLVzBl"]',
StepNotesInput = '[class="TextAreaField__StyledTextArea-sc-ug50vm-0 fSXuLe"]',
// StepNotesInput = '[data-testid="TextAreaField_step_notes"]',
// StepNotesInput = '[class="TextAreaField__StyledTextArea-sc-1mhuse7-0 hpcyEZ"]',
StepNotesInput = '[data-testid="TextAreaField"]',
PosFromTop = '[data-testid="TipPositionField_mix_touchTip_mmFromTop"]',
}

Expand Down
2 changes: 1 addition & 1 deletion protocol-designer/src/ProtocolEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
OVERFLOW_AUTO,
} from '@opentrons/components'
import { ProtocolRoutes } from './ProtocolRoutes'
import { PortalRoot } from './organisms'
import { PortalRoot } from './components/organisms'
import { getEnableReactScan } from './feature-flags/selectors'

export function ProtocolEditor(): JSX.Element {
Expand Down
2 changes: 1 addition & 1 deletion protocol-designer/src/ProtocolRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
Kitchen,
LabwareUploadModal,
Navigation,
} from './organisms'
} from './components/organisms'
import { ProtocolDesignerAppFallback } from './resources/ProtocolDesignerAppFallback'

import type { RouteProps } from './types'
Expand Down
2 changes: 0 additions & 2 deletions protocol-designer/src/atoms/index.ts

This file was deleted.

5 changes: 5 additions & 0 deletions protocol-designer/src/components/atoms/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export * from './constants'
export * from './GlobalStyle'
export * from './HandleEnter'
export * from './Toggle'
export * from './ToggleButton'
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {

import type { ReactElement, ReactNode } from 'react'
import type { Placement } from '@opentrons/components'
import type { FieldProps } from '../../pages/Designer/ProtocolSteps/StepForm/types'
import type { FieldProps } from '../../../pages/Designer/ProtocolSteps/StepForm/types'

type CheckboxStepFormFieldProps = FieldProps & {
children?: ReactElement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import {
SPACING,
StyledText,
} from '@opentrons/components'
import { selectDropdownItem } from '../../ui/steps/actions/actions'
import { selectDropdownItem } from '../../../ui/steps/actions/actions'
import type { DropdownOption } from '@opentrons/components'
import type { FieldProps } from '../../pages/Designer/ProtocolSteps/StepForm/types'
import type { FieldProps } from '../../../pages/Designer/ProtocolSteps/StepForm/types'

export interface DropdownStepFormFieldProps extends FieldProps {
options: DropdownOption[]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, it, expect } from 'vitest'
import { screen } from '@testing-library/react'

import { i18n } from '../../../assets/localization'
import { renderWithProviders } from '../../../__testing-utils__'
import { i18n } from '../../../../assets/localization'
import { renderWithProviders } from '../../../../__testing-utils__'
import { EndUserAgreementFooter } from '..'

const render = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useTranslation } from 'react-i18next'
import { Flex, InputField, SPACING } from '@opentrons/components'
import type { Dispatch, SetStateAction } from 'react'
import type { FieldProps } from '../../pages/Designer/ProtocolSteps/types'
import type { FieldProps } from '../../../pages/Designer/ProtocolSteps/types'

interface InputStepFormFieldProps extends FieldProps {
title: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { describe, it, expect, vi, beforeEach } from 'vitest'
import { fireEvent, screen } from '@testing-library/react'

import { i18n } from '../../../assets/localization'
import { renderWithProviders } from '../../../__testing-utils__'
import { LiquidButton } from '../../../molecules/LiquidButton'
import { i18n } from '../../../../assets/localization'
import { renderWithProviders } from '../../../../__testing-utils__'
import { LiquidButton } from '..'

import type { ComponentProps } from 'react'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, it, beforeEach, vi, expect } from 'vitest'
import { screen, fireEvent } from '@testing-library/react'

import { renderWithProviders } from '../../../__testing-utils__'
import { TextAreaField } from '../'
import { renderWithProviders } from '../../../../__testing-utils__'
import { TextAreaField } from '..'

import type { ComponentProps } from 'react'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
} from '@opentrons/components'

import { InputStepFormField } from '../InputStepFormField'
import { ToggleButton } from '../../atoms/ToggleButton'
import type { FieldProps } from '../../pages/Designer/ProtocolSteps/StepForm/types'
import { ToggleButton } from '../../atoms'
import type { FieldProps } from '../../../pages/Designer/ProtocolSteps/StepForm/types'

interface ToggleExpandStepFormFieldProps extends FieldProps {
title: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
useHoverTooltip,
} from '@opentrons/components'

import { ToggleButton } from '../../atoms/ToggleButton'
import { ToggleButton } from '../../atoms'

interface ToggleStepFormFieldProps {
title: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
TYPOGRAPHY,
} from '@opentrons/components'
import { LINK_BUTTON_STYLE } from '../../atoms'
import { selectDesignerTab } from '../../file-data/actions'
import { selectDesignerTab } from '../../../file-data/actions'

import type { AlertLevel } from './types'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@ import {
SPACING,
StyledText,
} from '@opentrons/components'
import * as timelineWarningSelectors from '../../top-selectors/timelineWarnings'
import { getSelectedStepId } from '../../ui/steps'
import * as timelineWarningSelectors from '../../../top-selectors/timelineWarnings'
import { getSelectedStepId } from '../../../ui/steps'
import {
actions as dismissActions,
selectors as dismissSelectors,
} from '../../dismiss'
import { selectors as stepFormSelectors } from '../../step-forms'
} from '../../../dismiss'
import { selectors as stepFormSelectors } from '../../../step-forms'
import {
getVisibleFormErrors,
getVisibleFormWarnings,
getVisibleProfileFormLevelErrors,
} from '../../pages/Designer/ProtocolSteps/StepForm/utils'
} from '../../../pages/Designer/ProtocolSteps/StepForm/utils'
import { WarningContents } from './WarningContents'

import type { ReactNode } from 'react'
import type { ProfileItem } from '@opentrons/step-generation'
import type { StepFieldName } from '../../form-types'
import type { ProfileFormError } from '../../steplist/formLevel/profileErrors'
import type { StepFieldName } from '../../../form-types'
import type { ProfileFormError } from '../../../steplist/formLevel/profileErrors'
import type { MakeAlert } from './types'

interface FormAlertsProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useTranslation } from 'react-i18next'
import { useDispatch } from 'react-redux'
import { Link } from '@opentrons/components'
import { actions as stepsActions } from '../../ui/steps'
import type { TerminalItemId } from '../../steplist'
import { actions as stepsActions } from '../../../ui/steps'
import type { TerminalItemId } from '../../../steplist'

interface TerminalItemLinkProps {
terminalId: TerminalItemId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Flex,
StyledText,
} from '@opentrons/components'
import { getRobotStateTimeline } from '../../file-data/selectors'
import { getRobotStateTimeline } from '../../../file-data/selectors'
import { ErrorContents } from './ErrorContents'

import type { StyleProps } from '@opentrons/components'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@ import { describe, it, vi, beforeEach, expect } from 'vitest'
import '@testing-library/jest-dom/vitest'
import { fireEvent, screen } from '@testing-library/react'
import { FormAlerts } from '../FormAlerts'
import { i18n } from '../../../assets/localization'
import { renderWithProviders } from '../../../__testing-utils__'
import { i18n } from '../../../../assets/localization'
import { renderWithProviders } from '../../../../__testing-utils__'
import {
getDynamicFieldFormErrorsForUnsavedForm,
getFormLevelErrorsForUnsavedForm,
getHydratedUnsavedForm,
} from '../../../step-forms/selectors'
import { getFormWarningsForSelectedStep } from '../../../dismiss/selectors'
import { getTimelineWarningsForSelectedStep } from '../../../top-selectors/timelineWarnings'
import { getSelectedStepId } from '../../../ui/steps'
} from '../../../../step-forms/selectors'
import { getFormWarningsForSelectedStep } from '../../../../dismiss/selectors'
import { getTimelineWarningsForSelectedStep } from '../../../../top-selectors/timelineWarnings'
import { getSelectedStepId } from '../../../../ui/steps'
import {
dismissFormWarning,
dismissTimelineWarning,
} from '../../../dismiss/actions'
} from '../../../../dismiss/actions'

import type { ComponentProps } from 'react'

vi.mock('../../../dismiss/actions')
vi.mock('../../../ui/steps')
vi.mock('../../../top-selectors/timelineWarnings')
vi.mock('../../../dismiss/selectors')
vi.mock('../../../step-forms/selectors')
vi.mock('../../../../dismiss/actions')
vi.mock('../../../../ui/steps')
vi.mock('../../../../top-selectors/timelineWarnings')
vi.mock('../../../../dismiss/selectors')
vi.mock('../../../../step-forms/selectors')

const render = (props: ComponentProps<typeof FormAlerts>) => {
return renderWithProviders(<FormAlerts {...props} />, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { describe, it, vi, beforeEach, expect } from 'vitest'
import '@testing-library/jest-dom/vitest'
import { fireEvent, screen } from '@testing-library/react'
import { i18n } from '../../../assets/localization'
import { renderWithProviders } from '../../../__testing-utils__'
import { getRobotStateTimeline } from '../../../file-data/selectors'
import { selectDesignerTab } from '../../../file-data/actions'
import { i18n } from '../../../../assets/localization'
import { renderWithProviders } from '../../../../__testing-utils__'
import { getRobotStateTimeline } from '../../../../file-data/selectors'
import { selectDesignerTab } from '../../../../file-data/actions'
import { TimelineAlerts } from '../TimelineAlerts'

vi.mock('../../../file-data/selectors')
vi.mock('../../../file-data/actions')
vi.mock('../../../../file-data/selectors')
vi.mock('../../../../file-data/actions')

const render = () => {
return renderWithProviders(<TimelineAlerts />, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { fireEvent, screen } from '@testing-library/react'
import { describe, it, expect, vi, beforeEach } from 'vitest'
import { renderWithProviders } from '../../../__testing-utils__'
import { i18n } from '../../../assets/localization'
import { getLocalStorageItem, setLocalStorageItem } from '../../../persist'
import { renderWithProviders } from '../../../../__testing-utils__'
import { i18n } from '../../../../assets/localization'
import { getLocalStorageItem, setLocalStorageItem } from '../../../../persist'
import { useAnnouncements } from '../announcements'
import { AnnouncementModal } from '../index'

vi.mock('../../../persist')
vi.mock('../../../../persist')
vi.mock('../announcements')

const render = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
TYPOGRAPHY,
} from '@opentrons/components'

import magTempCombined from '../../assets/images/modules/magdeck_tempdeck_combined.png'
import thermocycler from '../../assets/images/modules/thermocycler.png'
import multiSelect from '../../assets/images/announcements/multi_select.gif'
import batchEdit from '../../assets/images/announcements/batch_edit.gif'
import heaterShaker from '../../assets/images/modules/heatershaker.png'
import thermocyclerGen2 from '../../assets/images/modules/thermocycler_gen2.png'
import liquidEnhancements from '../../assets/images/announcements/liquid-enhancements.gif'
import opentronsFlex from '../../assets/images/OpentronsFlex.png'
import deckConfiguration from '../../assets/images/deck_configuration.png'
import absorbancePlateReaderImage from '../../assets/images/opentrons_absorbance_plate_reader.png'
import magTempCombined from '../../../assets/images/modules/magdeck_tempdeck_combined.png'
import thermocycler from '../../../assets/images/modules/thermocycler.png'
import multiSelect from '../../../assets/images/announcements/multi_select.gif'
import batchEdit from '../../../assets/images/announcements/batch_edit.gif'
import heaterShaker from '../../../assets/images/modules/heatershaker.png'
import thermocyclerGen2 from '../../../assets/images/modules/thermocycler_gen2.png'
import liquidEnhancements from '../../../assets/images/announcements/liquid-enhancements.gif'
import opentronsFlex from '../../../assets/images/OpentronsFlex.png'
import deckConfiguration from '../../../assets/images/deck_configuration.png'
import absorbancePlateReaderImage from '../../../assets/images/opentrons_absorbance_plate_reader.png'
import { DOC_URL, RELEASE_NOTES_URL } from '../KnowledgeLink'
import type { ReactNode } from 'react'

Expand Down Expand Up @@ -68,7 +68,11 @@
announcementKey: 'modulesRequireRunAppUpdate',
image: (
<div css={modulesDiagramsRow}>
<img css={modulesDiagram} src={magTempCombined} />
<img
css={modulesDiagram}
src={magTempCombined}
alt="modules diagram"

Check warning on line 74 in protocol-designer/src/components/organisms/AnnouncementModal/announcements.tsx

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/components/organisms/AnnouncementModal/announcements.tsx#L71-L74

Added lines #L71 - L74 were not covered by tests
/>
</div>
),
heading: t('announcements.header', { pd: PD }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
setLocalStorageItem,
getLocalStorageItem,
localStorageAnnouncementKey,
} from '../../persist'
} from '../../../persist'
import { useAnnouncements } from './announcements'

interface AnnouncementModalProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import {
} from '@opentrons/components'

import { LINE_CLAMP_TEXT_STYLE } from '../../atoms'
import { getEnableLiquidClasses } from '../../feature-flags/selectors'
import { removeWellsContents } from '../../labware-ingred/actions'
import { selectors as labwareIngredSelectors } from '../../labware-ingred/selectors'
import { getLabwareEntities } from '../../step-forms/selectors'
import * as wellContentsSelectors from '../../top-selectors/well-contents'
import { getEnableLiquidClasses } from '../../../feature-flags/selectors'
import { removeWellsContents } from '../../../labware-ingred/actions'
import { selectors as labwareIngredSelectors } from '../../../labware-ingred/selectors'
import { getLabwareEntities } from '../../../step-forms/selectors'
import * as wellContentsSelectors from '../../../top-selectors/well-contents'

import type { SelectedContainerId } from '../../labware-ingred/reducers'
import type { SelectedContainerId } from '../../../labware-ingred/reducers'
import type { LiquidInfo } from './LiquidToolbox'

interface LiquidCardProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@ import {
Toolbox,
TYPOGRAPHY,
} from '@opentrons/components'
import { getLiquidEntities } from '../../step-forms/selectors'
import { getLiquidEntities } from '../../../step-forms/selectors'
import { LINK_BUTTON_STYLE } from '../../atoms'
import { selectors as labwareIngredSelectors } from '../../labware-ingred/selectors'
import * as wellContentsSelectors from '../../top-selectors/well-contents'
import * as fieldProcessors from '../../steplist/fieldLevel/processing'
import * as labwareIngredActions from '../../labware-ingred/actions'
import { getLiquidClassDisplayName } from '../../liquid-defs/utils'
import { getSelectedWells } from '../../well-selection/selectors'
import { getLabwareNicknamesById } from '../../ui/labware/selectors'
import { selectors as labwareIngredSelectors } from '../../../labware-ingred/selectors'
import * as wellContentsSelectors from '../../../top-selectors/well-contents'
import * as fieldProcessors from '../../../steplist/fieldLevel/processing'
import * as labwareIngredActions from '../../../labware-ingred/actions'
import { getLiquidClassDisplayName } from '../../../liquid-defs/utils'
import { getSelectedWells } from '../../../well-selection/selectors'
import { getLabwareNicknamesById } from '../../../ui/labware/selectors'
import {
removeWellsContents,
setWellContents,
} from '../../labware-ingred/actions'
import { deselectAllWells } from '../../well-selection/actions'
} from '../../../labware-ingred/actions'
import { deselectAllWells } from '../../../well-selection/actions'
import { DefineLiquidsModal } from '../DefineLiquidsModal'
import { LiquidCard } from './LiquidCard'

import type { ChangeEvent } from 'react'
import type { DropdownOption } from '@opentrons/components'
import type { ContentsByWell } from '../../labware-ingred/types'
import type { ContentsByWell } from '../../../labware-ingred/types'

export interface LiquidInfo {
name: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import {
StyledText,
WELL_LABEL_OPTIONS,
} from '@opentrons/components'
import { selectors } from '../../labware-ingred/selectors'
import { selectors as stepFormSelectors } from '../../step-forms'
import * as wellContentsSelectors from '../../top-selectors/well-contents'
import { getSelectedWells } from '../../well-selection/selectors'
import { selectors } from '../../../labware-ingred/selectors'
import { selectors as stepFormSelectors } from '../../../step-forms'
import * as wellContentsSelectors from '../../../top-selectors/well-contents'
import { getSelectedWells } from '../../../well-selection/selectors'
import { SelectableLabware } from '../Labware/SelectableLabware'
import { wellFillFromWellContents } from '../LabwareOnDeck/utils'
import { deselectWells, selectWells } from '../../well-selection/actions'
import { deselectWells, selectWells } from '../../../well-selection/actions'
import { NAV_BAR_HEIGHT_REM } from '../../atoms'
import { LiquidToolbox } from './LiquidToolbox'

Expand Down
Loading
Loading