diff --git a/packages/wallets/src/components/AccountsList/__tests__/AccountsList.spec.tsx b/packages/wallets/src/components/AccountsList/__tests__/AccountsList.spec.tsx index 4f451fa71c3a..6405dc1e3256 100644 --- a/packages/wallets/src/components/AccountsList/__tests__/AccountsList.spec.tsx +++ b/packages/wallets/src/components/AccountsList/__tests__/AccountsList.spec.tsx @@ -52,7 +52,6 @@ describe('AccountsList', () => { expect(screen.getByTestId('dt_tab_panels')).toBeInTheDocument(); expect(screen.getByText('CFDs')).toBeInTheDocument(); expect(screen.getByText('Options')).toBeInTheDocument(); - expect(screen.getByText('Deriv MT5')).toBeInTheDocument(); expect(screen.getByText('Compare accounts')).toBeInTheDocument(); }); diff --git a/packages/wallets/src/components/OptionsAndMultipliersListing/OptionsAndMultipliersListing.scss b/packages/wallets/src/components/OptionsAndMultipliersListing/OptionsAndMultipliersListing.scss index 8b06ba90a909..2765e2068c6b 100644 --- a/packages/wallets/src/components/OptionsAndMultipliersListing/OptionsAndMultipliersListing.scss +++ b/packages/wallets/src/components/OptionsAndMultipliersListing/OptionsAndMultipliersListing.scss @@ -2,17 +2,12 @@ width: 100%; height: 100%; padding-top: 2.4rem; + border-top: 0.2rem solid var(--system-light-7-secondary-background, #f2f3f4); @include mobile { padding-top: unset; } - &--border { - @include desktop { - border-top: 0.2rem solid var(--system-light-7-secondary-background, #f2f3f4); - } - } - &__header { display: flex; align-items: center; diff --git a/packages/wallets/src/components/OptionsAndMultipliersListing/OptionsAndMultipliersListing.tsx b/packages/wallets/src/components/OptionsAndMultipliersListing/OptionsAndMultipliersListing.tsx index 6ccd3b79f72d..66299ce7c4e5 100644 --- a/packages/wallets/src/components/OptionsAndMultipliersListing/OptionsAndMultipliersListing.tsx +++ b/packages/wallets/src/components/OptionsAndMultipliersListing/OptionsAndMultipliersListing.tsx @@ -2,7 +2,7 @@ import React, { useEffect } from 'react'; import classNames from 'classnames'; import { Trans } from 'react-i18next'; import { useHistory } from 'react-router-dom'; -import { useActiveLinkedToTradingAccount, useActiveWalletAccount } from '@deriv/api-v2'; +import { useActiveLinkedToTradingAccount } from '@deriv/api-v2'; import { optionsAndMultipliersContent } from '../../constants/constants'; import { getStaticUrl, getUrlBinaryBot, getUrlSmartTrader } from '../../helpers/urls'; import useDevice from '../../hooks/useDevice'; @@ -85,7 +85,6 @@ const OptionsAndMultipliersListing: React.FC onOptionsAndMultipliersLoaded, }) => { const { isMobile } = useDevice(); - const { data: activeWalletAccount } = useActiveWalletAccount(); const { data: activeLinkedToTradingAccount } = useActiveLinkedToTradingAccount(); useEffect(() => { @@ -94,11 +93,7 @@ const OptionsAndMultipliersListing: React.FC }, [onOptionsAndMultipliersLoaded]); return ( -
+
{!isMobile && ( diff --git a/packages/wallets/src/components/TradingAccountCard/TradingAccountCard.scss b/packages/wallets/src/components/TradingAccountCard/TradingAccountCard.scss index 472a6451518e..3484fa4edc36 100644 --- a/packages/wallets/src/components/TradingAccountCard/TradingAccountCard.scss +++ b/packages/wallets/src/components/TradingAccountCard/TradingAccountCard.scss @@ -1,30 +1,38 @@ .wallets-trading-account-card { display: flex; align-items: center; - gap: 16px; - height: 88px; + gap: 1.6rem; + height: 8.8rem; + border: none; + background: none; @include desktop { + padding: 0 2.3rem 0 1.6rem; $columns: 3; - $grid-last-row-children: '&:nth-child(#{$columns}n+1):nth-last-child(-n+#{$columns})'; + $grid-last-row-children: '&:nth-last-child(-n+#{$columns})'; #{$grid-last-row-children} > &__content, #{$grid-last-row-children} ~ & > &__content { border-bottom: none; } + + &:hover { + cursor: pointer; + background-color: var(--system-light-6-hover-background, #e6e9e9); + border-radius: 0.8rem; + } } @include mobile { - $columns: 1; - $grid-last-row-children: '&:nth-child(#{$columns}n+1):nth-last-child(-n+#{$columns})'; - #{$grid-last-row-children} > &__content, - #{$grid-last-row-children} ~ & > &__content { + height: 8rem; + &:last-child > &__content, + &:last-child ~ & > &__content { border-bottom: none; } } &__content { display: flex; - gap: 16px; + gap: 1.6rem; align-items: center; flex-grow: 1; height: 100%; diff --git a/packages/wallets/src/components/TradingAccountCard/TradingAccountCard.tsx b/packages/wallets/src/components/TradingAccountCard/TradingAccountCard.tsx index e4ac4d115592..ab636b8c8d81 100644 --- a/packages/wallets/src/components/TradingAccountCard/TradingAccountCard.tsx +++ b/packages/wallets/src/components/TradingAccountCard/TradingAccountCard.tsx @@ -1,20 +1,33 @@ -import React from 'react'; +import React, { ComponentProps } from 'react'; import './TradingAccountCard.scss'; type TProps = { + disabled?: ComponentProps<'button'>['disabled']; leading?: React.ReactNode; + onClick?: ComponentProps<'button'>['onClick']; trailing?: React.ReactNode; }; -const TradingAccountCard: React.FC> = ({ children, leading, trailing }) => { +const TradingAccountCard: React.FC> = ({ + children, + disabled, + leading, + onClick, + trailing, +}) => { return ( -
+
+ ); }; diff --git a/packages/wallets/src/components/WalletTourGuide/DesktopSteps.tsx b/packages/wallets/src/components/WalletTourGuide/DesktopSteps.tsx index 9897a41c0a4b..3afe0445a072 100644 --- a/packages/wallets/src/components/WalletTourGuide/DesktopSteps.tsx +++ b/packages/wallets/src/components/WalletTourGuide/DesktopSteps.tsx @@ -7,8 +7,7 @@ const getDesktopSteps = ( isDemoWallet: boolean, hasMT5Account: boolean, hasDerivAppsTradingAccount: boolean, - isAllWalletsAlreadyAdded: boolean, - walletNumber = 1 + isAllWalletsAlreadyAdded: boolean ): Step[] => [ // Wallet header { @@ -23,7 +22,7 @@ const getDesktopSteps = ( placement: 'bottom', spotlightPadding: 0, styles: { spotlight: { borderRadius: '1.6rem 1.6rem 0rem 0rem' } }, - target: `.wallets-accordion:nth-child(${walletNumber}) .wallets-accordion__header`, + target: `.wallets-card__header`, title: ( Wallets @@ -52,7 +51,7 @@ const getDesktopSteps = ( borderRadius: '6.4rem', }, }, - target: `.wallets-accordion:nth-child(${walletNumber}) .wallets-accordion__header .wallets-header__actions`, + target: `.wallets-card__header .wallets-header__actions`, title: ( Wallet actions @@ -75,7 +74,7 @@ const getDesktopSteps = ( placement: 'right', spotlightPadding: 5, styles: { spotlight: { borderRadius: '0.4rem' } }, - target: '.wallets-mt5-list__content .wallets-trading-account-card', + target: '.wallets-cfd-list-accounts__content .wallets-trading-account-card', title: ( CFDs trading accounts @@ -86,12 +85,12 @@ const getDesktopSteps = ( { content: hasDerivAppsTradingAccount ? ( - This is your Deriv Apps trading account balance. Click Transfer to move funds between your Wallet and - Deriv Apps trading account. + This is your Options trading account balance. Click Transfer to move funds between your Wallet and + Options trading account. ) : ( - This is your Deriv Apps trading account. Click Get to create the Deriv Apps trading account for trading. + This is your Options trading account. Click Get to create the Options trading account for trading. ), disableBeacon: true, @@ -102,7 +101,7 @@ const getDesktopSteps = ( target: '.wallets-deriv-apps-section', title: ( - Deriv Apps trading account + Options trading account ), }, @@ -112,7 +111,7 @@ const getDesktopSteps = ( Choose a Deriv app to trade options or multipliers. ) : ( - Once you have get a Deriv Apps trading account, choose a Deriv app to trade options or multipliers. + Once you have get an Options trading account, choose a Deriv app to trade options or multipliers. ), disableBeacon: true, diff --git a/packages/wallets/src/components/WalletTourGuide/MobileSteps.tsx b/packages/wallets/src/components/WalletTourGuide/MobileSteps.tsx index 72676eb1e68f..5ae12a9f6886 100644 --- a/packages/wallets/src/components/WalletTourGuide/MobileSteps.tsx +++ b/packages/wallets/src/components/WalletTourGuide/MobileSteps.tsx @@ -89,7 +89,7 @@ const getMobileSteps = ( placement: 'top', spotlightPadding: 5, styles: { spotlight: { borderRadius: '0.8rem' } }, - target: '.wallets-mt5-list__content .wallets-trading-account-card', + target: '.wallets-cfd-list-accounts__content .wallets-trading-account-card', title: ( CFDs trading accounts @@ -100,12 +100,12 @@ const getMobileSteps = ( { content: hasDerivAppsTradingAccount ? ( - This is your Deriv Apps trading account balance. Click Transfer to move funds between your Wallet and - Deriv Apps trading account. + This is your Options trading account balance. Click Transfer to move funds between your Wallet and + Options trading account. ) : ( - This is your Deriv Apps trading account. Click Get to create the Deriv Apps trading account for trading. + This is your Options trading account. Click Get to create the Options trading account for trading. ), disableBeacon: true, @@ -116,7 +116,7 @@ const getMobileSteps = ( target: '.wallets-deriv-apps-section', title: ( - Deriv Apps trading account + Options trading account ), }, @@ -126,7 +126,7 @@ const getMobileSteps = ( Choose a Deriv app to trade options or multipliers. ) : ( - Once you have get a Deriv Apps trading account, choose a Deriv app to trade options or multipliers. + Once you have get an Options trading account, choose a Deriv app to trade options or multipliers. ), disableBeacon: true, diff --git a/packages/wallets/src/components/WalletTourGuide/WalletTourGuideSettings.tsx b/packages/wallets/src/components/WalletTourGuide/WalletTourGuideSettings.tsx index 2752ac2c3953..a02e86f5c723 100644 --- a/packages/wallets/src/components/WalletTourGuide/WalletTourGuideSettings.tsx +++ b/packages/wallets/src/components/WalletTourGuide/WalletTourGuideSettings.tsx @@ -20,13 +20,7 @@ export const tourStepConfig = ( ): Step[] => isMobile ? getMobileSteps(isDemoWallet, hasMT5Account, hasDerivAppsTradingAccount, isAllWalletsAlreadyAdded, walletIndex) - : getDesktopSteps( - isDemoWallet, - hasMT5Account, - hasDerivAppsTradingAccount, - isAllWalletsAlreadyAdded, - walletIndex - ); + : getDesktopSteps(isDemoWallet, hasMT5Account, hasDerivAppsTradingAccount, isAllWalletsAlreadyAdded); export const TooltipComponent = ({ backProps, diff --git a/packages/wallets/src/components/WalletsCarousel/WalletsCarousel.tsx b/packages/wallets/src/components/WalletsCarousel/WalletsCarousel.tsx index 84bb3b66f2f3..ac02c283f703 100644 --- a/packages/wallets/src/components/WalletsCarousel/WalletsCarousel.tsx +++ b/packages/wallets/src/components/WalletsCarousel/WalletsCarousel.tsx @@ -28,6 +28,7 @@ const WalletsCarousel: React.FC = () => { useEventListener('touchmove', handleScroll, containerRef); useEventListener('touchend', handleScroll, containerRef); useEventListener('scroll', handleScroll, containerRef); + useEventListener('wheel', handleScroll, containerRef); useEffect(() => { let isMounted = true; diff --git a/packages/wallets/src/components/WalletsContainer/WalletsContainer.scss b/packages/wallets/src/components/WalletsContainer/WalletsContainer.scss index 85861b8b3766..d98f66cbbc1e 100644 --- a/packages/wallets/src/components/WalletsContainer/WalletsContainer.scss +++ b/packages/wallets/src/components/WalletsContainer/WalletsContainer.scss @@ -4,10 +4,6 @@ border-radius: 1.6rem; position: relative; - &--virtual { - background: var(--system-light-8-primary-background, #fffafa); - } - &__header { width: 100%; display: flex; @@ -16,22 +12,6 @@ gap: 2.4rem; border-radius: 1.6rem; position: relative; - - &--virtual { - &:before { - content: ''; - display: block; - position: absolute; - inset: 0; - width: 100%; - height: 100%; - border-radius: 1.6rem; - background-image: url('../../public/images/wallet-demo-desktop-bg.svg'); - background-repeat: repeat; - background-size: 6rem; - opacity: 0.24; - } - } } &__content { diff --git a/packages/wallets/src/features/cfd/CFDPlatformsList.tsx b/packages/wallets/src/features/cfd/CFDPlatformsList.tsx index 90c5e1349b8e..1a299c4f4c4c 100644 --- a/packages/wallets/src/features/cfd/CFDPlatformsList.tsx +++ b/packages/wallets/src/features/cfd/CFDPlatformsList.tsx @@ -5,7 +5,7 @@ import { useActiveWalletAccount } from '@deriv/api-v2'; import { WalletButton, WalletLink, WalletText } from '../../components/Base'; import useDevice from '../../hooks/useDevice'; import CFDPlatformsListEmptyState from './CFDPlatformsListEmptyState'; -import { CTraderList, MT5PlatformsList, OtherCFDPlatformsList } from './components'; +import { CFDPlatformsListAccounts } from './components'; import './CFDPlatformsList.scss'; type TProps = { @@ -76,11 +76,7 @@ const CFDPlatformsList: React.FC = ({ onMT5PlatformListLoaded }) => { {activeWallet?.currency_config?.is_crypto ? ( ) : ( - - - - - + )}
); diff --git a/packages/wallets/src/features/cfd/components/CFDPlatformsListAccounts/CFDPlatformsListAccounts.scss b/packages/wallets/src/features/cfd/components/CFDPlatformsListAccounts/CFDPlatformsListAccounts.scss new file mode 100644 index 000000000000..3d6f2a7b780a --- /dev/null +++ b/packages/wallets/src/features/cfd/components/CFDPlatformsListAccounts/CFDPlatformsListAccounts.scss @@ -0,0 +1,17 @@ +.wallets-cfd-list-accounts { + &__content { + display: grid; + grid-template-columns: repeat(3, 1fr); + padding-bottom: 2.4rem; + + @include desktop { + gap: 1.6rem 4.8rem; + } + + @include mobile { + grid-template-rows: repeat(3, 1fr); + grid-template-columns: auto; + padding-bottom: 1.6rem; + } + } +} diff --git a/packages/wallets/src/features/cfd/components/CFDPlatformsListAccounts/CFDPlatformsListAccounts.tsx b/packages/wallets/src/features/cfd/components/CFDPlatformsListAccounts/CFDPlatformsListAccounts.tsx new file mode 100644 index 000000000000..b249780f57e8 --- /dev/null +++ b/packages/wallets/src/features/cfd/components/CFDPlatformsListAccounts/CFDPlatformsListAccounts.tsx @@ -0,0 +1,66 @@ +import React, { useEffect, useMemo } from 'react'; +import { + useActiveWalletAccount, + useCtraderAccountsList, + useDxtradeAccountsList, + useSortedMT5Accounts, +} from '@deriv/api-v2'; +import { TradingAppCardLoader } from '../../../../components/SkeletonLoader'; +import { + AddedCTraderAccountsList, + AddedDxtradeAccountsList, + AddedMT5AccountsList, + AvailableCTraderAccountsList, + AvailableDxtradeAccountsList, + AvailableMT5AccountsList, +} from '../../flows'; +import { GetMoreMT5Accounts } from '../../screens'; +import './CFDPlatformsListAccounts.scss'; + +type TProps = { + onMT5PlatformListLoaded?: (value: boolean) => void; +}; + +const CFDPlatformsListAccounts: React.FC = ({ onMT5PlatformListLoaded }) => { + const { areAllAccountsCreated, data: mt5AccountsList, isLoading: isMT5Loading } = useSortedMT5Accounts(); + const { data: ctraderAccountsList } = useCtraderAccountsList(); + const { data: dxtradeAccountsList } = useDxtradeAccountsList(); + const { data: activeWallet } = useActiveWalletAccount(); + + const hasMT5Account = useMemo(() => { + return mt5AccountsList?.some(account => account.is_added); + }, [mt5AccountsList]); + const hasCTraderAccount = !!ctraderAccountsList?.length; + const hasDxtradeAccount = !!dxtradeAccountsList?.length; + + useEffect(() => { + onMT5PlatformListLoaded?.(!isMT5Loading); + return () => onMT5PlatformListLoaded?.(false); + }, [isMT5Loading, onMT5PlatformListLoaded]); + + return ( +
+ {/* TODO: Update loader with updated skeleton loader design */} + {isMT5Loading && } + {!isMT5Loading && + mt5AccountsList?.map((account, index) => { + if (account.is_added) + return ( + + ); + + return ( + + ); + })} + {hasCTraderAccount ? : } + {hasDxtradeAccount ? : } + {hasMT5Account && !activeWallet?.is_virtual && !areAllAccountsCreated && } +
+ ); +}; + +export default CFDPlatformsListAccounts; diff --git a/packages/wallets/src/features/cfd/components/CFDPlatformsListAccounts/index.ts b/packages/wallets/src/features/cfd/components/CFDPlatformsListAccounts/index.ts new file mode 100644 index 000000000000..f11e4daee1d8 --- /dev/null +++ b/packages/wallets/src/features/cfd/components/CFDPlatformsListAccounts/index.ts @@ -0,0 +1 @@ +export { default as CFDPlatformsListAccounts } from './CFDPlatformsListAccounts'; diff --git a/packages/wallets/src/features/cfd/components/CTraderList/CTraderList.scss b/packages/wallets/src/features/cfd/components/CTraderList/CTraderList.scss deleted file mode 100644 index f4ddd46b271a..000000000000 --- a/packages/wallets/src/features/cfd/components/CTraderList/CTraderList.scss +++ /dev/null @@ -1,14 +0,0 @@ -.wallets-ctrader { - padding-bottom: 2.4rem; - - &__content { - display: grid; - gap: 1.6rem 4.8rem; - grid-template-columns: repeat(3, 1fr); - - @include mobile { - grid-template-rows: 1fr; - grid-template-columns: auto; - } - } -} diff --git a/packages/wallets/src/features/cfd/components/CTraderList/CTraderList.tsx b/packages/wallets/src/features/cfd/components/CTraderList/CTraderList.tsx deleted file mode 100644 index 118ad2ae4351..000000000000 --- a/packages/wallets/src/features/cfd/components/CTraderList/CTraderList.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import React from 'react'; -import { useCtraderAccountsList } from '@deriv/api-v2'; -import { WalletText } from '../../../../components/Base'; -import { PlatformDetails } from '../../constants'; -import { AddedCTraderAccountsList, AvailableCTraderAccountsList } from '../../flows/CTrader'; -import './CTraderList.scss'; - -const CTraderList: React.FC = () => { - const { data } = useCtraderAccountsList(); - const hasCTraderAccount = !!data?.length; - return ( -
- {PlatformDetails.ctrader.title} - -
- {hasCTraderAccount ? : } -
-
- ); -}; - -export default CTraderList; diff --git a/packages/wallets/src/features/cfd/components/CTraderList/index.ts b/packages/wallets/src/features/cfd/components/CTraderList/index.ts deleted file mode 100644 index fec483eec749..000000000000 --- a/packages/wallets/src/features/cfd/components/CTraderList/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default as CTraderList } from './CTraderList'; diff --git a/packages/wallets/src/features/cfd/components/MT5PlatformsList/MT5PlatformsList.scss b/packages/wallets/src/features/cfd/components/MT5PlatformsList/MT5PlatformsList.scss deleted file mode 100644 index 8afe8ecca81c..000000000000 --- a/packages/wallets/src/features/cfd/components/MT5PlatformsList/MT5PlatformsList.scss +++ /dev/null @@ -1,62 +0,0 @@ -.wallets-mt5-list { - &__title { - color: #333; - font-size: 1.6rem; - font-style: normal; - font-weight: 700; - line-height: 2.4rem; /* 150% */ - padding-bottom: 0.8rem; - } - - &__content { - display: grid; - gap: 1.6rem 4.8rem; - grid-template-columns: repeat(3, 1fr); - padding-bottom: 2.4rem; - - @include mobile { - grid-template-rows: repeat(3, 1fr); - grid-template-columns: auto; - padding-bottom: 1.6rem; - } - - &__details { - flex-grow: 1; - &-title { - font-weight: bold; - font-size: 1.4rem; - line-height: 2rem; - } - - &-description { - font-size: 1.2rem; - line-height: 1.4rem; - - @include mobile { - font-size: 1.4rem; - line-height: 2rem; - } - } - } - } -} - -.wallets-mt5-loader { - width: 4.8rem; - height: 4.8rem; - border: 0.5rem solid #fff; - border-bottom-color: #ff3d00; - border-radius: 50%; - display: inline-block; - box-sizing: border-box; - animation: rotation 1s linear infinite; -} - -@keyframes rotation { - 0% { - transform: rotate(0deg); - } - 100% { - transform: rotate(360deg); - } -} diff --git a/packages/wallets/src/features/cfd/components/MT5PlatformsList/MT5PlatformsList.tsx b/packages/wallets/src/features/cfd/components/MT5PlatformsList/MT5PlatformsList.tsx deleted file mode 100644 index 7d8e7150de02..000000000000 --- a/packages/wallets/src/features/cfd/components/MT5PlatformsList/MT5PlatformsList.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import React, { useEffect, useMemo } from 'react'; -import { useActiveWalletAccount, useAuthorize, useInvalidateQuery, useSortedMT5Accounts } from '@deriv/api-v2'; -import { TradingAppCardLoader } from '../../../../components/SkeletonLoader'; -import { AddedMT5AccountsList, AvailableMT5AccountsList } from '../../flows/MT5'; -import { GetMoreMT5Accounts } from '../../screens'; -import './MT5PlatformsList.scss'; - -type TProps = { - onMT5PlatformListLoaded?: (value: boolean) => void; -}; - -const MT5PlatformsList: React.FC = ({ onMT5PlatformListLoaded }) => { - const { isFetching } = useAuthorize(); - const { areAllAccountsCreated, data, isFetchedAfterMount } = useSortedMT5Accounts(); - const { data: activeWallet } = useActiveWalletAccount(); - const invalidate = useInvalidateQuery(); - - const hasMT5Account = useMemo(() => { - return data?.some(account => account.is_added); - }, [data]); - - useEffect(() => { - if (!isFetching) { - invalidate('mt5_login_list'); - } - }, [invalidate, isFetching]); - - useEffect(() => { - onMT5PlatformListLoaded?.(isFetchedAfterMount); - return () => onMT5PlatformListLoaded?.(false); - }, [isFetchedAfterMount, onMT5PlatformListLoaded]); - - return ( - -
-
-

Deriv MT5

-
-
- {!isFetchedAfterMount && } -
- {isFetchedAfterMount && - data?.map((account, index) => { - if (account.is_added) - return ( - - ); - - return ( - - ); - })} - {hasMT5Account && !activeWallet?.is_virtual && !areAllAccountsCreated && } -
-
- ); -}; - -export default MT5PlatformsList; diff --git a/packages/wallets/src/features/cfd/components/MT5PlatformsList/index.ts b/packages/wallets/src/features/cfd/components/MT5PlatformsList/index.ts deleted file mode 100644 index 3874ee4d73ef..000000000000 --- a/packages/wallets/src/features/cfd/components/MT5PlatformsList/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default as MT5PlatformsList } from './MT5PlatformsList'; diff --git a/packages/wallets/src/features/cfd/components/OtherCFDPlatformsList/OtherCFDPlatformsList.scss b/packages/wallets/src/features/cfd/components/OtherCFDPlatformsList/OtherCFDPlatformsList.scss deleted file mode 100644 index 648cf782d575..000000000000 --- a/packages/wallets/src/features/cfd/components/OtherCFDPlatformsList/OtherCFDPlatformsList.scss +++ /dev/null @@ -1,39 +0,0 @@ -.wallets-other-cfd { - &__title { - color: #333; - font-size: 1.6rem; - font-style: normal; - font-weight: 700; - line-height: 2.4rem; /* 150% */ - } - - &__content { - display: grid; - gap: 1.6rem 4.8rem; - grid-template-columns: repeat(3, 1fr); - - @include mobile { - grid-template-rows: 1fr; - grid-template-columns: auto; - } - - &__details { - flex-grow: 1; - &-title { - font-weight: bold; - font-size: 1.4rem; - line-height: 2rem; - } - - &-description { - font-size: 1.2rem; - line-height: 1.4rem; - - @include mobile { - font-size: 1.4rem; - line-height: 2rem; - } - } - } - } -} diff --git a/packages/wallets/src/features/cfd/components/OtherCFDPlatformsList/OtherCFDPlatformsList.tsx b/packages/wallets/src/features/cfd/components/OtherCFDPlatformsList/OtherCFDPlatformsList.tsx deleted file mode 100644 index ac643e9475d2..000000000000 --- a/packages/wallets/src/features/cfd/components/OtherCFDPlatformsList/OtherCFDPlatformsList.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import React, { useEffect } from 'react'; -import { useAuthorize, useDxtradeAccountsList, useInvalidateQuery } from '@deriv/api-v2'; -import { TradingAppCardLoader } from '../../../../components/SkeletonLoader'; -import { AddedDxtradeAccountsList, AvailableDxtradeAccountsList } from '../../flows/OtherCFDs/Dxtrade'; -import './OtherCFDPlatformsList.scss'; - -const OtherCFDPlatformsList: React.FC = () => { - const { isFetching } = useAuthorize(); - const { data, isFetchedAfterMount } = useDxtradeAccountsList(); - const invalidate = useInvalidateQuery(); - const hasDxtradeAccount = !!data?.length; - - useEffect(() => { - if (!isFetching) { - invalidate('trading_platform_accounts'); - } - }, [invalidate, isFetching]); - - return ( -
-
-

Other CFD Platforms

-
-
- {!isFetchedAfterMount && } - {isFetchedAfterMount && - (hasDxtradeAccount ? : )} -
-
- ); -}; - -export default OtherCFDPlatformsList; diff --git a/packages/wallets/src/features/cfd/components/OtherCFDPlatformsList/index.ts b/packages/wallets/src/features/cfd/components/OtherCFDPlatformsList/index.ts deleted file mode 100644 index c883163dcf1a..000000000000 --- a/packages/wallets/src/features/cfd/components/OtherCFDPlatformsList/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default as OtherCFDPlatformsList } from './OtherCFDPlatformsList'; diff --git a/packages/wallets/src/features/cfd/components/index.ts b/packages/wallets/src/features/cfd/components/index.ts index 71b9a553186d..7b9321a47955 100644 --- a/packages/wallets/src/features/cfd/components/index.ts +++ b/packages/wallets/src/features/cfd/components/index.ts @@ -1,5 +1,3 @@ +export * from './CFDPlatformsListAccounts'; export * from './CompareAccountsCarousel'; -export * from './CTraderList'; export * from './ModalTradeWrapper'; -export * from './MT5PlatformsList'; -export * from './OtherCFDPlatformsList'; diff --git a/packages/wallets/src/features/cfd/constants.tsx b/packages/wallets/src/features/cfd/constants.tsx index 1eab2db85bc8..76ba57f10dc1 100644 --- a/packages/wallets/src/features/cfd/constants.tsx +++ b/packages/wallets/src/features/cfd/constants.tsx @@ -20,18 +20,17 @@ export const MarketTypeDetails = { description: i18n.t( 'Trade swap-free CFDs on MT5 with synthetics, forex, stocks, stock indices, cryptocurrencies and ETFs' ), - - icon: , + icon: , title: i18n.t('Swap-Free'), }, financial: { description: 'This account offers CFDs on financial instruments.', - icon: , + icon: , title: i18n.t('Financial'), }, synthetic: { description: i18n.t('This account offers CFDs on derived instruments.'), - icon: , + icon: , title: i18n.t('Derived'), }, } as const; @@ -44,13 +43,13 @@ export const PlatformDetails = { title: i18n.t('Deriv cTrader'), }, dxtrade: { - icon: , + icon: , link: 'https://onelink.to/grmtyx', platform: i18n.t('dxtrade') as TPlatforms.OtherAccounts, title: i18n.t('Deriv X'), }, mt5: { - icon: , + icon: , link: 'https://onelink.to/grmtyx', platform: i18n.t('mt5') as TPlatforms.MT5, title: i18n.t('Deriv MT5'), diff --git a/packages/wallets/src/features/cfd/flows/CTrader/AddedCTraderAccountsList/AddedCTraderAccountsList.scss b/packages/wallets/src/features/cfd/flows/CTrader/AddedCTraderAccountsList/AddedCTraderAccountsList.scss index c1b8e7137ca9..ac0243a1a16a 100644 --- a/packages/wallets/src/features/cfd/flows/CTrader/AddedCTraderAccountsList/AddedCTraderAccountsList.scss +++ b/packages/wallets/src/features/cfd/flows/CTrader/AddedCTraderAccountsList/AddedCTraderAccountsList.scss @@ -1,6 +1,6 @@ .wallets-added-ctrader { &__icon { - cursor: pointer; + width: fit-content; } &__actions { @@ -12,6 +12,7 @@ &__details { display: flex; flex-direction: column; + align-items: flex-start; flex-grow: 1; } } diff --git a/packages/wallets/src/features/cfd/flows/CTrader/AddedCTraderAccountsList/AddedCTraderAccountsList.tsx b/packages/wallets/src/features/cfd/flows/CTrader/AddedCTraderAccountsList/AddedCTraderAccountsList.tsx index 2bd5ed73fa94..5b4721336371 100644 --- a/packages/wallets/src/features/cfd/flows/CTrader/AddedCTraderAccountsList/AddedCTraderAccountsList.tsx +++ b/packages/wallets/src/features/cfd/flows/CTrader/AddedCTraderAccountsList/AddedCTraderAccountsList.tsx @@ -1,58 +1,27 @@ import React from 'react'; -import { useTranslation } from 'react-i18next'; -import { useHistory } from 'react-router-dom'; import { useCtraderAccountsList } from '@deriv/api-v2'; +import { LabelPairedChevronRightCaptionRegularIcon } from '@deriv/quill-icons'; import { TradingAccountCard } from '../../../../../components'; -import { WalletButton, WalletText } from '../../../../../components/Base'; +import { WalletText } from '../../../../../components/Base'; import { useModal } from '../../../../../components/ModalProvider'; -import { getStaticUrl } from '../../../../../helpers/urls'; -import CTrader from '../../../../../public/images/ctrader.svg'; import { PlatformDetails } from '../../../constants'; import { MT5TradeModal } from '../../../modals'; import './AddedCTraderAccountsList.scss'; const AddedCTraderAccountsList: React.FC = () => { - const history = useHistory(); const { data: cTraderAccounts } = useCtraderAccountsList(); const { show } = useModal(); - const { t } = useTranslation(); return ( -
+ {cTraderAccounts?.map(account => ( { - window.open(getStaticUrl('/deriv-ctrader')); - }} - // Fix sonarcloud issue - onKeyDown={event => { - if (event.key === 'Enter') { - window.open(getStaticUrl('/deriv-ctrader')); - } - }} - > - -
- } + leading={
{PlatformDetails.ctrader.icon}
} + onClick={() => show()} trailing={ -
- { - history.push(`/wallets/cashier/transfer`, { toAccountLoginId: account.account_id }); - }} - variant='outlined' - > - Transfer - - show()} - > - {t('Open')} - +
+
} > @@ -61,13 +30,13 @@ const AddedCTraderAccountsList: React.FC = () => { {account?.formatted_balance} - + {account.login}
))} -
+ ); }; diff --git a/packages/wallets/src/features/cfd/flows/CTrader/AddedCTraderAccountsList/__tests__/AddedCTraderAccountsList.spec.tsx b/packages/wallets/src/features/cfd/flows/CTrader/AddedCTraderAccountsList/__tests__/AddedCTraderAccountsList.spec.tsx index 2763a62ef7f3..0f5a673e2253 100644 --- a/packages/wallets/src/features/cfd/flows/CTrader/AddedCTraderAccountsList/__tests__/AddedCTraderAccountsList.spec.tsx +++ b/packages/wallets/src/features/cfd/flows/CTrader/AddedCTraderAccountsList/__tests__/AddedCTraderAccountsList.spec.tsx @@ -1,46 +1,21 @@ -import React, { ReactNode } from 'react'; +import React from 'react'; import { createMemoryHistory } from 'history'; import { Router } from 'react-router-dom'; import { useCtraderAccountsList } from '@deriv/api-v2'; import { fireEvent, render, screen } from '@testing-library/react'; +import { ModalProvider } from '../../../../../../components/ModalProvider'; import AddedCTraderAccountsList from '../AddedCTraderAccountsList'; -type TradingAccountCardProps = { - children: ReactNode; - leading: ReactNode; - trailing: ReactNode; -}; - jest.mock('@deriv/api-v2', () => ({ useCtraderAccountsList: jest.fn(), })); -jest.mock('../../../../../../components/', () => ({ - TradingAccountCard: ({ children, leading, trailing }: TradingAccountCardProps) => ( -
- {leading} - {children} - {trailing} -
- ), -})); - -const mockShow = jest.fn(); -jest.mock('../../../../../../components/ModalProvider', () => ({ - useModal: () => ({ show: mockShow }), -})); - -jest.mock('../../../../../../helpers/urls', () => ({ - getStaticUrl: () => 'https://deriv.com/deriv-ctrader', +jest.mock('../../../../modals', () => ({ + MT5TradeModal: () =>
Mocked MT5 Trade Modal
, })); -jest.mock('../../../../../../public/images/ctrader.svg', () => { - const MockedSvg = () =>
CTrader
; - MockedSvg.displayName = 'MockedSvg'; - return MockedSvg; -}); - describe('AddedCTraderAccountsList', () => { + let $modalContainer: HTMLDivElement; const history = createMemoryHistory(); const mockAccounts = [ { formatted_balance: '1000', login: '123' }, @@ -48,15 +23,25 @@ describe('AddedCTraderAccountsList', () => { ]; beforeEach(() => { + jest.clearAllMocks(); + $modalContainer = document.createElement('div'); + $modalContainer.id = 'wallets_modal_root'; + document.body.appendChild($modalContainer); (useCtraderAccountsList as jest.Mock).mockReturnValue({ data: mockAccounts, }); }); + afterEach(() => { + document.body.removeChild($modalContainer); + }); + it('renders TradingAccountCard with cTraderAccounts', () => { render( - + + + ); @@ -66,57 +51,16 @@ describe('AddedCTraderAccountsList', () => { }); }); - it('renders the icon and opens the link when clicked', () => { - const mockWindowOpen = jest.fn(); - window.open = mockWindowOpen; - - render( - - - - ); - - const icon = screen.getAllByText('CTrader'); - fireEvent.click(icon[0]); - expect(mockWindowOpen).toHaveBeenCalledWith('https://deriv.com/deriv-ctrader'); - }); - - it('opens the link when Enter key is pressed for sonarcloud', () => { - const mockWindowOpen = jest.fn(); - window.open = mockWindowOpen; - - render( - - - - ); - - const icon = screen.getAllByText('CTrader'); - fireEvent.keyDown(icon[0], { code: 'Enter', key: 'Enter' }); - expect(mockWindowOpen).toHaveBeenCalledWith('https://deriv.com/deriv-ctrader'); - }); - - it('redirects to cashier transfer page when Transfer button is clicked', () => { - render( - - - - ); - - const transferButton = screen.getAllByText('Transfer'); - fireEvent.click(transferButton[0]); - expect(history.location.pathname).toEqual('/wallets/cashier/transfer'); - }); - - it('opens the MT5TradeModal when Open button is clicked', () => { + it('should show modal on click of cTrader account', () => { render( - + + + ); - const openButton = screen.getAllByText('Open'); - fireEvent.click(openButton[0]); - expect(mockShow).toHaveBeenCalled(); + fireEvent.click(screen.getAllByTestId('dt_wallets_trading_account_card')[0]); + expect(screen.getByText('Mocked MT5 Trade Modal')).toBeInTheDocument(); }); }); diff --git a/packages/wallets/src/features/cfd/flows/CTrader/AvailableCTraderAccountsList/AvailableCTraderAccountsList.scss b/packages/wallets/src/features/cfd/flows/CTrader/AvailableCTraderAccountsList/AvailableCTraderAccountsList.scss index 891de270315d..f35244e39361 100644 --- a/packages/wallets/src/features/cfd/flows/CTrader/AvailableCTraderAccountsList/AvailableCTraderAccountsList.scss +++ b/packages/wallets/src/features/cfd/flows/CTrader/AvailableCTraderAccountsList/AvailableCTraderAccountsList.scss @@ -1,11 +1,12 @@ .wallets-available-ctrader { &__icon { - cursor: pointer; + width: fit-content; } &__details { display: flex; flex-direction: column; + align-items: flex-start; flex-grow: 1; } } diff --git a/packages/wallets/src/features/cfd/flows/CTrader/AvailableCTraderAccountsList/AvailableCTraderAccountsList.tsx b/packages/wallets/src/features/cfd/flows/CTrader/AvailableCTraderAccountsList/AvailableCTraderAccountsList.tsx index 5870c330e543..3a6c40eddc23 100644 --- a/packages/wallets/src/features/cfd/flows/CTrader/AvailableCTraderAccountsList/AvailableCTraderAccountsList.tsx +++ b/packages/wallets/src/features/cfd/flows/CTrader/AvailableCTraderAccountsList/AvailableCTraderAccountsList.tsx @@ -1,11 +1,10 @@ import React, { useEffect } from 'react'; import { useTranslation } from 'react-i18next'; import { useActiveWalletAccount, useCreateOtherCFDAccount } from '@deriv/api-v2'; +import { LabelPairedChevronRightCaptionRegularIcon } from '@deriv/quill-icons'; import { TradingAccountCard, WalletError } from '../../../../../components'; -import { WalletButton, WalletText } from '../../../../../components/Base'; +import { WalletText } from '../../../../../components/Base'; import { useModal } from '../../../../../components/ModalProvider'; -import { getStaticUrl } from '../../../../../helpers/urls'; -import CTrader from '../../../../../public/images/ctrader.svg'; import { PlatformDetails } from '../../../constants'; import { CTraderSuccessModal } from '../../../modals/CTraderSuccessModal'; import './AvailableCTraderAccountsList.scss'; @@ -51,45 +50,22 @@ const AvailableCTraderAccountsList: React.FC = () => { }, [accountType, activeWallet?.wallet_currency_type, error?.error?.message, status]); return ( -
- { - window.open(getStaticUrl('/deriv-ctrader')); - }} - // Fix sonarcloud issue - onKeyDown={event => { - if (event.key === 'Enter') { - window.open(getStaticUrl('/deriv-ctrader')); - } - }} - > - -
- } - trailing={ - { - onSubmit(); - }} - > - {t('Get')} - - } - > -
- - {PlatformDetails.ctrader.title} - - - {t('This account offers CFDs on a feature-rich trading platform.')} - + {PlatformDetails.ctrader.icon}
} + onClick={() => { + onSubmit(); + }} + trailing={ +
+
- -
+ } + > +
+ {PlatformDetails.ctrader.title} + {t('This account offers CFDs on a feature-rich trading platform.')} +
+ ); }; diff --git a/packages/wallets/src/features/cfd/flows/MT5/AddedMT5AccountsList/AddedMT5AccountsList.scss b/packages/wallets/src/features/cfd/flows/MT5/AddedMT5AccountsList/AddedMT5AccountsList.scss index 995c1fe55365..eacae2b0fa70 100644 --- a/packages/wallets/src/features/cfd/flows/MT5/AddedMT5AccountsList/AddedMT5AccountsList.scss +++ b/packages/wallets/src/features/cfd/flows/MT5/AddedMT5AccountsList/AddedMT5AccountsList.scss @@ -1,7 +1,8 @@ .wallets-added-mt5 { &__icon { - cursor: pointer; + width: fit-content; } + &__actions { display: flex; flex-direction: column; @@ -9,6 +10,9 @@ } &__details { + display: flex; + flex-direction: column; + align-items: flex-start; flex-grow: 1; user-select: none; diff --git a/packages/wallets/src/features/cfd/flows/MT5/AddedMT5AccountsList/AddedMT5AccountsList.tsx b/packages/wallets/src/features/cfd/flows/MT5/AddedMT5AccountsList/AddedMT5AccountsList.tsx index 767f658d3e13..af49481080f0 100644 --- a/packages/wallets/src/features/cfd/flows/MT5/AddedMT5AccountsList/AddedMT5AccountsList.tsx +++ b/packages/wallets/src/features/cfd/flows/MT5/AddedMT5AccountsList/AddedMT5AccountsList.tsx @@ -1,11 +1,10 @@ import React, { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; -import { useHistory } from 'react-router-dom'; import { useAuthorize, useJurisdictionStatus } from '@deriv/api-v2'; -import { InlineMessage, WalletButton, WalletText } from '../../../../../components/Base'; +import { LabelPairedChevronRightCaptionRegularIcon } from '@deriv/quill-icons'; +import { InlineMessage, WalletText } from '../../../../../components/Base'; import { useModal } from '../../../../../components/ModalProvider'; import { TradingAccountCard } from '../../../../../components/TradingAccountCard'; -import { getStaticUrl } from '../../../../../helpers/urls'; import { THooks } from '../../../../../types'; import { MarketTypeDetails, PlatformDetails } from '../../../constants'; import { MT5TradeModal, VerificationFailedModal } from '../../../modals'; @@ -15,27 +14,8 @@ type TProps = { account: THooks.MT5AccountsList; }; -const MT5AccountIcon: React.FC = ({ account }) => { - const IconToLink = () => { - switch (account.market_type) { - case 'financial': - case 'synthetic': - case 'all': - return window.open(getStaticUrl('/dmt5')); - default: - return window.open(getStaticUrl('/dmt5')); - } - }; - return ( -
IconToLink()}> - {MarketTypeDetails[account.market_type || 'all'].icon} -
- ); -}; - const AddedMT5AccountsList: React.FC = ({ account }) => { const { data: activeWallet } = useAuthorize(); - const history = useHistory(); const { getVerificationStatus } = useJurisdictionStatus(); const jurisdictionStatus = useMemo( () => getVerificationStatus(account.landing_company_short || 'svg', account.status), @@ -47,32 +27,26 @@ const AddedMT5AccountsList: React.FC = ({ account }) => { return ( } + disabled={jurisdictionStatus.is_pending} + leading={ +
{MarketTypeDetails[account.market_type || 'all'].icon}
+ } + onClick={() => { + jurisdictionStatus.is_failed + ? show(, { + defaultRootId: 'wallets_modal_root', + }) + : show( + + ); + }} trailing={ -
- { - history.push(`/wallets/cashier/transfer`, { toAccountLoginId: account.loginid }); - }} - variant='outlined' - > - {t('Transfer')} - - - show( - - ) - } - > - {t('Open')} - +
+
} > diff --git a/packages/wallets/src/features/cfd/flows/MT5/AvailableMT5AccountsList/AvailableMT5AccountsList.scss b/packages/wallets/src/features/cfd/flows/MT5/AvailableMT5AccountsList/AvailableMT5AccountsList.scss index 8802e796e4d0..bcd17f97ec72 100644 --- a/packages/wallets/src/features/cfd/flows/MT5/AvailableMT5AccountsList/AvailableMT5AccountsList.scss +++ b/packages/wallets/src/features/cfd/flows/MT5/AvailableMT5AccountsList/AvailableMT5AccountsList.scss @@ -1,6 +1,6 @@ .wallets-available-mt5 { &__icon { - cursor: pointer; + width: fit-content; } &__text { @@ -17,6 +17,7 @@ &__details { display: flex; flex-direction: column; + align-items: flex-start; flex-grow: 1; } } diff --git a/packages/wallets/src/features/cfd/flows/MT5/AvailableMT5AccountsList/AvailableMT5AccountsList.tsx b/packages/wallets/src/features/cfd/flows/MT5/AvailableMT5AccountsList/AvailableMT5AccountsList.tsx index 782e509a0560..90a844f828ae 100644 --- a/packages/wallets/src/features/cfd/flows/MT5/AvailableMT5AccountsList/AvailableMT5AccountsList.tsx +++ b/packages/wallets/src/features/cfd/flows/MT5/AvailableMT5AccountsList/AvailableMT5AccountsList.tsx @@ -1,9 +1,8 @@ import React, { useCallback } from 'react'; -import { useTranslation } from 'react-i18next'; import { useActiveWalletAccount } from '@deriv/api-v2'; -import { TradingAccountCard, WalletButton, WalletText } from '../../../../../components'; +import { LabelPairedChevronRightCaptionRegularIcon } from '@deriv/quill-icons'; +import { TradingAccountCard, WalletText } from '../../../../../components'; import { useModal } from '../../../../../components/ModalProvider'; -import { getStaticUrl } from '../../../../../helpers/urls'; import { THooks } from '../../../../../types'; import { MarketTypeDetails } from '../../../constants'; import { JurisdictionModal, MT5PasswordModal } from '../../../modals'; @@ -13,29 +12,10 @@ type TProps = { account: THooks.SortedMT5Accounts; }; -const MT5AccountIcon: React.FC = ({ account }) => { - const IconToLink = () => { - switch (account.market_type) { - case 'financial': - case 'synthetic': - case 'all': - return window.open(getStaticUrl('/dmt5')); - default: - return window.open(getStaticUrl('/dmt5')); - } - }; - return ( -
IconToLink()}> - {MarketTypeDetails[account.market_type || 'all'].icon} -
- ); -}; - const AvailableMT5AccountsList: React.FC = ({ account }) => { const { data: activeWallet } = useActiveWalletAccount(); const { setModalState, show } = useModal(); const { description, title } = MarketTypeDetails[account.market_type || 'all']; - const { t } = useTranslation(); const onButtonClick = useCallback(() => { activeWallet?.is_virtual @@ -46,17 +26,20 @@ const AvailableMT5AccountsList: React.FC = ({ account }) => { return ( } + leading={ +
+ {MarketTypeDetails[account.market_type || 'all'].icon} +
+ } + onClick={onButtonClick} trailing={ - - {t(' Get')} - +
+ +
} >
- - {title} - + {title} {description}
diff --git a/packages/wallets/src/features/cfd/flows/OtherCFDs/Dxtrade/AddedDxtradeAccountsList/AddedDxtradeAccountsList.scss b/packages/wallets/src/features/cfd/flows/OtherCFDs/Dxtrade/AddedDxtradeAccountsList/AddedDxtradeAccountsList.scss index 11bb413d9be1..4c6d4e6fafbf 100644 --- a/packages/wallets/src/features/cfd/flows/OtherCFDs/Dxtrade/AddedDxtradeAccountsList/AddedDxtradeAccountsList.scss +++ b/packages/wallets/src/features/cfd/flows/OtherCFDs/Dxtrade/AddedDxtradeAccountsList/AddedDxtradeAccountsList.scss @@ -1,17 +1,12 @@ -.wallets-available-derivx { +.wallets-available-dxtrade { &__icon { - cursor: pointer; - } - - &__actions { - display: flex; - flex-direction: column; - gap: 0.4rem; + width: fit-content; } &__details { display: flex; flex-direction: column; + align-items: flex-start; flex-grow: 1; } } diff --git a/packages/wallets/src/features/cfd/flows/OtherCFDs/Dxtrade/AddedDxtradeAccountsList/AddedDxtradeAccountsList.tsx b/packages/wallets/src/features/cfd/flows/OtherCFDs/Dxtrade/AddedDxtradeAccountsList/AddedDxtradeAccountsList.tsx index 9292a0e27ae7..6790e615fbbf 100644 --- a/packages/wallets/src/features/cfd/flows/OtherCFDs/Dxtrade/AddedDxtradeAccountsList/AddedDxtradeAccountsList.tsx +++ b/packages/wallets/src/features/cfd/flows/OtherCFDs/Dxtrade/AddedDxtradeAccountsList/AddedDxtradeAccountsList.tsx @@ -1,69 +1,36 @@ import React from 'react'; -import { useTranslation } from 'react-i18next'; -import { useHistory } from 'react-router-dom'; import { useDxtradeAccountsList } from '@deriv/api-v2'; +import { LabelPairedChevronRightCaptionRegularIcon } from '@deriv/quill-icons'; import { TradingAccountCard } from '../../../../../../components'; -import { WalletButton, WalletText } from '../../../../../../components/Base'; +import { WalletText } from '../../../../../../components/Base'; import { useModal } from '../../../../../../components/ModalProvider'; -import { getStaticUrl } from '../../../../../../helpers/urls'; -import DerivX from '../../../../../../public/images/derivx.svg'; import { PlatformDetails } from '../../../../constants'; import { MT5TradeModal } from '../../../../modals'; import './AddedDxtradeAccountsList.scss'; const AddedDxtradeAccountsList: React.FC = () => { - const history = useHistory(); const { data } = useDxtradeAccountsList(); const { show } = useModal(); - const { t } = useTranslation(); - - const leadingComponent = ( -
{ - window.open(getStaticUrl('/derivx')); - }} - // Fix sonarcloud issue - onKeyDown={event => { - if (event.key === 'Enter') { - window.open(getStaticUrl('/derivx')); - } - }} - > - -
- ); - - const trailingComponent = (loginid?: string) => ( -
- { - history.push(`/wallets/cashier/transfer`, { toAccountLoginId: loginid }); - }} - variant='outlined' - > - {t('Transfer')} - - show()}> - {t('Open')} - -
- ); return ( {data?.map(account => ( {PlatformDetails.dxtrade.icon}
} + onClick={() => show()} + trailing={ +
+ +
+ } > -
+
{PlatformDetails.dxtrade.title} {account?.display_balance} - + {account?.login}
diff --git a/packages/wallets/src/features/cfd/flows/OtherCFDs/Dxtrade/AvailableDxtradeAccountsList/AvailableDxtradeAccountsList.scss b/packages/wallets/src/features/cfd/flows/OtherCFDs/Dxtrade/AvailableDxtradeAccountsList/AvailableDxtradeAccountsList.scss index 0aacb21bff38..4c6d4e6fafbf 100644 --- a/packages/wallets/src/features/cfd/flows/OtherCFDs/Dxtrade/AvailableDxtradeAccountsList/AvailableDxtradeAccountsList.scss +++ b/packages/wallets/src/features/cfd/flows/OtherCFDs/Dxtrade/AvailableDxtradeAccountsList/AvailableDxtradeAccountsList.scss @@ -1,9 +1,12 @@ .wallets-available-dxtrade { &__icon { - cursor: pointer; + width: fit-content; } &__details { + display: flex; + flex-direction: column; + align-items: flex-start; flex-grow: 1; } } diff --git a/packages/wallets/src/features/cfd/flows/OtherCFDs/Dxtrade/AvailableDxtradeAccountsList/AvailableDxtradeAccountsList.tsx b/packages/wallets/src/features/cfd/flows/OtherCFDs/Dxtrade/AvailableDxtradeAccountsList/AvailableDxtradeAccountsList.tsx index 097dd5a3b64b..5612165857c5 100644 --- a/packages/wallets/src/features/cfd/flows/OtherCFDs/Dxtrade/AvailableDxtradeAccountsList/AvailableDxtradeAccountsList.tsx +++ b/packages/wallets/src/features/cfd/flows/OtherCFDs/Dxtrade/AvailableDxtradeAccountsList/AvailableDxtradeAccountsList.tsx @@ -1,10 +1,10 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; +import { LabelPairedChevronRightCaptionRegularIcon } from '@deriv/quill-icons'; import { TradingAccountCard } from '../../../../../../components'; -import { WalletButton, WalletText } from '../../../../../../components/Base'; +import { WalletText } from '../../../../../../components/Base'; import { useModal } from '../../../../../../components/ModalProvider'; -import { getStaticUrl } from '../../../../../../helpers/urls'; -import DerivX from '../../../../../../public/images/derivx.svg'; +import { PlatformDetails } from '../../../../constants'; import { DxtradeEnterPasswordModal } from '../../../../modals'; import './AvailableDxtradeAccountsList.scss'; @@ -14,27 +14,17 @@ const AvailableDxtradeAccountsList: React.FC = () => { return ( { - window.open(getStaticUrl('/derivx')); - }} - > - -
- } + leading={
{PlatformDetails.dxtrade.icon}
} + onClick={() => show()} trailing={ - show()}> - {t('Get')} - +
+ +
} >

- - {t('Deriv X')} - + {t('Deriv X')}

{t('This account offers CFDs on a highly customisable CFD trading platform.')} diff --git a/packages/wallets/src/features/cfd/screens/GetMoreMT5Accounts/GetMoreMT5Accounts.scss b/packages/wallets/src/features/cfd/screens/GetMoreMT5Accounts/GetMoreMT5Accounts.scss index 35eb9d087736..5d461d38a78d 100644 --- a/packages/wallets/src/features/cfd/screens/GetMoreMT5Accounts/GetMoreMT5Accounts.scss +++ b/packages/wallets/src/features/cfd/screens/GetMoreMT5Accounts/GetMoreMT5Accounts.scss @@ -13,6 +13,10 @@ border-radius: 0.8rem; border: 0.1rem dashed var(--system-light-5-active-background, #d6dadb); + @include mobile { + margin-top: 1.6rem; + } + &-icon { width: 3.2rem; height: 3.2rem; diff --git a/packages/wallets/src/features/cfd/screens/MT5TradeScreen/MT5TradeScreen.scss b/packages/wallets/src/features/cfd/screens/MT5TradeScreen/MT5TradeScreen.scss index da2de4f750e2..df1a60a2cf68 100644 --- a/packages/wallets/src/features/cfd/screens/MT5TradeScreen/MT5TradeScreen.scss +++ b/packages/wallets/src/features/cfd/screens/MT5TradeScreen/MT5TradeScreen.scss @@ -10,7 +10,8 @@ &__label { display: flex; - flex-direction: column; + flex-direction: row; + gap: 0.6rem; } &__title {