Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:binary-com/deriv-app into niloo/…
Browse files Browse the repository at this point in the history
…84471/ts-migration-parent
  • Loading branch information
Niloofar Sadeghi committed Feb 16, 2023
2 parents 65626ab + c4981b0 commit 1ecbb05
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 20 deletions.
20 changes: 14 additions & 6 deletions packages/cashier/src/components/no-balance/no-balance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,25 @@ import { localize, Localize } from '@deriv/translations';
import { useStore, observer } from '@deriv/stores';
import { useCashierStore } from '../../stores/useCashierStores';

const NoBalance = observer(({ history }: RouteComponentProps) => {
type TNoBalanceProps = RouteComponentProps & {
onClickDeposit?: () => void;
};

const NoBalance = observer(({ history, onClickDeposit }: TNoBalanceProps) => {
const { client } = useStore();
const { currency } = client;
const { general_store } = useCashierStore();
const { setCashierTabIndex: setTabIndex } = general_store;
const is_deposit_locked = useDepositLocked();

const onClickDeposit = () => {
// index of deposit tab in the cashier modal is 0
setTabIndex(0);
history.push(routes.cashier_deposit);
const onClickDepositHandler = () => {
if (onClickDeposit) {
onClickDeposit();
} else {
// index of deposit tab in the cashier modal is 0
setTabIndex(0);
history.push(routes.cashier_deposit);
}
};

return (
Expand All @@ -39,7 +47,7 @@ const NoBalance = observer(({ history }: RouteComponentProps) => {
className='cashier__no-balance-button'
has_effect
text={localize('Deposit now')}
onClick={onClickDeposit}
onClick={onClickDepositHandler}
primary
large
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const AccountTransfer = observer(
return <AccountTransferNoAccount openAccountSwitcherModal={openAccountSwitcherModal} />;
}
if (has_no_accounts_balance) {
return <NoBalance />;
return <NoBalance onClickDeposit={onClickDeposit} />;
}
if (is_transfer_confirm) {
return <AccountTransferReceipt onClose={onClose} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,11 @@ const AccountSwitcher = props => {
canOpenMulti() &&
(!props.show_eu_related_content || (props.show_eu_related_content && props.can_change_fiat_currency));

const have_more_accounts = type =>
getSortedAccountList(props.account_list, props.accounts).filter(
account => !account.is_virtual && account.loginid.startsWith(type)
).length > 1;

const default_demo_accounts = (
<div className='acc-switcher__list-wrapper'>
{vrtc_loginid && (
Expand Down Expand Up @@ -1049,7 +1054,11 @@ const AccountSwitcher = props => {
<React.Fragment>
<AccountWrapper
className='acc-switcher__title'
header={localize('Non-EU regulation')}
header={
props.is_low_risk
? localize(`Non-EU Deriv ${have_more_accounts('CR') ? 'Accounts' : 'Account'}`)
: localize(`Deriv ${have_more_accounts('CR') ? 'accounts' : 'account'}`)
}
is_visible={is_non_eu_regulator_visible}
toggleVisibility={() => {
toggleVisibility('real_deriv');
Expand Down Expand Up @@ -1118,7 +1127,11 @@ const AccountSwitcher = props => {
) : null}
{!props.is_high_risk || props.is_eu ? (
<AccountWrapper
header={localize('EU regulation')}
header={
props.is_low_risk
? localize(`EU Deriv ${have_more_accounts('MF') ? 'Accounts' : 'Account'}`)
: localize(`Deriv ${have_more_accounts('MF') ? 'accounts' : 'account'}`)
}
is_visible={is_eu_regulator_visible}
toggleVisibility={() => {
toggleVisibility('real_deriv');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const getAccountTitle = (landing_company_shortcode, { account_residence =

switch (landing_company_shortcode) {
case 'svg':
return localize('Deriv account');
return localize('Options & Multipliers');
case 'iom':
if (country_standpoint.is_united_kingdom) {
return localize('Deriv Gaming');
Expand All @@ -51,15 +51,7 @@ export const getAccountTitle = (landing_company_shortcode, { account_residence =
}
return localize('Derived');
case 'maltainvest':
if (
country_standpoint.is_united_kingdom ||
country_standpoint.is_france ||
country_standpoint.is_other_eu ||
country_standpoint.is_rest_of_eu
) {
return localize('Multipliers');
}
return localize('Deriv Financial');
return localize('Multipliers');
default:
return localize('Deriv');
}
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/Stores/client-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -2513,7 +2513,11 @@ export default class ClientStore extends BaseStore {
const { gaming_company, financial_company } = this.landing_companies;
const low_risk_landing_company =
financial_company?.shortcode === 'maltainvest' && gaming_company?.shortcode === 'svg';
return low_risk_landing_company || this.upgradeable_landing_companies?.includes('svg', 'maltainvest');
return (
low_risk_landing_company ||
(this.upgradeable_landing_companies?.includes('svg') &&
this.upgradeable_landing_companies?.includes('maltainvest'))
);
}

get has_residence() {
Expand Down

0 comments on commit 1ecbb05

Please sign in to comment.