Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mahdiyeh/73628/compare account modal #6721

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions packages/appstore/src/components/CFDs/cfd-accounts-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import { Localize } from '@deriv/translations';
import { Loading, Text, StaticUrl } from '@deriv/components';
import { TPlatform, TAccountCategory, TMt5StatusServer, TMt5StatusServerType, TRootStore } from 'Types';
import { useStores } from 'Stores/index';
import { CompareAccountsModal } from '@deriv/cfd';

type TCFDAccountsProps = {
account_type: TAccountCategory;
};

const CFDAccounts = ({ account_type }: TCFDAccountsProps) => {
const { client, modules }: TRootStore = useStores();
const store = useStores();
const { client, modules }: TRootStore = store;
const {
is_eu,
is_eu_country,
Expand All @@ -29,7 +31,8 @@ const CFDAccounts = ({ account_type }: TCFDAccountsProps) => {
trading_platform_available_accounts,
} = client;

const { current_list } = modules.cfd;
const { current_list, is_compare_accounts_visible, toggleCompareAccountsModal } = modules.cfd;
const is_demo_tab = account_type === 'demo';

const hasAccount = (platform: TPlatform, landing_company_short?: string) =>
Object.keys(current_list).some(key =>
Expand Down Expand Up @@ -73,9 +76,11 @@ const CFDAccounts = ({ account_type }: TCFDAccountsProps) => {
<Text weight='bold' size='m'>
CFDs
</Text>
<Text weight='bold' size='xxs' color='red'>
<Localize i18n_default_text='Compare accounts' />
</Text>
<div className='cfd-accounts-container__compare-accounts' onClick={toggleCompareAccountsModal}>
<Text weight='bold' size='xxs' color='red'>
<Localize i18n_default_text='Compare accounts' />
</Text>
</div>
</div>
<div className='cfd-demo-account__description'>
<Text>
Expand Down Expand Up @@ -118,6 +123,15 @@ const CFDAccounts = ({ account_type }: TCFDAccountsProps) => {
available_accounts={trading_platform_available_accounts}
/>
)}
{is_compare_accounts_visible && (
<CompareAccountsModal
context={store}
is_demo_tab={is_demo_tab}
// TODO: Will handle it in CFD flows
// openPasswordModal={openRealPasswordModal}
is_real_enabled={has_active_real_account}
/>
)}
</div>
);
};
Expand Down
Loading