Skip to content

Commit 7bbb1c2

Browse files
authored
feat(protocol-designer): onboarding animations for ot-2 (#16958)
closes RQA-3677
1 parent 6c2948e commit 7bbb1c2

File tree

11 files changed

+56
-16
lines changed

11 files changed

+56
-16
lines changed
773 KB
Loading
790 KB
Loading
605 KB
Loading

protocol-designer/src/pages/CreateNewProtocolWizard/AddMetadata.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export function AddMetadata(props: AddMetadataProps): JSX.Element | null {
4545
return (
4646
<HandleEnter onEnter={handleProceed}>
4747
<WizardBody
48+
robotType={robotType}
4849
stepNumber={
4950
robotType === FLEX_ROBOT_TYPE
5051
? FLEX_METADATA_WIZARD_STEP

protocol-designer/src/pages/CreateNewProtocolWizard/SelectFixtures.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useTranslation } from 'react-i18next'
22
import without from 'lodash/without'
3+
import { FLEX_ROBOT_TYPE } from '@opentrons/shared-data'
34
import {
45
ALIGN_CENTER,
56
BORDERS,
@@ -63,6 +64,7 @@ export function SelectFixtures(props: WizardTileProps): JSX.Element | null {
6364
return (
6465
<HandleEnter onEnter={handleProceed}>
6566
<WizardBody
67+
robotType={FLEX_ROBOT_TYPE}
6668
stepNumber={5}
6769
header={t('add_fixtures')}
6870
subHeader={t('fixtures_replace')}

protocol-designer/src/pages/CreateNewProtocolWizard/SelectGripper.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useState } from 'react'
22
import { useTranslation } from 'react-i18next'
33
import without from 'lodash/without'
44
import { useLocation } from 'react-router-dom'
5-
5+
import { FLEX_ROBOT_TYPE } from '@opentrons/shared-data'
66
import {
77
Flex,
88
SPACING,
@@ -43,6 +43,7 @@ export function SelectGripper(props: WizardTileProps): JSX.Element | null {
4343
return (
4444
<HandleEnter onEnter={handleProceed}>
4545
<WizardBody
46+
robotType={FLEX_ROBOT_TYPE}
4647
stepNumber={3}
4748
header={t('add_gripper')}
4849
disabled={gripperStatus == null}

protocol-designer/src/pages/CreateNewProtocolWizard/SelectModules.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ export function SelectModules(props: WizardTileProps): JSX.Element | null {
150150
return (
151151
<HandleEnter onEnter={proceed}>
152152
<WizardBody
153+
robotType={robotType}
153154
stepNumber={robotType === FLEX_ROBOT_TYPE ? 4 : 3}
154155
header={t('add_modules')}
155156
goBack={() => {

protocol-designer/src/pages/CreateNewProtocolWizard/SelectPipettes.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ export function SelectPipettes(props: WizardTileProps): JSX.Element | null {
170170
) : null}
171171
<HandleEnter onEnter={handleProceed}>
172172
<WizardBody
173+
robotType={robotType}
173174
stepNumber={2}
174175
header={page === 'add' ? t('add_pipette') : t('robot_pipettes')}
175176
subHeader={page === 'add' ? t('which_pipette') : undefined}

protocol-designer/src/pages/CreateNewProtocolWizard/SelectRobot.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export function SelectRobot(props: WizardTileProps): JSX.Element {
2121
return (
2222
<HandleEnter onEnter={proceed}>
2323
<WizardBody
24+
robotType={robotType}
2425
stepNumber={1}
2526
header={t('basics')}
2627
disabled={false}

protocol-designer/src/pages/CreateNewProtocolWizard/WizardBody.tsx

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useTranslation } from 'react-i18next'
22
import { css } from 'styled-components'
33
import { useState, useLayoutEffect } from 'react'
4+
import { FLEX_ROBOT_TYPE } from '@opentrons/shared-data'
45
import {
56
ALIGN_CENTER,
67
ALIGN_END,
@@ -25,8 +26,10 @@ import four from '../../assets/images/onboarding_animation_4.webm'
2526
import five from '../../assets/images/onboarding_animation_5.webm'
2627
import six from '../../assets/images/onboarding_animation_6.webm'
2728
import { BUTTON_LINK_STYLE } from '../../atoms'
29+
import type { RobotType } from '@opentrons/shared-data'
2830

2931
interface WizardBodyProps {
32+
robotType: RobotType
3033
stepNumber: number
3134
header: string
3235
children: React.ReactNode
@@ -37,6 +40,21 @@ interface WizardBodyProps {
3740
tooltipOnDisabled?: string
3841
}
3942

43+
const OT2_GIFS: Record<number, string> = {
44+
2: new URL(
45+
'../../assets/images/onboarding_animation_ot2_2.gif',
46+
import.meta.url
47+
).href,
48+
3: new URL(
49+
'../../assets/images/onboarding_animation_ot2_3.gif',
50+
import.meta.url
51+
).href,
52+
4: new URL(
53+
'../../assets/images/onboarding_animation_ot2_4.gif',
54+
import.meta.url
55+
).href,
56+
}
57+
4058
const ONBOARDING_ANIMATIONS: Record<number, string> = {
4159
1: one,
4260
2: two,
@@ -56,6 +74,7 @@ export function WizardBody(props: WizardBodyProps): JSX.Element {
5674
proceed,
5775
disabled = false,
5876
tooltipOnDisabled,
77+
robotType,
5978
} = props
6079
const { t } = useTranslation('shared')
6180
const [targetProps, tooltipProps] = useHoverTooltip({
@@ -153,21 +172,33 @@ export function WizardBody(props: WizardBodyProps): JSX.Element {
153172
transition: opacity 0.5s ease-in-out;
154173
`}
155174
>
156-
<video
157-
preload="auto"
158-
css={css`
159-
width: 100%;
160-
height: 100%;
161-
object-fit: cover;
162-
border-radius: ${BORDERS.borderRadius16};
163-
`}
164-
autoPlay={true}
165-
loop={false}
166-
controls={false}
167-
aria-label={`onboarding animation for page ${stepNumber}`}
168-
>
169-
<source src={asset ?? ''} type="video/mp4" />
170-
</video>
175+
{robotType === FLEX_ROBOT_TYPE || stepNumber === 1 ? (
176+
<video
177+
preload="auto"
178+
css={css`
179+
width: 100%;
180+
height: 100%;
181+
object-fit: cover;
182+
border-radius: ${BORDERS.borderRadius16};
183+
`}
184+
autoPlay
185+
loop={false}
186+
controls={false}
187+
aria-label={`onboarding animation for page ${stepNumber}`}
188+
>
189+
<source src={asset ?? ''} type="video/webm" />
190+
</video>
191+
) : (
192+
<img
193+
src={OT2_GIFS[stepNumber]}
194+
width="100%"
195+
height="100%"
196+
css={css`
197+
object-fit: cover;
198+
border-radius: ${BORDERS.borderRadius16};
199+
`}
200+
/>
201+
)}
171202
</Flex>
172203
</Flex>
173204
)

0 commit comments

Comments
 (0)