-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
296 additions
and
28 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { useSelector } from 'react-redux' | ||
import { | ||
getHoveredSelection, | ||
getSelectedSelection, | ||
} from '../../ui/steps/selectors' | ||
import { ModuleLabel } from './DeckSetup/ModuleLabel' | ||
|
||
import type { CoordinateTuple, ModuleModel } from '@opentrons/shared-data' | ||
|
||
interface HighlightModuleProps { | ||
moduleModel: ModuleModel | ||
position: CoordinateTuple | ||
orientation: 'left' | 'right' | ||
moduleId: string | ||
} | ||
export const HighlightModule = ( | ||
props: HighlightModuleProps | ||
): JSX.Element | null => { | ||
const { moduleModel, position, orientation, moduleId } = props | ||
const hoveredModulSelection = useSelector(getHoveredSelection) | ||
const selectedModuleSelection = useSelector(getSelectedSelection) | ||
const isSelectedModuleSelected = | ||
selectedModuleSelection.find(selected => selected.id === moduleId) != null | ||
const highlighted = hoveredModulSelection.id === moduleId | ||
|
||
let labelText | ||
if (hoveredModulSelection != null && !isSelectedModuleSelected) { | ||
labelText = hoveredModulSelection.text ?? undefined | ||
} else if (isSelectedModuleSelected) { | ||
labelText = selectedModuleSelection[0].text ?? undefined | ||
} | ||
|
||
if (isSelectedModuleSelected || highlighted) { | ||
return ( | ||
<ModuleLabel | ||
isLast={true} | ||
isSelected={isSelectedModuleSelected} | ||
moduleModel={moduleModel} | ||
position={position} | ||
orientation={orientation} | ||
isZoomed={false} | ||
labelName={labelText} | ||
/> | ||
) | ||
} | ||
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
Oops, something went wrong.