-
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.
fix(protocol-designer) fix the slot details glitch when wrapping deck…
… view (#16700) * fix(protocol-designer) fix the slot details glitch when wrapping deck view (#16700)
- Loading branch information
Showing
10 changed files
with
244 additions
and
117 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
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
99 changes: 99 additions & 0 deletions
99
protocol-designer/src/pages/ProtocolOverview/StartingDeck.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,99 @@ | ||
import { useState } from 'react' | ||
import { useTranslation } from 'react-i18next' | ||
|
||
import { | ||
ALIGN_CENTER, | ||
DIRECTION_COLUMN, | ||
Flex, | ||
JUSTIFY_SPACE_BETWEEN, | ||
SPACING, | ||
StyledText, | ||
Btn, | ||
TYPOGRAPHY, | ||
ToggleGroup, | ||
} from '@opentrons/components' | ||
|
||
import { BUTTON_LINK_STYLE } from '../../atoms' | ||
import { DeckThumbnail } from './DeckThumbnail' | ||
import { OffDeckThumbnail } from './OffdeckThumbnail' | ||
import { SlotDetailsContainer } from '../../organisms' | ||
|
||
import type { Dispatch, SetStateAction } from 'react' | ||
import type { RobotType } from '@opentrons/shared-data' | ||
|
||
interface StartingDeckProps { | ||
setShowMaterialsListModal: (showMaterialsListModal: boolean) => void | ||
leftString: string | ||
rightString: string | ||
robotType: RobotType | ||
hover: string | null | ||
setHover: Dispatch<SetStateAction<string | null>> | ||
isOffDeckHover: boolean | ||
} | ||
|
||
export function StartingDeck({ | ||
setShowMaterialsListModal, | ||
leftString, | ||
rightString, | ||
robotType, | ||
hover, | ||
setHover, | ||
isOffDeckHover, | ||
}: StartingDeckProps): JSX.Element { | ||
const { t } = useTranslation('protocol_overview') | ||
|
||
const [deckView, setDeckView] = useState<string>(leftString) | ||
|
||
return ( | ||
<> | ||
<Flex justifyContent={JUSTIFY_SPACE_BETWEEN} alignItems={ALIGN_CENTER}> | ||
<Flex gridGap="1.875rem" alignItems={ALIGN_CENTER}> | ||
<StyledText desktopStyle="headingSmallBold"> | ||
{t('starting_deck')} | ||
</StyledText> | ||
<Flex padding={SPACING.spacing4}> | ||
<Btn | ||
data-testid="Materials_list" | ||
textDecoration={TYPOGRAPHY.textDecorationUnderline} | ||
onClick={() => { | ||
setShowMaterialsListModal(true) | ||
}} | ||
css={BUTTON_LINK_STYLE} | ||
> | ||
<StyledText desktopStyle="bodyDefaultRegular"> | ||
{t('materials_list')} | ||
</StyledText> | ||
</Btn> | ||
</Flex> | ||
</Flex> | ||
<ToggleGroup | ||
selectedValue={deckView} | ||
leftText={leftString} | ||
rightText={rightString} | ||
leftClick={() => { | ||
setDeckView(leftString) | ||
}} | ||
rightClick={() => { | ||
setDeckView(rightString) | ||
}} | ||
/> | ||
</Flex> | ||
<Flex | ||
flexDirection={DIRECTION_COLUMN} | ||
gridGap={SPACING.spacing32} | ||
alignItems={ALIGN_CENTER} | ||
> | ||
{deckView === leftString ? ( | ||
<DeckThumbnail hoverSlot={hover} setHoverSlot={setHover} /> | ||
) : ( | ||
<OffDeckThumbnail hover={hover} setHover={setHover} width="100%" /> | ||
)} | ||
<SlotDetailsContainer | ||
robotType={robotType} | ||
slot={isOffDeckHover ? 'offDeck' : hover} | ||
offDeckLabwareId={isOffDeckHover ? hover : null} | ||
/> | ||
</Flex> | ||
</> | ||
) | ||
} |
Oops, something went wrong.