Skip to content
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

Sergei / wall 2127 / implement simple onboarding steps #10716

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
1 change: 1 addition & 0 deletions packages/wallets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"qrcode.react": "^1.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-joyride": "^2.5.3",
"react-router-dom": "^5.2.0",
"usehooks-ts": "^2.7.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@
color: #000000;
}

&-color-red {
color: #ff444f;
}

&-color-blue {
color: #377cfc;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.wallets-tour-guide {
&__container {
display: flex;
flex-direction: column;
align-items: flex-start;
align-self: stretch;
border-radius: 0.8rem;
background: var(--system-light-8-primary-background, #fff);
width: 28rem;

/* Shadows/xxxl */
box-shadow: 0px 32px 64px 0px rgba(14, 14, 14, 0.14);
}

&__header {
display: flex;
height: 4.8rem;
padding: 0.8rem 0.8rem 0.8rem 1.6rem;
align-items: center;
gap: 1rem;
align-self: stretch;

border-radius: 0.8rem 0.8rem 0rem 0rem;
background: var(--system-light-8-primary-background, #fff);

/* divider/light/bottom/1px */
box-shadow: 0px -1px 0px 0px #f2f3f4 inset;
}

&__content {
display: flex;
padding: 1.6rem;
flex-direction: column;
align-items: flex-start;
gap: 0.8rem;
align-self: stretch;
}

&__footer {
display: flex;
height: 4rem;
padding: 0rem 1.6rem 1.6rem;
justify-content: flex-end;
align-items: center;
gap: 1rem;
align-self: stretch;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from 'react';
import Joyride, { CallBackProps } from 'react-joyride';
import { tourStepConfig, TooltipComponent } from './WalletTourGuideSettings';
import './WalletTourGuide.scss';

type TProps = {
isStarted?: boolean;
setIsStarted?: (value: boolean) => void;
};

const WalletTourGuide = ({ isStarted = false, setIsStarted }: TProps) => {
const callbackHandle = (data: CallBackProps) => {
if (data.action === 'reset') {
setIsStarted?.(false);
}
};

return (
<Joyride
callback={callbackHandle}
continuous
disableCloseOnEsc
disableScrolling
floaterProps={{
disableAnimation: true,
}}
run={isStarted}
steps={tourStepConfig}
tooltipComponent={TooltipComponent}
/>
);
};

export default WalletTourGuide;
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import React from 'react';
import { Step, TooltipRenderProps } from 'react-joyride';
import { WalletButton, WalletText } from '../Base';
import './WalletTourGuide.scss';

export const tourStepConfig: Step[] = [
{
content: (
<WalletText size='sm'>
This is your Wallet. These are the functions that you can perform within this Wallet and you can
conveniently view your total balance here.
</WalletText>
),
disableBeacon: true,
disableOverlayClose: true,
target: '.wallets-accordion__header:has(+ .wallets-accordion__content--visible)',
title: (
<WalletText color='red' size='sm' weight='bold'>
Wallets
</WalletText>
),
},
{
content: <WalletText size='sm'>Step 2</WalletText>,
disableBeacon: true,
disableOverlayClose: true,
target: '.wallets-accordion__header:has(+ .wallets-accordion__content--visible)',
title: (
<WalletText color='red' size='sm' weight='bold'>
Wallets
</WalletText>
),
},
];

export const TooltipComponent = ({
backProps,
closeProps,
continuous,
index,
isLastStep,
primaryProps,
step,
tooltipProps,
}: TooltipRenderProps) => {
return (
<div {...tooltipProps} className='wallets-tour-guide__container'>
<div className='wallets-tour-guide__header'>{step?.title as React.ReactNode}</div>
{<div className='wallets-tour-guide__content'>{step.content as React.ReactNode}</div>}
<div className='wallets-tour-guide__footer'>
{index > 0 && (
<WalletButton {...backProps} color='white' variant='outlined'>
<WalletText align='center' color='black' size='sm' weight='bold'>
Back
</WalletText>
</WalletButton>
)}
{continuous && (
<WalletButton {...primaryProps}>
<WalletText align='center' color='white' size='sm' weight='bold'>
{`${isLastStep ? 'Close' : 'Next'}`}
</WalletText>
</WalletButton>
)}
{!continuous && (
<WalletButton {...closeProps}>
<WalletText align='center' color='white' size='sm' weight='bold'>
Close
</WalletText>
</WalletButton>
)}
</div>
</div>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as WalletTourGuide } from './WalletTourGuide';
1 change: 1 addition & 0 deletions packages/wallets/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ export * from './WalletsAccordion';
export * from './WalletsAddMoreCarousel';
export * from './WalletsCarousel';
export * from './WalletsCarouselContent';
export * from './WalletTourGuide';
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { DesktopWalletsList, WalletsAddMoreCarousel, WalletsCarousel } from '../../components';
import { DesktopWalletsList, WalletsAddMoreCarousel, WalletsCarousel, WalletTourGuide } from '../../components';
import useDevice from '../../hooks/useDevice';
import './WalletsListingRoute.scss';

Expand All @@ -10,6 +10,7 @@ const WalletsListingRoute: React.FC = () => {
<div className='wallets-listing-route'>
{isMobile ? <WalletsCarousel /> : <DesktopWalletsList />}
<WalletsAddMoreCarousel />
<WalletTourGuide />
</div>
);
};
Expand Down