Skip to content

Commit

Permalink
fix(protocol-designer): fix empty selector button size issue (#17418)
Browse files Browse the repository at this point in the history
* fix(protocol-designer): fix empty selector button size issue
  • Loading branch information
koji authored Feb 4, 2025
1 parent e37b61f commit e2bc455
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
DIRECTION_COLUMN,
DIRECTION_ROW,
EmptySelectorButton,
FLEX_MAX_CONTENT,
Flex,
Icon,
JUSTIFY_SPACE_BETWEEN,
Expand Down Expand Up @@ -179,15 +180,17 @@ export function PipetteOverview({
) : null}
{has96Channel ||
(leftPipette != null && rightPipette != null) ? null : (
<EmptySelectorButton
onClick={() => {
setPage('add')
setMount(targetPipetteMount)
}}
text={t('add_pipette')}
textAlignment="left"
iconName="plus"
/>
<Flex width={FLEX_MAX_CONTENT}>
<EmptySelectorButton
onClick={() => {
setPage('add')
setMount(targetPipetteMount)
}}
text={t('add_pipette')}
textAlignment="left"
iconName="plus"
/>
</Flex>
)}
</Flex>
</Flex>
Expand Down Expand Up @@ -238,14 +241,16 @@ export function PipetteOverview({
</Flex>
</ListItem>
) : (
<EmptySelectorButton
onClick={() => {
dispatch(toggleIsGripperRequired())
}}
text={t('protocol_overview:add_gripper')}
textAlignment="left"
iconName="plus"
/>
<Flex width={FLEX_MAX_CONTENT}>
<EmptySelectorButton
onClick={() => {
dispatch(toggleIsGripperRequired())
}}
text={t('protocol_overview:add_gripper')}
textAlignment="left"
iconName="plus"
/>
</Flex>
)}
</Flex>
</Flex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
DIRECTION_COLUMN,
EmptySelectorButton,
Flex,
FLEX_MAX_CONTENT,
ListItem,
SPACING,
StyledText,
Expand Down Expand Up @@ -99,23 +100,24 @@ export function SelectFixtures(props: WizardTileProps): JSX.Element | null {
)

return (
<EmptySelectorButton
disabled={numSlotsAvailable === 0}
key={equipment}
textAlignment={TYPOGRAPHY.textAlignLeft}
iconName="plus"
text={t(`${equipment}`)}
onClick={() => {
if (numSlotsAvailable === 0) {
makeSnackbar(t('slots_limit_reached') as string)
} else {
setValue('additionalEquipment', [
...additionalEquipment,
equipment,
])
}
}}
/>
<Flex width={FLEX_MAX_CONTENT} key={equipment}>
<EmptySelectorButton
disabled={numSlotsAvailable === 0}
textAlignment={TYPOGRAPHY.textAlignLeft}
iconName="plus"
text={t(`${equipment}`)}
onClick={() => {
if (numSlotsAvailable === 0) {
makeSnackbar(t('slots_limit_reached') as string)
} else {
setValue('additionalEquipment', [
...additionalEquipment,
equipment,
])
}
}}
/>
</Flex>
)
})}
</Flex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
COLORS,
DIRECTION_COLUMN,
EmptySelectorButton,
FLEX_MAX_CONTENT,
Flex,
ListItem,
SPACING,
Expand Down Expand Up @@ -320,7 +321,7 @@ function AddModuleEmptySelectorButton(

return (
<>
<Flex {...targetProps}>
<Flex {...targetProps} width={FLEX_MAX_CONTENT}>
<EmptySelectorButton
disabled={!areSlotsAvailable || disableGripperRequired}
textAlignment={TYPOGRAPHY.textAlignLeft}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
DISPLAY_FLEX,
DISPLAY_INLINE_BLOCK,
EmptySelectorButton,
FLEX_MAX_CONTENT,
Flex,
Icon,
JUSTIFY_SPACE_BETWEEN,
Expand Down Expand Up @@ -554,16 +555,18 @@ export function SelectPipettes(props: WizardTileProps): JSX.Element | null {
pipettesByMount.right.pipetteName != null &&
pipettesByMount.left.tiprackDefURI != null &&
pipettesByMount.right.tiprackDefURI != null) ? null : (
<EmptySelectorButton
onClick={() => {
setPage('add')
setMount(targetPipetteMount)
resetFields()
}}
text={t('add_pipette')}
textAlignment="left"
iconName="plus"
/>
<Flex width={FLEX_MAX_CONTENT}>
<EmptySelectorButton
onClick={() => {
setPage('add')
setMount(targetPipetteMount)
resetFields()
}}
text={t('add_pipette')}
textAlignment="left"
iconName="plus"
/>
</Flex>
)}
</>
</Flex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
Divider,
DropdownMenu,
EmptySelectorButton,
FLEX_MAX_CONTENT,
Flex,
Icon,
InputField,
Expand Down Expand Up @@ -237,12 +238,14 @@ function IntializationEditor(props: InitializationEditorProps): JSX.Element {
{wavelengthItems}
</Flex>
{mode === 'multi' && wavelengths.length < MAX_WAVELENGTHS ? (
<EmptySelectorButton
onClick={handleAddWavelength}
text={t('step_edit_form.absorbanceReader.add_wavelength.label')}
textAlignment="left"
disabled={numWavelengths === MAX_WAVELENGTHS}
/>
<Flex width={FLEX_MAX_CONTENT}>
<EmptySelectorButton
onClick={handleAddWavelength}
text={t('step_edit_form.absorbanceReader.add_wavelength.label')}
textAlignment="left"
disabled={numWavelengths === MAX_WAVELENGTHS}
/>
</Flex>
) : null}
</Flex>
{mode === 'single' ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next'
import {
DIRECTION_COLUMN,
EmptySelectorButton,
FLEX_MAX_CONTENT,
Flex,
InfoScreen,
JUSTIFY_FLEX_END,
Expand Down Expand Up @@ -98,28 +99,34 @@ export function ThermocyclerProfileModal(
maxHeight="31.875rem"
>
<Flex justifyContent={JUSTIFY_FLEX_END} gridGap={SPACING.spacing4}>
<EmptySelectorButton
text={t('form:step_edit_form.field.thermocyclerProfile.add_cycle')}
onClick={() => {
if (canAddStepOrProfile) {
setShowCreateNewCycle(true)
}
}}
textAlignment="left"
iconName="plus"
disabled={!canAddStepOrProfile}
/>
<EmptySelectorButton
text={t('form:step_edit_form.field.thermocyclerProfile.add_step')}
onClick={() => {
if (canAddStepOrProfile) {
setShowCreateNewStep(true)
}
}}
textAlignment="left"
iconName="plus"
disabled={!canAddStepOrProfile}
/>
<Flex width={FLEX_MAX_CONTENT}>
<EmptySelectorButton
text={t(
'form:step_edit_form.field.thermocyclerProfile.add_cycle'
)}
onClick={() => {
if (canAddStepOrProfile) {
setShowCreateNewCycle(true)
}
}}
textAlignment="left"
iconName="plus"
disabled={!canAddStepOrProfile}
/>
</Flex>
<Flex width={FLEX_MAX_CONTENT}>
<EmptySelectorButton
text={t('form:step_edit_form.field.thermocyclerProfile.add_step')}
onClick={() => {
if (canAddStepOrProfile) {
setShowCreateNewStep(true)
}
}}
textAlignment="left"
iconName="plus"
disabled={!canAddStepOrProfile}
/>
</Flex>
</Flex>
{steps.length > 0 || showCreateNewStep || showCreateNewCycle ? (
<Flex
Expand Down

0 comments on commit e2bc455

Please sign in to comment.