-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(protocol-designer): add dropdown field deck highlights
closes AUTH-1124
- Loading branch information
Showing
22 changed files
with
244 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
protocol-designer/src/molecules/DropdownStepFormField/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
protocol-designer/src/pages/Designer/Offdeck/HighlightOffdeckSlot.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { useSelector } from 'react-redux' | ||
import { useTranslation } from 'react-i18next' | ||
import { DeckLabelSet } from '@opentrons/components' | ||
import { | ||
getHoveredSelection, | ||
getSelectedSelection, | ||
} from '../../../ui/steps/selectors' | ||
import type { CoordinateTuple } from '@opentrons/shared-data' | ||
import type { LabwareOnDeck } from '../../../step-forms' | ||
|
||
interface HighlightOffdeckSlotProps { | ||
labwareOnDeck: LabwareOnDeck | ||
position: CoordinateTuple | ||
} | ||
|
||
export function HighlightOffdeckSlot( | ||
props: HighlightOffdeckSlotProps | ||
): JSX.Element | null { | ||
const { labwareOnDeck, position } = props | ||
const { t } = useTranslation('application') | ||
const hoveredLabwareOnSelection = useSelector(getHoveredSelection) | ||
const selectedLabwareSelection = useSelector(getSelectedSelection) | ||
const isLabwareSelectionSelected = selectedLabwareSelection.some( | ||
selected => selected.id === labwareOnDeck.id | ||
) | ||
const selected = isLabwareSelectionSelected | ||
const highlighted = hoveredLabwareOnSelection.id === labwareOnDeck.id | ||
|
||
if (highlighted ?? selected) { | ||
return ( | ||
<DeckLabelSet | ||
deckLabels={[ | ||
{ | ||
text: selected ? t('selected') : t('select'), | ||
isSelected: selected, | ||
isLast: true, | ||
isZoomed: false, | ||
}, | ||
]} | ||
x={position[0] - labwareOnDeck.def.cornerOffsetFromSlot.x} | ||
y={position[1] + labwareOnDeck.def.cornerOffsetFromSlot.y} | ||
width={153} | ||
height={102} | ||
invert={true} | ||
/> | ||
) | ||
} | ||
return null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.