Skip to content

Commit

Permalink
[WALL] [Fix] Rostislav / WALL-3320 / Transaction tab MT5 transactions…
Browse files Browse the repository at this point in the history
… name & badge (#13045)

* fix: align with transfer account selection form

* fix: logical correction

* fix: no need to use an extra func

* fix: one more logical simplification
  • Loading branch information
rostislav-deriv authored Jan 25, 2024
1 parent f2b13c7 commit ccccb54
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type TProps = {
isInterWallet?: boolean;
landingCompanyName?: TWalletLandingCompanyName;
mt5Group?: string;
mt5LandingCompanyName?: string;
};

const TransactionsCompletedRowAccountDetails: React.FC<TProps> = ({
Expand All @@ -31,6 +32,7 @@ const TransactionsCompletedRowAccountDetails: React.FC<TProps> = ({
isInterWallet = false,
landingCompanyName,
mt5Group,
mt5LandingCompanyName,
}) => {
return (
<div className='wallets-transactions-completed-row-account-details'>
Expand All @@ -52,7 +54,7 @@ const TransactionsCompletedRowAccountDetails: React.FC<TProps> = ({
<WalletText color='general' size='xs' weight='bold'>
{displayAccountName}
</WalletText>
{!isDemo && <WalletListCardBadge label={landingCompanyName} />}
{!isDemo && <WalletListCardBadge label={mt5LandingCompanyName ?? landingCompanyName} />}
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import { useActiveWalletAccount } from '@deriv/api';
import { THooks, TWalletLandingCompanyName } from '../../../../../../../../types';
import { getAccountName } from '../../../../../../helpers';
import { TransactionsCompletedRowAccountDetails } from '../TransactionsCompletedRowAccountDetails';
Expand All @@ -10,6 +11,8 @@ type TProps = {
};

const TransactionsCompletedRowTransferAccountDetails: React.FC<TProps> = ({ accounts, direction, loginid }) => {
const { data: activeWallet } = useActiveWalletAccount();

const wallet = accounts.wallets?.find(account => account.loginid === loginid);
const dtradeAccount = accounts.dtrade?.find(account => account.loginid === loginid);
const dxtradeAccount = accounts.dxtrade?.find(account => account.account_id === loginid);
Expand All @@ -24,25 +27,28 @@ const TransactionsCompletedRowTransferAccountDetails: React.FC<TProps> = ({ acco
if (transferAccount) {
const derivAccountType = transferAccount === wallet ? 'wallet' : 'standard';
const accountType = transferAccount?.platform !== 'deriv' ? transferAccount.platform : derivAccountType;
const mt5LandingCompanyName = transferAccount === mt5Account ? mt5Account.landing_company_name : undefined;
const displayAccountName = getAccountName({
accountCategory: transferAccount === wallet ? 'wallet' : 'trading',
//@ts-expect-error this needs backend typing
accountType,
displayCurrencyCode: transferAccount.currency_config?.display_code ?? 'USD',
landingCompanyName: transferAccount.landing_company_name as TWalletLandingCompanyName,
landingCompanyName: activeWallet?.landing_company_name as TWalletLandingCompanyName,
mt5MarketType: transferAccount === mt5Account ? mt5Account.market_type : undefined,
});

return (
<TransactionsCompletedRowAccountDetails
accountType={accountType ?? ''}
accountType={accountType}
actionType='transfer'
currency={transferAccount.currency ?? 'USD'}
displayAccountName={displayAccountName ?? ''}
displayActionType={`Transfer ${direction}`}
isDemo={Boolean(transferAccount.is_virtual)}
isInterWallet={transferAccount === wallet}
landingCompanyName={activeWallet?.landing_company_name as TWalletLandingCompanyName}
mt5Group={transferAccount === mt5Account ? mt5Account.group : undefined}
mt5LandingCompanyName={mt5LandingCompanyName}
/>
);
}
Expand Down

1 comment on commit ccccb54

@vercel
Copy link

@vercel vercel bot commented on ccccb54 Jan 25, 2024

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

deriv-app – ./

deriv-app.vercel.app
binary.sx
deriv-app-git-master.binary.sx
deriv-app.binary.sx

Please sign in to comment.