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

[WALL] Aizad/WALL-4096/Skip Step Add More Wallets #15249

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
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Joyride, { CallBackProps, STATUS } from 'react-joyride';
import { useLocalStorage, useReadLocalStorage } from 'usehooks-ts';
import {
useActiveWalletAccount,
useAllWalletAccounts,
useAuthorize,
useCtraderAccountsList,
useDxtradeAccountsList,
Expand Down Expand Up @@ -31,13 +32,15 @@ const WalletTourGuide = () => {
const { isFetching: ctraderIsLoading } = useCtraderAccountsList();
const { isFetching: dxtradeIsLoading } = useDxtradeAccountsList();
const { isFetching: sortedAccountsIsLoading } = useSortedMT5Accounts();
const { data: availableWallets } = useAllWalletAccounts();

const needToStart = walletsOnboarding === START_VALUE;
const activeWalletLoginId = activeWallet?.loginid;
const fiatWalletLoginId = getFiatWalletLoginId(wallets);
const activeFiatWalletLoginId = fiatWalletLoginId == activeWalletLoginId;
const isEverythingLoaded =
!isLoading && !isFetching && isSuccess && !ctraderIsLoading && !dxtradeIsLoading && !sortedAccountsIsLoading;
const allWalletsAreAdded = Boolean(availableWallets?.every(wallet => wallet.is_added));

useEffect(() => {
const switchAccountAndRun = async () => {
Expand Down Expand Up @@ -81,7 +84,7 @@ const WalletTourGuide = () => {
floaterProps={{ disableAnimation: true }}
run={run}
scrollOffset={isMobile ? 100 : 80}
steps={isMobile ? mobileStepTourGuide : desktopStepTourGuide}
steps={isMobile ? mobileStepTourGuide(allWalletsAreAdded) : desktopStepTourGuide(allWalletsAreAdded)}
tooltipComponent={TooltipComponent}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const stepProps = {
spotlightPadding: 0,
};

export const desktopStepTourGuide: Step[] = [
export const desktopStepTourGuide = (allWalletsAreAdded: boolean): Step[] => [
{
content: <WalletText size='sm'>Manage your funds with Wallets.</WalletText>,
placement: 'bottom-start',
Expand All @@ -29,7 +29,7 @@ export const desktopStepTourGuide: Step[] = [
},
{
content: <WalletText size='sm'>Switch to a Wallet from the drop-down menu.</WalletText>,
disableScrolling: false,
disableScrolling: !!allWalletsAreAdded,
placement: 'bottom',
target: '.wallets-textfield__box',
title: <SpotLightHeader>Change your Wallet</SpotLightHeader>,
Expand All @@ -45,7 +45,7 @@ export const desktopStepTourGuide: Step[] = [
disableScrolling: false,
placement: 'right',
styles: { spotlight: { borderRadius: '1.6rem' } },
target: '.wallets-add-more__card',
target: allWalletsAreAdded ? 'null' : '.wallets-add-more__card',
title: (
<WalletText color='red' size='sm' weight='bold'>
Add more currencies
Expand All @@ -68,7 +68,7 @@ export const desktopStepTourGuide: Step[] = [
},
];

export const mobileStepTourGuide: Step[] = [
export const mobileStepTourGuide = (allWalletsAreAdded: boolean): Step[] => [
{
content: <WalletText size='sm'>Manage your funds with Wallets.</WalletText>,
placement: 'bottom',
Expand All @@ -79,6 +79,7 @@ export const mobileStepTourGuide: Step[] = [
},
{
content: <WalletText size='sm'>Swipe left or right to switch between Wallets.</WalletText>,
disableScrolling: !!allWalletsAreAdded,
placement: 'bottom',
styles: { spotlight: { borderRadius: '0' } },
target: '.wallets-carousel-content__wrapper',
Expand All @@ -87,6 +88,7 @@ export const mobileStepTourGuide: Step[] = [
},
{
content: <WalletText size='sm'>Press the tab to switch between CFDs and Options accounts.</WalletText>,
disableScrolling: !!allWalletsAreAdded,
placement: 'bottom',
styles: { spotlight: { borderRadius: '0.8rem' } },
target: '.wallets-tabs-list',
Expand All @@ -99,14 +101,16 @@ export const mobileStepTourGuide: Step[] = [
Want Wallets in other currencies too? Press <strong>Add</strong>.
</WalletText>
),
disableScrolling: !!allWalletsAreAdded,
placement: 'top',
styles: { spotlight: { borderRadius: '1.6rem' } },
target: '.wallets-add-more__card',
target: allWalletsAreAdded ? 'null' : '.wallets-add-more__card',
title: <SpotLightHeader>Add more currencies</SpotLightHeader>,
...stepProps,
},
{
content: <WalletText size='sm'>Press here to repeat this tour.</WalletText>,
disableScrolling: !!allWalletsAreAdded,
placement: 'bottom',
styles: { spotlight: { borderRadius: '0 0 0.8rem 0.8rem' } },
target: '.traders-hub-header__tradershub--onboarding--logo',
Expand Down
Loading