Skip to content

Commit 8820e8e

Browse files
Merge branch 'master' of github.com:deriv-com/deriv-app
2 parents 28e2743 + 37d75fe commit 8820e8e

File tree

41 files changed

+204
-149
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+204
-149
lines changed

packages/account/src/Configs/get-mt5-status-badge-config.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const getMT5StatusBadgeConfig = (mt5_account_status: TMT5AccountStatus) => {
4343
};
4444
case TRADING_PLATFORM_STATUS.UNAVAILABLE:
4545
return {
46-
text: <Localize i18n_default_text='<0>Unavailable</0>' components={[BadgeTextComponent]} />,
46+
text: <Localize i18n_default_text='<0>Temporarily unavailable</0>' components={[BadgeTextComponent]} />,
4747
icon: 'IcAlertWarning',
4848
};
4949
default:

packages/account/src/Configs/get-status-badge-config.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import React from 'react';
2-
import { ACCOUNT_BADGE_STATUS, TAccountBadgeStatus } from '@deriv/shared';
2+
import { Text } from '@deriv/components';
3+
import { ACCOUNT_BADGE_STATUS, MT5_ACCOUNT_STATUS, TAccountBadgeStatus, TRADING_PLATFORM_STATUS } from '@deriv/shared';
34
import { Localize } from '@deriv-com/translations';
45

56
const getStatusBadgeConfig = (account_status: TAccountBadgeStatus) => {
7+
const BadgeTextComponent = <Text key={0} weight='bold' size='xxxs' color='warning' />;
8+
69
switch (account_status) {
710
case ACCOUNT_BADGE_STATUS.PENDING:
811
return {
@@ -15,13 +18,22 @@ const getStatusBadgeConfig = (account_status: TAccountBadgeStatus) => {
1518
icon: 'IcMt5Failed',
1619
icon_size: '18',
1720
};
18-
case ACCOUNT_BADGE_STATUS.NEEDS_VERIFICATION: {
21+
case ACCOUNT_BADGE_STATUS.NEEDS_VERIFICATION:
1922
return {
2023
text: <Localize i18n_default_text='Needs Verification' />,
2124
icon: 'IcMt5Verification',
2225
icon_size: '18',
2326
};
24-
}
27+
case MT5_ACCOUNT_STATUS.UNDER_MAINTENANCE:
28+
return {
29+
text: <Localize i18n_default_text='<0>Server maintenance</0>' components={[BadgeTextComponent]} />,
30+
icon: 'IcAlertWarning',
31+
};
32+
case TRADING_PLATFORM_STATUS.UNAVAILABLE:
33+
return {
34+
text: <Localize i18n_default_text='<0>Temporarily unavailable</0>' components={[BadgeTextComponent]} />,
35+
icon: 'IcAlertWarning',
36+
};
2537
default:
2638
return {
2739
text: '',

packages/appstore/src/components/cfds-listing-logged-out/cfds-listing-logged-out.tsx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
import React from 'react';
2-
import { observer, useStore } from '@deriv/stores';
2+
33
import { Text } from '@deriv/components';
4-
import { redirectToLogin } from '@deriv/shared';
4+
import { redirectToLogin, CFD_PLATFORMS } from '@deriv/shared';
5+
import { observer, useStore } from '@deriv/stores';
56
import { getLanguage, localize } from '@deriv/translations';
6-
import { getHasDivider } from 'Constants/utils';
7+
78
import ListingContainer from 'Components/containers/listing-container';
89
import TradingAppCard from 'Components/containers/trading-app-card';
910
import CFDsDescription from 'Components/elements/cfds-description';
1011
import CFDsTitle from 'Components/elements/cfds-title';
12+
import { getHasDivider } from 'Constants/utils';
13+
1114
import './cfds-listing-logged-out.scss';
1215

1316
const CFDsListingLoggedOut = observer(() => {
14-
const { traders_hub } = useStore();
17+
const { traders_hub, client } = useStore();
1518
const {
1619
available_dxtrade_accounts,
1720
available_ctrader_accounts,
1821
combined_cfd_mt5_accounts,
1922
selected_region,
2023
is_eu_user,
2124
} = traders_hub;
25+
const { is_eu } = client;
2226

2327
return (
2428
<ListingContainer title={<CFDsTitle />} description={<CFDsDescription />}>
@@ -28,15 +32,20 @@ const CFDsListingLoggedOut = observer(() => {
2832
</Text>
2933
</div>
3034
{combined_cfd_mt5_accounts.map((existing_account, index: number) => {
35+
// This is for backward compatibility
36+
// before BE change, EU market_type is financial. With BE change, EU market_type becomes synthetic
37+
const is_eu_standard = is_eu && existing_account.market_type !== 'financial';
38+
3139
const list_size = combined_cfd_mt5_accounts.length;
40+
3241
return (
3342
<TradingAppCard
3443
action_type={existing_account.action_type}
3544
availability={selected_region}
3645
clickable_icon
37-
icon={existing_account.icon}
46+
icon={is_eu_standard ? 'Derived' : existing_account.icon}
3847
sub_title={existing_account?.sub_title}
39-
name={existing_account?.name ?? ''}
48+
name={is_eu_standard ? 'Standard' : existing_account.name}
4049
short_code_and_region={existing_account?.short_code_and_region}
4150
platform={existing_account.platform}
4251
description={existing_account.description}

packages/appstore/src/components/cfds-listing/cfds-listing.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1773,6 +1773,9 @@
17731773
flex-direction: column;
17741774
justify-content: flex-start;
17751775
align-items: flex-start;
1776+
@include mobile-or-tablet-screen {
1777+
padding: 0.8rem 1.6rem;
1778+
}
17761779
}
17771780
.dc-input {
17781781
&__label {

packages/cashier/src/pages/account-transfer/account-transfer-form/account-transfer-form.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,21 @@ const AccountOption = ({
7474
</Text>
7575
);
7676
} else if (is_server_maintenance) {
77-
return <StatusBadge account_status='under_maintenance' icon='IcAlertWarning' text='Server Maintenance' />;
77+
return (
78+
<StatusBadge
79+
account_status='under_maintenance'
80+
icon='IcAlertWarning'
81+
text={<Localize i18n_default_text='<0>Server maintenance</0>' components={[<span key={0} />]} />}
82+
/>
83+
);
7884
} else if (is_account_unavailable) {
7985
return (
8086
<StatusBadge
8187
account_status={TRADING_PLATFORM_STATUS.UNAVAILABLE}
8288
icon='IcAlertWarning'
83-
text='Unavailable'
89+
text={
90+
<Localize i18n_default_text='<0>Temporarily unavailable</0>' components={[<span key={0} />]} />
91+
}
8492
/>
8593
);
8694
}
@@ -410,9 +418,7 @@ const AccountTransferForm = observer(
410418
if (is_migration_status_present) {
411419
hint_text = <Localize i18n_default_text='You can no longer open new positions with this account.' />;
412420
} else if (is_unavailable_status_present) {
413-
hint_text = (
414-
<Localize i18n_default_text='The server is temporarily unavailable for this account. We’re working to resolve this.' />
415-
);
421+
hint_text = <Localize i18n_default_text='Check back in a few minutes by refreshing the page.' />;
416422
} else if (is_maintenance_status_present) {
417423
hint_text = (
418424
<Localize

packages/cfd/src/Containers/cfd-compare-accounts/__tests__/cfd-compare-accounts-title-icon.spec.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ describe('<CFDCompareAccountsTitleIcon />', () => {
8282
test('should render correct title for EU Clients', () => {
8383
mocked_props.trading_platforms = {
8484
platform: 'mt5',
85-
market_type: 'financial',
85+
market_type: 'gaming',
8686
shortcode: 'maltainvest',
8787
product: 'financial',
8888
};
8989
mocked_props.is_eu_user = true;
9090
render(<CFDCompareAccountsTitleIcon {...mocked_props} />);
91-
expect(screen.getByText('CFDs')).toBeInTheDocument();
91+
expect(screen.getByText('Standard')).toBeInTheDocument();
9292
});
9393

9494
test('should render correct title for standard product type in demo account', () => {
@@ -159,11 +159,11 @@ describe('<CFDCompareAccountsTitleIcon />', () => {
159159

160160
test('should render correct title for EU clients demo accounts', () => {
161161
mocked_props.trading_platforms.platform = 'mt5';
162-
mocked_props.trading_platforms.market_type = 'financial';
162+
mocked_props.trading_platforms.market_type = 'gaming';
163163
mocked_props.trading_platforms.shortcode = 'svg';
164164
mocked_props.is_demo = true;
165165
mocked_props.is_eu_user = true;
166166
render(<CFDCompareAccountsTitleIcon {...mocked_props} />);
167-
expect(screen.getByText('CFDs demo')).toBeInTheDocument();
167+
expect(screen.getByText('Standard demo')).toBeInTheDocument();
168168
});
169169
});

packages/cfd/src/Containers/cfd-compare-accounts/cfd-compare-accounts-title-icon.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ import {
1717

1818
const CFDCompareAccountsTitleIcon = ({ trading_platforms, is_eu_user, is_demo }: TCompareAccountsCard) => {
1919
const { isDesktop } = useDevice();
20-
const market_type = !is_eu_user ? getMarketType(trading_platforms) : 'CFDs';
20+
const market_type =
21+
is_eu_user && trading_platforms.market_type === 'financial'
22+
? 'CFDs' // this is for backwards compatibility with BE
23+
: getMarketType(trading_platforms);
2124

2225
const market_type_shortcode = generateMarketTypeShortcode(trading_platforms, market_type);
2326

packages/cfd/src/Containers/cfd-server-maintenance-modal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ const CFDServerMaintenanceModal = observer(() => {
1919
has_close_icon
2020
width={isDesktop() ? '440px' : '328px'}
2121
>
22-
<Modal.Body>
22+
<Modal.Body className='dc-modal__container_cfd-password-modal__body'>
2323
<Localize
2424
i18n_default_text='We’re currently performing server maintenance. Service may be affected.'
2525
components={[<strong key={0} />]}
2626
/>
2727
</Modal.Body>
2828
<Modal.Footer>
29-
<Button onClick={() => setServerMaintenanceModal(false)} secondary medium>
29+
<Button onClick={() => setServerMaintenanceModal(false)} secondary large>
3030
<Localize i18n_default_text='OK' />
3131
</Button>
3232
</Modal.Footer>

packages/cfd/src/Containers/mt5-account-unavailable-modal.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ const MT5AccountUnavailableModal = observer(() => {
1515
<Modal
1616
className='cfd-password-modal'
1717
is_open={is_account_unavailable_modal_visible}
18-
title={localize('Account unavailable')}
18+
title={localize('Account temporarily unavailable')}
1919
toggleModal={() => setAccountUnavailableModal(false)}
2020
has_close_icon
2121
width={isDesktop ? '440px' : '328px'}
2222
>
23-
<Modal.Body>
24-
<Localize i18n_default_text='The server is temporarily unavailable for this account. We’re working to resolve this.' />
23+
<Modal.Body className='dc-modal__container_cfd-password-modal__body'>
24+
<Localize i18n_default_text='Check back in a few minutes by refreshing the page.' />
2525
</Modal.Body>
2626
<Modal.Footer>
2727
<Button type='button' onClick={() => setAccountUnavailableModal(false)} secondary medium>

packages/cfd/src/Helpers/compare-accounts-config.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const getHighlightedIconLabel = (
1010
selected_region?: string
1111
): TInstrumentsIcon[] => {
1212
const market_type = getMarketType(trading_platforms);
13+
1314
const market_type_shortcode =
1415
trading_platforms.product === PRODUCT.GOLD
1516
? market_type.concat('_', trading_platforms.product)
@@ -129,6 +130,7 @@ const platformsHeaderLabel = {
129130
const getAccountIcon = (shortcode: string, product?: TProducts) => {
130131
switch (shortcode) {
131132
case MARKET_TYPE.SYNTHETIC:
133+
case MARKET_TYPE.GAMING:
132134
return 'Standard';
133135
case MARKET_TYPE.FINANCIAL:
134136
switch (product) {
@@ -276,7 +278,6 @@ const getEUAvailableAccounts = (available_accounts: TModifiedTradingPlatformAvai
276278
const financial_accounts = available_accounts
277279
.filter(
278280
item =>
279-
item.market_type === MARKET_TYPE.FINANCIAL &&
280281
item.shortcode === JURISDICTION.MALTA_INVEST &&
281282
item.is_default_jurisdiction === 'true' &&
282283
item.product !== PRODUCT.GOLD
@@ -355,9 +356,7 @@ const getMT5DemoData = (available_accounts: TModifiedTradingPlatformAvailableAcc
355356
item =>
356357
item.market_type === MARKET_TYPE.FINANCIAL && item.product !== PRODUCT.STP && item.product !== PRODUCT.GOLD
357358
);
358-
const gaming_demo_accounts = available_accounts.filter(
359-
item => item.market_type === MARKET_TYPE.GAMING && item.shortcode === JURISDICTION.SVG
360-
);
359+
const gaming_demo_accounts = available_accounts.filter(item => item.market_type === MARKET_TYPE.GAMING);
361360

362361
const gold_demo_accounts = available_accounts.filter(
363362
item => item.market_type === MARKET_TYPE.FINANCIAL && item.product === PRODUCT.GOLD

0 commit comments

Comments
 (0)