Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ const metamaskDecorator = (story, context) => {
return (
<Provider store={store}>
<QueryClientProvider client={queryClient}>
<MemoryRouter initialEntries={initialEntries}>
<MemoryRouter
key={initialEntries.join('|')}

Copy link
Copy Markdown
Contributor Author

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.

initialEntries={initialEntries}
>
<AlertMetricsProvider
metrics={{
trackAlertActionClicked: () => undefined,
Expand Down
12 changes: 12 additions & 0 deletions ui/components/ui/marketing-moment/marketing-moment.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ describe('MarketingMoment', () => {
expect(onSecondaryClick).toHaveBeenCalledTimes(1);
});

it('keeps the actions outside the scrolling content', () => {
renderMoment();

const root = screen.getByTestId('marketing-moment');
const scroller = root.querySelector('.overflow-y-auto');
const primary = screen.getAllByRole('button')[0];

expect(root).toHaveClass('overflow-hidden');
expect(scroller).not.toBeNull();
expect(scroller).not.toContainElement(primary);
});

it('omits every slot that is not provided', () => {
renderMoment({
title: undefined,
Expand Down
43 changes: 29 additions & 14 deletions ui/components/ui/marketing-moment/marketing-moment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,25 +106,40 @@ export const MarketingMoment = ({
<Box
data-testid={dataTestId}
flexDirection={BoxFlexDirection.Column}
className={twMerge('h-full min-h-0 w-full flex-1', className)}
className={twMerge(
'h-full min-h-0 w-full flex-1 overflow-hidden',
className,
)}
>
<Box flexDirection={BoxFlexDirection.Column} gap={4} className="shrink-0">
{renderTitle()}
{renderDescription()}
{children}
</Box>

{artwork ? (
<Box
flexDirection={BoxFlexDirection.Column}
className="min-h-0 w-full flex-1 overflow-y-auto"
>
<Box
flexDirection={BoxFlexDirection.Column}
alignItems={BoxAlignItems.Center}
justifyContent={BoxJustifyContent.Center}
{...artworkBoxProps}
className={twMerge('w-full flex-1 overflow-hidden', artworkClassName)}
gap={4}
className="shrink-0"
>
{artwork}
{renderTitle()}
{renderDescription()}
{children}
</Box>
) : null}

{artwork ? (
<Box
flexDirection={BoxFlexDirection.Column}
alignItems={BoxAlignItems.Center}
justifyContent={BoxJustifyContent.Center}
{...artworkBoxProps}
className={twMerge(
'w-full flex-1 overflow-hidden',
artworkClassName,
)}
>
{artwork}
</Box>
) : null}
</Box>

{primaryAction || secondaryAction ? (
<Box
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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.

};
128 changes: 73 additions & 55 deletions ui/pages/onboarding-flow/creation-successful/creation-successful.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -169,78 +173,92 @@ export default function CreationSuccessful() {
);
};

const openWalletDisabled = isSidePanelEnabled && isSidePanelOpen;

const handleLearnMoreClick = () => {
global.platform.openTab({
url: learnMoreLink,
});
};

if (!isFromSettingsSRPBackup) {
return (
<MarketingMoment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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',

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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 (

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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>
);
}
35 changes: 0 additions & 35 deletions ui/pages/onboarding-flow/creation-successful/index.scss

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -83,12 +82,8 @@ export default function WalletReadyAnimation() {
status === 'loading' ||
status === 'failed'
) {
return <Box className="riv-animation__wallet-ready-container"></Box>;
return null;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same result regardless of approach

Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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" />;
}
1 change: 0 additions & 1 deletion ui/pages/onboarding-flow/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
@import 'onboarding-app-header/index';
@import 'privacy-settings/index';
@import 'create-password/index';
@import 'creation-successful/index';
@import 'welcome/index';
@import 'metametrics/index';

Expand Down
Loading