Repository navigation
feat(onboarding): adopt MarketingMoment on the wallet-ready screen #47423
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
Changes from all commits
012a5b3
0c022e1
f9448d6
95385ef
bb64f1c
7564259
faedef1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,12 +6,21 @@ export default { | |
| title: 'Pages/OnboardingFlow/CreationSuccessful', | ||
| }; | ||
|
|
||
| export const DefaultStory = () => { | ||
| const CreationSuccessfulStory = () => { | ||
| return ( | ||
| <RiveWasmProvider> | ||
| <CreationSuccessful /> | ||
| </RiveWasmProvider> | ||
| ); | ||
| }; | ||
|
|
||
| DefaultStory.storyName = 'Default'; | ||
| export const DefaultStory = () => <CreationSuccessfulStory />; | ||
|
|
||
| DefaultStory.storyName = 'Wallet ready'; | ||
|
|
||
| export const SrpBackupReminderStory = () => <CreationSuccessfulStory />; | ||
|
|
||
| SrpBackupReminderStory.storyName = 'SRP backup reminder'; | ||
| SrpBackupReminderStory.parameters = { | ||
| initialEntries: ['/?isFromReminder=true'], | ||
|
Contributor
Author
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. The page chooses the reminder layout from this query, through the same onboarding search params it uses in the app. The wallet-ready story leaves the default URL, so it renders the marketing moment. Both stories mount the same component; the URL is the switch. |
||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,10 @@ import { | |
| BoxAlignItems, | ||
| TextButton, | ||
| } from '@metamask/design-system-react'; | ||
| import { | ||
| MarketingMoment, | ||
| type MarketingMomentAction, | ||
| } from '../../../components/ui/marketing-moment'; | ||
| import { useI18nContext } from '../../../hooks/useI18nContext'; | ||
| import { | ||
| ONBOARDING_PRIVACY_SETTINGS_ROUTE, | ||
|
|
@@ -169,78 +173,92 @@ export default function CreationSuccessful() { | |
| ); | ||
| }; | ||
|
|
||
| const openWalletDisabled = isSidePanelEnabled && isSidePanelOpen; | ||
|
|
||
| const handleLearnMoreClick = () => { | ||
| global.platform.openTab({ | ||
| url: learnMoreLink, | ||
| }); | ||
| }; | ||
|
|
||
| if (!isFromSettingsSRPBackup) { | ||
| return ( | ||
| <MarketingMoment | ||
|
Contributor
Author
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. This path is the marketing moment: the ready title, the Rive artwork, and the done and manage-default-settings actions. The reminder path stays on the existing layout because it is a different screen, with the celebrating fox, the learn-how link, and a single back-to-wallet action. The test id stays on both roots so the completion checks still find the page. |
||
| className="h-full" | ||
| data-testid="parent-selector-onboarding-complete" | ||
| title={t('yourWalletIsReady')} | ||
| artwork={<WalletReadyAnimation />} | ||
| artworkWrapperProps={{ | ||
| className: 'pointer-events-none h-[400px] flex-none', | ||
|
Contributor
Author
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. This replaces the old riv-animation container. The slot stays 400px tall and ignores pointer events, which is what that stylesheet did, and flex-none keeps the fixed height from being overridden by the template's flex-1. The animation itself only fills the slot. |
||
| }} | ||
| primaryAction={ | ||
| { | ||
| label: doneButtonLabel, | ||
| onClick: onDone, | ||
| isDisabled: openWalletDisabled, | ||
| 'data-testid': 'onboarding-complete-done', | ||
| } as MarketingMomentAction | ||
| } | ||
| secondaryAction={ | ||
| { | ||
| label: t('manageDefaultSettings'), | ||
| onClick: () => navigate(ONBOARDING_PRIVACY_SETTINGS_ROUTE), | ||
| isDisabled: openWalletDisabled, | ||
| 'data-testid': 'manage-default-settings', | ||
| } as MarketingMomentAction | ||
| } | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
|
Contributor
Author
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 we have these 2 components in the same file baffles me a bit but here we are. Checked in storybook Screen.Recording.2026-10-28.at.1.36.20.PM.mov |
||
| <Box | ||
| flexDirection={BoxFlexDirection.Column} | ||
| justifyContent={BoxJustifyContent.Between} | ||
| gap={6} | ||
| className="creation-successful h-full" | ||
| className="h-full" | ||
| data-testid="parent-selector-onboarding-complete" | ||
| > | ||
| {isFromSettingsSRPBackup && ( | ||
| <Box> | ||
| <Box | ||
| flexDirection={BoxFlexDirection.Column} | ||
| justifyContent={BoxJustifyContent.Center} | ||
| alignItems={BoxAlignItems.Start} | ||
| <Box> | ||
| <Box | ||
| flexDirection={BoxFlexDirection.Column} | ||
| justifyContent={BoxJustifyContent.Center} | ||
| alignItems={BoxAlignItems.Start} | ||
| > | ||
| <Text | ||
| variant={TextVariant.HeadingLg} | ||
| className="self-start mb-4 flex justify-center" | ||
| > | ||
| <Text | ||
| variant={TextVariant.HeadingLg} | ||
| className="self-start mb-4 flex justify-center" | ||
| > | ||
| {t('yourWalletIsReadyFromReminder')} | ||
| </Text> | ||
| <Box className="w-full mb-6"> | ||
| <Box className="w-36 h-36 mx-auto">{renderFox}</Box> | ||
| </Box> | ||
| <Text | ||
| variant={TextVariant.BodyMd} | ||
| color={TextColor.TextAlternative} | ||
| className="mb-6" | ||
| > | ||
| {renderDetails1} | ||
| </Text> | ||
| <Text | ||
| variant={TextVariant.BodyMd} | ||
| color={TextColor.TextAlternative} | ||
| className="mb-6" | ||
| > | ||
| {t('walletReadyLearn', [ | ||
| <TextButton | ||
| key="walletReadyLearn" | ||
| className="hover:bg-transparent active:bg-transparent w-fit" | ||
| onClick={handleLearnMoreClick} | ||
| > | ||
| {t('learnHow')} | ||
| </TextButton>, | ||
| ])} | ||
| </Text> | ||
| {t('yourWalletIsReadyFromReminder')} | ||
| </Text> | ||
| <Box className="w-full mb-6"> | ||
| <Box className="w-36 h-36 mx-auto">{renderFox}</Box> | ||
| </Box> | ||
| <Text | ||
| variant={TextVariant.BodyMd} | ||
| color={TextColor.TextAlternative} | ||
| className="mb-6" | ||
| > | ||
| {renderDetails1} | ||
| </Text> | ||
| <Text | ||
| variant={TextVariant.BodyMd} | ||
| color={TextColor.TextAlternative} | ||
| className="mb-6" | ||
| > | ||
| {t('walletReadyLearn', [ | ||
| <TextButton | ||
| key="walletReadyLearn" | ||
| className="hover:bg-transparent active:bg-transparent w-fit" | ||
| onClick={handleLearnMoreClick} | ||
| > | ||
| {t('learnHow')} | ||
| </TextButton>, | ||
| ])} | ||
| </Text> | ||
| </Box> | ||
| )} | ||
| {!isFromSettingsSRPBackup && <WalletReadyAnimation />} | ||
| {!isFromSettingsSRPBackup && ( | ||
| <Text className="title">{t('yourWalletIsReady')}</Text> | ||
| )} | ||
| </Box> | ||
| {renderDoneButton()} | ||
| {!isFromSettingsSRPBackup && ( | ||
| <Button | ||
| variant={ButtonVariant.Tertiary} | ||
| size={ButtonSize.Lg} | ||
| className="w-full" | ||
| data-testid="manage-default-settings" | ||
| onClick={() => navigate(ONBOARDING_PRIVACY_SETTINGS_ROUTE)} | ||
| disabled={isSidePanelEnabled && isSidePanelOpen} | ||
| > | ||
| {t('manageDefaultSettings')} | ||
| </Button> | ||
| )} | ||
| </Box> | ||
| ); | ||
| } | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,6 @@ import { | |
| Alignment, | ||
| useRiveFile, | ||
| } from '@rive-app/react-canvas'; | ||
| import { Box } from '@metamask/design-system-react'; | ||
| import { useTheme } from '../../../hooks/useTheme'; | ||
| import { ThemeType } from '../../../../shared/constants/preferences'; | ||
| import { | ||
|
|
@@ -83,12 +82,8 @@ export default function WalletReadyAnimation() { | |
| status === 'loading' || | ||
| status === 'failed' | ||
| ) { | ||
| return <Box className="riv-animation__wallet-ready-container"></Box>; | ||
| return null; | ||
|
Contributor
Author
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.
Contributor
Author
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. The component no longer wraps the canvas in its own box. While WASM or the riv file is still loading, or the file fails, it renders nothing and the artwork wrapper holds the 400px space. Once the file is ready the canvas fills that wrapper. |
||
| } | ||
|
|
||
| return ( | ||
| <Box className="riv-animation__wallet-ready-container"> | ||
| <RiveComponent className="riv-animation__canvas" /> | ||
| </Box> | ||
| ); | ||
| return <RiveComponent className="h-full w-full" />; | ||
| } | ||

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.
MemoryRouter only applies initialEntries when it mounts, and this decorator stays mounted as you move between stories. The key is the story URL, so a story with a different entry gets a fresh router. The reminder story depends on that, because the page reads isFromReminder from the location and otherwise stays on the wallet-ready layout.