Skip to content

Commit

Permalink
Merge branch 'master' of github.com:binary-com/deriv-app into jim/dse…
Browse files Browse the repository at this point in the history
…c-26597/update-ghpages-version
  • Loading branch information
jim-deriv committed Sep 23, 2024
2 parents 099e776 + 2f79fe8 commit ad759dc
Show file tree
Hide file tree
Showing 46 changed files with 40,996 additions and 341 deletions.
40,962 changes: 40,746 additions & 216 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"dependencies": {
"@binary-com/binary-document-uploader": "^2.4.8",
"@deriv-com/analytics": "1.14.0",
"@deriv-com/translations": "1.3.5",
"@deriv-com/translations": "1.3.9",
"@deriv-com/utils": "^0.0.25",
"@deriv-com/ui": "1.35.0",
"@deriv/api": "^1.0.0",
Expand Down
6 changes: 4 additions & 2 deletions packages/api-v2/src/hooks/useOnfido.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useCallback, useRef, useMemo, useEffect, useState } from 'react';
import { LocalStorageUtils } from '@deriv-com/utils';
import useOnfidoServiceToken from './useOnfidoServiceToken';
import { ALPHA_2_TO_ALPHA_3, ONFIDO_PHRASES } from '../constants';
import useSettings from './useSettings';
Expand Down Expand Up @@ -96,14 +97,15 @@ const useOnfido = (country?: string, selectedDocument?: string) => {
);

const initOnfido = useCallback(async () => {
const i18NLanguage = window.localStorage.getItem('i18n_language')?.toLowerCase() ?? 'en';
const localizeLanguage = LocalStorageUtils.getValue<string>('i18n_language');
const i18NLanguage = localizeLanguage || 'en';
const onfidoCountryCode =
countryCode.length !== 3 ? ALPHA_2_TO_ALPHA_3[countryCode.toUpperCase()] : countryCode;
try {
onfidoRef.current = await window.Onfido.init({
containerId: onfidoContainerId,
language: {
locale: i18NLanguage,
locale: i18NLanguage.toLowerCase(),
phrases: ONFIDO_PHRASES,
mobilePhrases: ONFIDO_PHRASES,
},
Expand Down
7 changes: 5 additions & 2 deletions packages/api/src/hooks/useOnfido.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useCallback, useRef, useMemo, useEffect, useState } from 'react';
import { LocalStorageUtils } from '@deriv-com/utils';
import useOnfidoServiceToken from './useOnfidoServiceToken';
import { ALPHA_2_TO_ALPHA_3, ONFIDO_PHRASES } from '../constants';
import useSettings from './useSettings';
Expand Down Expand Up @@ -96,14 +97,16 @@ const useOnfido = (country?: string, selectedDocument?: string) => {
);

const initOnfido = useCallback(async () => {
const i18NLanguage = window.localStorage.getItem('i18n_language')?.toLowerCase() ?? 'en';
const localizeLanguage = LocalStorageUtils.getValue<string>('i18n_language');
const i18NLanguage = localizeLanguage || 'en';

const onfidoCountryCode =
countryCode.length !== 3 ? ALPHA_2_TO_ALPHA_3[countryCode.toUpperCase()] : countryCode;
try {
onfidoRef.current = await window.Onfido.init({
containerId: onfidoContainerId,
language: {
locale: i18NLanguage,
locale: i18NLanguage.toLowerCase(),
phrases: ONFIDO_PHRASES,
mobilePhrases: ONFIDO_PHRASES,
},
Expand Down
2 changes: 1 addition & 1 deletion packages/appstore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"license": "Apache-2.0",
"dependencies": {
"@deriv-com/analytics": "1.14.0",
"@deriv-com/translations": "1.3.5",
"@deriv-com/translations": "1.3.9",
"@deriv-com/ui": "1.35.0",
"@deriv/account": "^1.0.0",
"@deriv/cashier": "^1.0.0",
Expand Down
11 changes: 6 additions & 5 deletions packages/appstore/src/components/cfds-listing/cfds-listing.scss
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,8 @@

@include mobile-or-tablet-screen {
grid-template-columns: 1fr;
margin: 0 6.5rem 3rem;
margin: 0 auto 3rem;
min-width: 20rem;
}
}

Expand All @@ -989,19 +990,19 @@
}

&-row {
grid-template-columns: 1fr 0.5fr 1.25fr;
grid-template-columns: 1fr 1fr 1.4fr;
justify-items: center;
border-bottom: 0;
padding: 0.4rem 0;
padding: 0.4rem;
background-color: var(--general-hover);
}
}

&-row {
grid-template-columns: 1fr 0.5fr 1.25fr;
grid-template-columns: 1fr 1fr 1.4fr;
justify-items: center;
border-bottom: 0;
padding: 0.4rem 0;
padding: 0.4rem;

&:nth-child(even) {
background-color: var(--general-hover);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from 'react';
import { Dialog, Text } from '@deriv/components';
import { Localize, localize } from '@deriv/translations';
import { useDBotStore } from 'Stores/useDBotStore';
import { observer } from '@deriv/stores';

type TDeleteServerBot = {
is_open: boolean;
setVisibility: (is_open: boolean) => void;
};

const ClearJournalTransactions = observer(({ is_open, setVisibility }: TDeleteServerBot) => {
const { server_bot } = useDBotStore();
const { resetJournal, resetTransactions } = server_bot;
const onOkButtonClick = () => {
resetJournal();
resetTransactions();
setVisibility(false);
};

return (
<Dialog
title={localize('Are you sure?')}
is_visible={is_open}
confirm_button_text={localize('Ok')}
onConfirm={onOkButtonClick}
cancel_button_text={localize('Cancel')}
onCancel={() => setVisibility(false)}
onClose={() => setVisibility(false)}
is_mobile_full_width={false}
className={'dc-dialog__wrapper--fixed'}
portal_element_id='modal_root'
has_close_icon
>
<Text color='prominent' line_height='xl' size='xs'>
<Localize i18n_default_text='This will clear all data in the summary and journal panels. All counters will be reset to zero.' />
</Text>
</Dialog>
);
});

export default ClearJournalTransactions;
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@ import { useDBotStore } from 'Stores/useDBotStore';

type TJournal = {
setActiveTabIndex: (index: number) => void;
setClearDialogVisibility: (is_clear_dialog_visible: boolean) => void;
};

const Journal: React.FC<TJournal> = observer(({ setActiveTabIndex }) => {
const Journal = observer(({ setActiveTabIndex, setClearDialogVisibility }: TJournal) => {
const {
client: { currency },
} = useStore();
const { server_bot } = useDBotStore();
const { journal, resetJournal, downloadJournal } = server_bot;
const { active_bot, journal, downloadJournal } = server_bot;
const has_journal = !!journal.length;
const font_size = 'xxs';
const uid = 'journal';
const is_bot_running = active_bot?.status !== 'stopped';
const should_disable = !has_journal || is_bot_running;

React.useEffect(() => {
const last_journal = journal?.[journal.length - 1];
Expand Down Expand Up @@ -137,10 +140,10 @@ const Journal: React.FC<TJournal> = observer(({ setActiveTabIndex }) => {
)}
</div>
<div className='ssb-journal__footer'>
<Button secondary disabled={!has_journal} onClick={() => resetJournal()}>
<Button secondary disabled={should_disable} onClick={() => setClearDialogVisibility(true)}>
<Localize i18n_default_text='Reset' />
</Button>
<Button secondary disabled={!has_journal} onClick={() => downloadJournal()}>
<Button secondary disabled={should_disable} onClick={downloadJournal}>
<Localize i18n_default_text='Download' />
</Button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,26 @@ import { Tabs } from '@deriv/components';
import { localize } from '@deriv/translations';
import Journal from '../journal';
import Summary from '../summary';
import ClearJournalTransactions from '../bot-list/clear-journal-transactions';

const PerformancePanel: React.FC = () => {
const PerformancePanel = () => {
const [active_index, setActiveTabIndex] = React.useState(0);
const [is_clear_dialog_visible, setClearDialogVisibility] = React.useState(false);
return (
<Tabs active_index={active_index} onTabItemClick={setActiveTabIndex} top className='ssb'>
<div id='db-run-panel-tab__summary' label={localize('Summary')}>
<Summary />
</div>
<div id='db-run-panel-tab__journal' label={localize('Journal')}>
<Journal setActiveTabIndex={setActiveTabIndex} />
</div>
</Tabs>
<>
<Tabs active_index={active_index} onTabItemClick={setActiveTabIndex} top className='ssb'>
<div id='db-run-panel-tab__summary' label={localize('Summary')}>
<Summary setClearDialogVisibility={setClearDialogVisibility} />
</div>
<div id='db-run-panel-tab__journal' label={localize('Journal')}>
<Journal
setActiveTabIndex={setActiveTabIndex}
setClearDialogVisibility={setClearDialogVisibility}
/>
</div>
</Tabs>
<ClearJournalTransactions is_open={is_clear_dialog_visible} setVisibility={setClearDialogVisibility} />
</>
);
};

Expand Down
18 changes: 15 additions & 3 deletions packages/bot-web-ui/src/pages/server-side-bot/summary/summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import { observer, useStore } from '@deriv/stores';
import { Localize } from '@deriv/translations';
import { useDBotStore } from 'Stores/useDBotStore';

type TSummary = {
setClearDialogVisibility: (is_clear_dialog_visible: boolean) => void;
};

const STATUS = Object.freeze({
open: {
text: <Localize i18n_default_text='Running' />,
Expand All @@ -29,16 +33,20 @@ const STATUS = Object.freeze({
},
});

const Summary: React.FC = observer(() => {
const Summary = observer(({ setClearDialogVisibility }: TSummary) => {
const { server_bot } = useDBotStore();
const { client } = useStore();
const { currency } = client;
const { transactions, active_bot, performance, resetTransactions } = server_bot;
const { transactions, active_bot, performance } = server_bot;
const { bot_id } = active_bot;
const bot_transactions = bot_id ? transactions[bot_id] : {};

const txns = bot_transactions ? Object.values(bot_transactions) : [];
const has_summary = !!txns?.length;
// when we allow multiple bots to run at the same time, it should be an array
// const is_some_bot_running = active_bots.every(item => item.status !== 'stopped');
const is_bot_running = active_bot?.status !== 'stopped';

return (
<div className='ssb-summary'>
<div className='ssb-summary__content'>
Expand Down Expand Up @@ -147,7 +155,11 @@ const Summary: React.FC = observer(() => {
</ul>
</div>
<div className='ssb-summary__footer__actions'>
<Button secondary disabled={!has_summary} onClick={() => resetTransactions()}>
<Button
secondary
disabled={!has_summary || is_bot_running}
onClick={() => setClearDialogVisibility(true)}
>
<Localize i18n_default_text='Reset' />
</Button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/cfd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"dependencies": {
"@deriv-com/ui": "1.35.0",
"@deriv-com/analytics": "1.14.0",
"@deriv-com/translations": "1.3.5",
"@deriv-com/translations": "1.3.9",
"@deriv-com/utils": "^0.0.25",
"@deriv/account": "^1.0.0",
"@deriv/api": "^1.0.0",
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/components/icon/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,6 @@ import './option/ic-option-over-under.svg';
import './option/ic-option-raise-fall.svg';
import './option/ic-option-touch-notouch.svg';
import './option/ic-option-up-down-asian.svg';
import './rebranding/ic-rebranding-binary-bot.svg';
import './rebranding/ic-rebranding-ctrader-dashboard.svg';
import './rebranding/ic-rebranding-deriv-bot-dashboard.svg';
import './rebranding/ic-rebranding-deriv-bot.svg';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"@deriv-com/analytics": "1.14.0",
"@deriv-com/quill-tokens": "^2.0.4",
"@deriv-com/quill-ui": "1.16.9",
"@deriv-com/translations": "1.3.5",
"@deriv-com/translations": "1.3.9",
"@deriv-com/ui": "1.35.0",
"@deriv-com/utils": "^0.0.25",
"@deriv/account": "^1.0.0",
Expand Down
33 changes: 17 additions & 16 deletions packages/core/src/Stores/contract-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,24 +381,25 @@ export default class ContractStore extends BaseStore {
? { take_profit: getLimitOrder(this).take_profit }
: getLimitOrder(this);

WS.contractUpdate(this.contract_id, limit_order).then(response => {
if (response.error) {
this.root_store.common.setServicesError({
type: response.msg_type,
...response.error,
});
return;
}
Object.keys(limit_order).length !== 0 &&
WS.contractUpdate(this.contract_id, limit_order).then(response => {
if (response.error) {
this.root_store.common.setServicesError({
type: response.msg_type,
...response.error,
});
return;
}

// Update contract store
this.populateContractUpdateConfig(response);
if (this.root_store.ui.is_history_tab_active) {
WS.contractUpdateHistory(this.contract_id).then(this.populateContractUpdateHistory);
}
// Update contract store
this.populateContractUpdateConfig(response);
if (this.root_store.ui.is_history_tab_active) {
WS.contractUpdateHistory(this.contract_id).then(this.populateContractUpdateHistory);
}

// Update portfolio store
this.root_store.portfolio.populateContractUpdate(response, this.contract_id);
});
// Update portfolio store
this.root_store.portfolio.populateContractUpdate(response, this.contract_id);
});
}

getContractsArray() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const languages = {
RU: 'Русский',
SI: 'සිංහල',
TR: 'Türkçe',
UZ: "O'zbek",
VI: 'Tiếng Việt',
ZH_CN: '简体中文',
ZH_TW: '繁體中文',
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
margin-top: 1.6rem;
height: 24px;
width: fit-content;
max-width: 25rem; // minimum required to fit in long FR, ES & PT text
max-width: 27rem;
align-self: flex-end;
}
&__text-container {
Expand Down
2 changes: 2 additions & 0 deletions packages/p2p/src/components/i18next/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import ru from 'Translations/ru.json';
import si from 'Translations/si.json';
import th from 'Translations/th.json';
import tr from 'Translations/tr.json';
import uz from 'Translations/uz.json';
import vi from 'Translations/vi.json';
import zh_cn from 'Translations/zh_cn.json';
import zh_tw from 'Translations/zh_tw.json';
Expand Down Expand Up @@ -59,6 +60,7 @@ const i18n_config = {
SI: { translations: { ...si } },
TH: { translations: { ...th } },
TR: { translations: { ...tr } },
UZ: { translations: { ...uz } },
VI: { translations: { ...vi } },
ZH_CN: { translations: { ...zh_cn } },
ZH_TW: { translations: { ...zh_tw } },
Expand Down
1 change: 1 addition & 0 deletions packages/p2p/src/pages/buy-sell/buy-sell-row.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
max-height: 7rem;
margin-left: auto;
padding: 1rem 1.6rem;
text-wrap: nowrap;

@include tablet-screen {
justify-self: flex-end;
Expand Down
1 change: 1 addition & 0 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@deriv/quill-icons": "1.23.3",
"@deriv/api-types": "1.0.172",
"@deriv/translations": "^1.0.0",
"@deriv-com/utils": "^0.0.25",
"@types/js-cookie": "^2.2.1",
"@types/react-loadable": "^5.5.6",
"canvas-toBlob": "^1.0.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/src/utils/constants/translation-flag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
FlagThailandIcon,
FlagTurkeyIcon,
FlagUnitedKingdomIcon,
FlagUzbekistanIcon,
FlagVietnamIcon,
} from '@deriv/quill-icons';

Expand All @@ -41,6 +42,7 @@ const flagComponents = {
SI: FlagSriLankaIcon,
SW: FlagTanzaniaIcon,
TR: FlagTurkeyIcon,
UZ: FlagUzbekistanIcon,
VI: FlagVietnamIcon,
ZH_CN: FlagChinaSimplifiedIcon,
ZH_TW: FlagChinaTraditionalIcon,
Expand Down
Loading

0 comments on commit ad759dc

Please sign in to comment.