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-3967/ Fix "USD" is missing from swap free account creation success card #15012

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 @@ -39,6 +39,11 @@ const MT5AccountAdded: FC<TProps> = ({ account, marketType, platform }) => {

const isDemo = activeWallet?.is_virtual;

const displayBalance = useMemo(() => {
const account = mt5Accounts?.find(account => account.market_type === marketType);
return account?.display_balance;
}, [mt5Accounts, marketType]);

const renderAccountSuccessButton = useCallback(
(isTransferAllowed = false) => {
if (isTransferAllowed) {
Expand Down Expand Up @@ -70,14 +75,20 @@ const MT5AccountAdded: FC<TProps> = ({ account, marketType, platform }) => {
[hide, history, addedAccount?.loginid, isMobile]
);

const renderMainContent = useMemo(() => {
const renderSuccessDescription = () => {
if (isDemo) {
return `Let's practise trading with ${activeWallet?.display_balance} virtual funds.`;
}
return `Transfer funds from your ${activeWallet?.wallet_currency_type} Wallet to your ${marketTypeTitle} ${landingCompanyName} account to start trading.`;
};
const renderSuccessDescription = useMemo(() => {
if (isDemo) {
return `Let's practise trading with ${activeWallet?.display_balance} virtual funds.`;
}
return `Transfer funds from your ${activeWallet?.wallet_currency_type} Wallet to your ${marketTypeTitle} ${landingCompanyName} account to start trading.`;
}, [
activeWallet?.display_balance,
activeWallet?.wallet_currency_type,
isDemo,
landingCompanyName,
marketTypeTitle,
]);

const renderMainContent = useMemo(() => {
if (!isSuccess) return null;

if (!verificationStatus.is_not_applicable && !isPOIVerified && !isPOAVerified) {
Expand All @@ -87,9 +98,7 @@ const MT5AccountAdded: FC<TProps> = ({ account, marketType, platform }) => {
description={`We need a few minutes to review your documents before you can start trading with your ${marketTypeTitle} ${
isDemo ? ' demo' : landingCompanyName
} account. You’ll get an in-app notification as soon as this is done.`}
displayBalance={
mt5Accounts?.find(account => account.market_type === marketType)?.display_balance ?? '0.00'
}
displayBalance={displayBalance}
landingCompany={selectedJurisdiction}
marketType={marketType}
platform={platform}
Expand All @@ -105,9 +114,7 @@ const MT5AccountAdded: FC<TProps> = ({ account, marketType, platform }) => {
description={`We need 1-3 days to review your documents before you can start trading with your ${marketTypeTitle} ${
isDemo ? ' demo' : landingCompanyName
} account. You’ll get an email as soon as this is done.`}
displayBalance={
mt5Accounts?.find(account => account.market_type === marketType)?.display_balance ?? '0.00'
}
displayBalance={displayBalance}
landingCompany={selectedJurisdiction}
marketType={marketType}
platform={platform}
Expand All @@ -120,10 +127,8 @@ const MT5AccountAdded: FC<TProps> = ({ account, marketType, platform }) => {

return (
<CFDSuccess
description={renderSuccessDescription()}
displayBalance={
mt5Accounts?.find(account => account.market_type === marketType)?.display_balance ?? '0.00'
}
description={renderSuccessDescription}
displayBalance={displayBalance}
landingCompany={selectedJurisdiction}
marketType={marketType}
platform={platform}
Expand All @@ -132,19 +137,18 @@ const MT5AccountAdded: FC<TProps> = ({ account, marketType, platform }) => {
/>
);
}, [
activeWallet?.display_balance,
activeWallet?.wallet_currency_type,
displayBalance,
isDemo,
isPOAVerified,
isPOIVerified,
isSuccess,
landingCompanyName,
marketType,
marketTypeTitle,
mt5Accounts,
platform,
poiService,
renderAccountSuccessButton,
renderSuccessDescription,
selectedJurisdiction,
verificationStatus.is_not_applicable,
]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '../../../../components/SkeletonLoader/SkeletonLoader.scss';

.wallets-cfd-success {
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -40,4 +42,9 @@
&__gradient {
border-radius: 1rem;
}

&__balance-loader {
padding: 0.7rem;
width: 8rem;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,13 @@ const CFDSuccess: React.FC<TSuccessProps> = ({
<WalletText color='primary' size='2xs'>
{data?.currency} Wallet
</WalletText>
<WalletText size='sm' weight='bold'>
{displayBalance}
</WalletText>
{!displayBalance ? (
<div className='wallets-skeleton wallets-cfd-success__balance-loader' />
) : (
<WalletText size='sm' weight='bold'>
{displayBalance}
</WalletText>
)}
</div>
</div>
</div>
Expand Down
Loading