diff --git a/package-lock.json b/package-lock.json
index f44e031d..93a441cf 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -89,6 +89,7 @@
"@types/react-router-dom": "^5.3.3",
"@types/react-transition-group": "^4.4.10",
"@types/react-virtualized": "^9.21.30",
+ "@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.0.0",
"babel-core": "^7.0.0-bridge.0",
@@ -5699,6 +5700,12 @@
"integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==",
"dev": true
},
+ "node_modules/@types/uuid": {
+ "version": "10.0.0",
+ "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz",
+ "integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==",
+ "dev": true
+ },
"node_modules/@types/ws": {
"version": "8.5.12",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.12.tgz",
diff --git a/package.json b/package.json
index 2c55e99a..82057bc0 100644
--- a/package.json
+++ b/package.json
@@ -100,6 +100,7 @@
"@types/react-router-dom": "^5.3.3",
"@types/react-transition-group": "^4.4.10",
"@types/react-virtualized": "^9.21.30",
+ "@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.0.0",
"babel-core": "^7.0.0-bridge.0",
diff --git a/src/components/contract-card-loading/contract-card-loading.scss b/src/components/contract-card-loading/contract-card-loading.scss
new file mode 100644
index 00000000..95a98de3
--- /dev/null
+++ b/src/components/contract-card-loading/contract-card-loading.scss
@@ -0,0 +1,5 @@
+.db-contract-card-running-loader {
+ display: flex;
+ align-items: center;
+ flex-direction: column;
+}
diff --git a/src/components/contract-card-loading/contract-card-running-bot.tsx b/src/components/contract-card-loading/contract-card-running-bot.tsx
index cf755cb7..4cc71d2c 100644
--- a/src/components/contract-card-loading/contract-card-running-bot.tsx
+++ b/src/components/contract-card-loading/contract-card-running-bot.tsx
@@ -1,11 +1,12 @@
import Text from '@/components/shared_ui/text';
import { LabelPairedLoaderMdBoldIcon } from '@deriv/quill-icons/LabelPaired';
import { localize } from '@deriv-com/translations';
+import './contract-card-loading.scss';
export const message_running_bot = localize('Your bot is running and waiting for a signal to buy a contract.');
const ContractCardRunningBot = () => (
- <>
+
(
>
{message_running_bot}
- >
+
);
export default ContractCardRunningBot;
diff --git a/src/components/layout/header/header.scss b/src/components/layout/header/header.scss
index bbd4ddab..25ba239a 100644
--- a/src/components/layout/header/header.scss
+++ b/src/components/layout/header/header.scss
@@ -127,6 +127,9 @@
}
.auth-actions {
+ display: flex;
+ padding-block: 8px;
+
button {
font-weight: 400;
margin-right: 1.6rem;
diff --git a/src/components/shared_ui/contract-card/contract-card-loader/contract-card-loader.tsx b/src/components/shared_ui/contract-card/contract-card-loader/contract-card-loader.tsx
deleted file mode 100644
index c6f53c09..00000000
--- a/src/components/shared_ui/contract-card/contract-card-loader/contract-card-loader.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-import ContentLoader from 'react-content-loader';
-import { contract_stages } from '@/constants/contract-stage';
-import ContractCardRunningBot from './contract-card-running-bot';
-
-type TContractCardLoader = {
- speed?: number;
- contract_stage?: number;
-};
-
-const ContractCardLoader = ({ speed = 3, contract_stage }: TContractCardLoader) => (
- <>
- {contract_stage === contract_stages.RUNNING ? (
-
- ) : (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- )}
- >
-);
-
-export default ContractCardLoader;
diff --git a/src/components/shared_ui/contract-card/contract-card-loader/contract-card-running-bot.tsx b/src/components/shared_ui/contract-card/contract-card-loader/contract-card-running-bot.tsx
deleted file mode 100644
index 4c4ebdb7..00000000
--- a/src/components/shared_ui/contract-card/contract-card-loader/contract-card-running-bot.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import React from 'react';
-import { Icon } from '@/utils/tmp/dummy';
-import { localize } from '@deriv-com/translations';
-import Text from '../../text';
-
-export const message_running_bot = localize('Your bot is running and waiting for a signal to buy a contract.');
-
-const ContractCardRunningBot = () => (
- <>
-
-
- {message_running_bot}
-
- >
-);
-
-export default ContractCardRunningBot;
diff --git a/src/components/shared_ui/contract-card/contract-card-loader/index.ts b/src/components/shared_ui/contract-card/contract-card-loader/index.ts
deleted file mode 100644
index 7c9a15d7..00000000
--- a/src/components/shared_ui/contract-card/contract-card-loader/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import ContractCardLoader from './contract-card-loader';
-
-export default ContractCardLoader;
diff --git a/src/components/shared_ui/contract-card/contract-card.tsx b/src/components/shared_ui/contract-card/contract-card.tsx
index b8c4df8b..7779e422 100644
--- a/src/components/shared_ui/contract-card/contract-card.tsx
+++ b/src/components/shared_ui/contract-card/contract-card.tsx
@@ -1,5 +1,6 @@
import React from 'react';
-import { getTotalProfit } from '@/components/shared/utils/contract';
+import ContractCardLoader from '@/components/contract-card-loading';
+import { getTotalProfit, TContractInfo } from '@/components/shared/utils/contract';
import DesktopWrapper from '../desktop-wrapper';
import { TGetCardLables, TGetContractPath } from '../types';
import ContractCardBody from './contract-card-items/contract-card-body';
@@ -8,7 +9,6 @@ import ContractCardHeader from './contract-card-items/contract-card-header';
import ContractCardSell from './contract-card-items/contract-card-sell';
import ContractTypeCell from './contract-card-items/contract-type-cell';
import MultiplierCloseActions from './contract-card-items/multiplier-close-actions';
-import ContractCardLoader from './contract-card-loader';
import ResultOverlay from './result-overlay';
type TContractCardProps = {
diff --git a/src/stores/client-store.ts b/src/stores/client-store.ts
index 9da53163..60cc91d8 100644
--- a/src/stores/client-store.ts
+++ b/src/stores/client-store.ts
@@ -9,7 +9,7 @@ import {
useWebsiteStatus,
} from '@deriv-com/api-hooks';
-type TAccountList = NonNullable['data']>;
+export type TAccountList = NonNullable['data']>;
type GetAccountStatusResult = NonNullable['data']>;
diff --git a/src/stores/journal-store.ts b/src/stores/journal-store.ts
index 50fbc8c3..2dc4c71c 100644
--- a/src/stores/journal-store.ts
+++ b/src/stores/journal-store.ts
@@ -3,11 +3,11 @@ import { v4 as uuidv4 } from 'uuid';
import { formatDate } from '@/components/shared';
import { LogTypes, MessageTypes } from '@/external/bot-skeleton';
import { config } from '@/external/bot-skeleton/constants/config';
-import { TStores } from '@deriv/stores/types';
import { localize } from '@deriv-com/translations';
import { isCustomJournalMessage } from '../utils/journal-notifications';
import { getStoredItemsByKey, getStoredItemsByUser, setStoredItemsByKey } from '../utils/session-storage';
import { getSetting, storeSetting } from '../utils/settings';
+import { TAccountList } from './client-store';
import RootStore from './root-store';
type TExtra = {
@@ -62,9 +62,9 @@ export interface IJournalStore {
export default class JournalStore {
root_store: RootStore;
- core: TStores;
+ core: RootStore['core'];
disposeReactionsFn: () => void;
- constructor(root_store: RootStore, core: TStores) {
+ constructor(root_store: RootStore, core: RootStore['core']) {
makeObservable(this, {
is_filter_dialog_visible: observable,
journal_filters: observable.shallow,
@@ -104,7 +104,8 @@ export default class JournalStore {
unfiltered_messages: TMessageItem[] = [];
restoreStoredJournals() {
- const { loginid } = this.core?.client ?? {};
+ const client = this.core.client as RootStore['client'];
+ const { loginid } = client;
this.journal_filters = getSetting('journal_filter') || this.filters.map(filter => filter.id);
this.unfiltered_messages = getStoredItemsByUser(this.JOURNAL_CACHE, loginid, []);
}
@@ -160,11 +161,11 @@ export default class JournalStore {
extra: { current_currency?: string; currency?: string } = {}
) {
const { client } = this.core;
- const { loginid, account_list } = client;
+ const { loginid, account_list } = client as RootStore['client'];
if (loginid) {
const current_account = account_list?.find(account => account?.loginid === loginid);
- extra.current_currency = current_account?.is_virtual ? 'Demo' : current_account?.title;
+ extra.current_currency = current_account?.is_virtual ? 'Demo' : current_account?.currency;
} else if (message === LogTypes.WELCOME) {
return;
}
@@ -208,7 +209,7 @@ export default class JournalStore {
}
registerReactions() {
- const { client } = this.core;
+ const client = this.core.client as RootStore['client'];
// Write journal messages to session storage on each change in unfiltered messages.
const disposeWriteJournalMessageListener = reaction(
@@ -225,7 +226,9 @@ export default class JournalStore {
() => client?.loginid,
async loginid => {
await when(() => {
- const has_account = client.account_list?.find(account => account.loginid === loginid)?.title;
+ const has_account = client.account_list?.find(
+ (account: TAccountList[number]) => account.loginid === loginid
+ );
return !!has_account;
});
this.unfiltered_messages = getStoredItemsByUser(this.JOURNAL_CACHE, loginid, []);
diff --git a/src/stores/summary-card-store.ts b/src/stores/summary-card-store.ts
index f6eb6fee..39c89769 100644
--- a/src/stores/summary-card-store.ts
+++ b/src/stores/summary-card-store.ts
@@ -240,15 +240,21 @@ export default class SummaryCardStore {
const limit_order = this.getLimitOrder();
if (this.contract_info?.contract_id) {
- api_base.api.contractUpdate(this.contract_info?.contract_id, limit_order).then(response => {
- if (response.error) {
- this.root_store.run_panel.showContractUpdateErrorDialog(response.error.message);
- return;
- }
-
- // Update contract store
- this.populateContractUpdateConfig(response);
- });
+ if (this.contract_info?.contract_id) {
+ api_base.api
+ ?.send({
+ contract_update: 1,
+ contract_id: this.contract_info?.contract_id,
+ limit_order,
+ })
+ .then(response => {
+ // Update contract store
+ this.populateContractUpdateConfig(response);
+ })
+ .catch((error: { error: Error }) => {
+ this.root_store.run_panel.showContractUpdateErrorDialog(error?.error?.message);
+ });
+ }
}
}