-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(protocol-designer): onboarding animations for ot-2 #16958
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { useTranslation } from 'react-i18next' | ||
import { css } from 'styled-components' | ||
import { useState, useLayoutEffect } from 'react' | ||
import { FLEX_ROBOT_TYPE } from '@opentrons/shared-data' | ||
import { | ||
ALIGN_CENTER, | ||
ALIGN_END, | ||
|
@@ -25,8 +26,10 @@ import four from '../../assets/images/onboarding_animation_4.webm' | |
import five from '../../assets/images/onboarding_animation_5.webm' | ||
import six from '../../assets/images/onboarding_animation_6.webm' | ||
import { BUTTON_LINK_STYLE } from '../../atoms' | ||
import type { RobotType } from '@opentrons/shared-data' | ||
|
||
interface WizardBodyProps { | ||
robotType: RobotType | ||
stepNumber: number | ||
header: string | ||
children: React.ReactNode | ||
|
@@ -37,6 +40,21 @@ interface WizardBodyProps { | |
tooltipOnDisabled?: string | ||
} | ||
|
||
const OT2_GIFS: Record<number, string> = { | ||
2: new URL( | ||
'../../assets/images/onboarding_animation_ot2_2.gif', | ||
import.meta.url | ||
).href, | ||
3: new URL( | ||
'../../assets/images/onboarding_animation_ot2_3.gif', | ||
import.meta.url | ||
).href, | ||
4: new URL( | ||
'../../assets/images/onboarding_animation_ot2_4.gif', | ||
import.meta.url | ||
).href, | ||
} | ||
|
||
const ONBOARDING_ANIMATIONS: Record<number, string> = { | ||
1: one, | ||
2: two, | ||
|
@@ -56,6 +74,7 @@ export function WizardBody(props: WizardBodyProps): JSX.Element { | |
proceed, | ||
disabled = false, | ||
tooltipOnDisabled, | ||
robotType, | ||
} = props | ||
const { t } = useTranslation('shared') | ||
const [targetProps, tooltipProps] = useHoverTooltip({ | ||
|
@@ -153,21 +172,33 @@ export function WizardBody(props: WizardBodyProps): JSX.Element { | |
transition: opacity 0.5s ease-in-out; | ||
`} | ||
> | ||
<video | ||
preload="auto" | ||
css={css` | ||
width: 100%; | ||
height: 100%; | ||
object-fit: cover; | ||
border-radius: ${BORDERS.borderRadius16}; | ||
`} | ||
autoPlay={true} | ||
loop={false} | ||
controls={false} | ||
aria-label={`onboarding animation for page ${stepNumber}`} | ||
> | ||
<source src={asset ?? ''} type="video/mp4" /> | ||
</video> | ||
{robotType === FLEX_ROBOT_TYPE || stepNumber === 1 ? ( | ||
<video | ||
preload="auto" | ||
css={css` | ||
width: 100%; | ||
height: 100%; | ||
object-fit: cover; | ||
border-radius: ${BORDERS.borderRadius16}; | ||
`} | ||
autoPlay={true} | ||
jerader marked this conversation as resolved.
Show resolved
Hide resolved
|
||
loop={false} | ||
controls={false} | ||
aria-label={`onboarding animation for page ${stepNumber}`} | ||
> | ||
<source src={asset ?? ''} type="video/mp4" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why mp4? I thought the type was webm. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oops they're definitely webm, i'll fix |
||
</video> | ||
) : ( | ||
<img | ||
src={OT2_GIFS[stepNumber]} | ||
width="100%" | ||
height="100%" | ||
css={css` | ||
object-fit: cover; | ||
border-radius: ${BORDERS.borderRadius16}; | ||
`} | ||
/> | ||
)} | ||
</Flex> | ||
</Flex> | ||
) | ||
|
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: post-release we will revisit optimizing the animations for ot-2 and flex. Right now its a bit weird that the flex animations are in webm format but ot-2 animations are in gif format. but it seems to work okay for the release so i think its fine that they have different formats.