Skip to content

Commit 2def619

Browse files
mahdiyeh-derivMahdiyeh Amirkhani
and
Mahdiyeh Amirkhani
authored
[COJ]/Mahdiyeh/338/fix: no assigned currency (deriv-com#13271)
* fix: no assigned currency * fix: uppercase --------- Co-authored-by: Mahdiyeh Amirkhani <mahdiyehamirkhani@Mahdiyeh-Amirkhanis-Mac-J79XQHKXVJ-Standard.local>
1 parent b03bdbb commit 2def619

File tree

4 files changed

+31
-17
lines changed

4 files changed

+31
-17
lines changed

packages/appstore/src/components/containers/currency-switcher-container.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import './currency-switcher-container.scss';
1010
interface CurrentSwitcherContainerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
1111
actions?: React.ReactNode;
1212
has_interaction?: boolean;
13-
icon: Currency | 'Options';
13+
icon: Currency | 'Options' | 'Unknown';
1414
title?: React.ReactNode;
1515
show_dropdown?: boolean;
1616
}

packages/appstore/src/components/currency-switcher-card/real/real-account-card.tsx

+23-12
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,18 @@ const RealAccountCard = observer(() => {
2727
.some(account => account.landing_company_short === 'maltainvest');
2828

2929
const uppercase_currency = currency?.toUpperCase();
30-
const get_currency = IsIconCurrency(uppercase_currency) ? uppercase_currency : 'USD';
30+
const get_currency = IsIconCurrency(uppercase_currency) ? uppercase_currency : 'Unknown';
3131

3232
return (
3333
<CurrencySwitcherContainer
3434
className='demo-account-card'
35-
title={<BalanceText currency={get_currency} balance={Number(balance)} size='xs' />}
35+
title={
36+
currency ? (
37+
<BalanceText currency={get_currency} balance={Number(balance)} size='xs' />
38+
) : (
39+
'No currency assigned'
40+
)
41+
}
3642
icon={get_currency}
3743
onClick={() => {
3844
if (!is_eu_user && !has_mf_mt5_account) {
@@ -41,16 +47,21 @@ const RealAccountCard = observer(() => {
4147
return openModal('currency_selection');
4248
}}
4349
actions={
44-
<Button
45-
onClick={(e: MouseEvent) => {
46-
e.stopPropagation();
47-
history.push(`${routes.cashier_deposit}#deposit`);
48-
}}
49-
secondary
50-
className='currency-switcher__button'
51-
>
52-
<Localize key={`currency-switcher__button-text-${current_language}`} i18n_default_text='Deposit' />
53-
</Button>
50+
currency && (
51+
<Button
52+
onClick={(e: MouseEvent) => {
53+
e.stopPropagation();
54+
history.push(`${routes.cashier_deposit}#deposit`);
55+
}}
56+
secondary
57+
className='currency-switcher__button'
58+
>
59+
<Localize
60+
key={`currency-switcher__button-text-${current_language}`}
61+
i18n_default_text='Deposit'
62+
/>
63+
</Button>
64+
)
5465
}
5566
has_interaction
5667
>

packages/core/src/App/Containers/CurrencySelectionModal/curreny-selection-modal.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ const CurrencySelectionModal = observer(({ is_visible }: CurrencySelectionModalP
7171
closeModal();
7272
}}
7373
>
74-
<CurrencyIcon className='currency-item-card__icons' icon={icon} size={32} />
74+
<CurrencyIcon
75+
className='currency-item-card__icons'
76+
icon={currency ? icon : 'UNKNOWN'}
77+
size={32}
78+
/>
7579
<div className='currency-item-card__details'>
7680
<Text size='xs'>{getCurrencyName(currency)}</Text>
7781
<Text color={is_selected ? 'prominent' : 'less-prominent'} size='xxs'>

packages/core/src/App/Containers/RealAccountSignup/set-currency.jsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,15 @@ import { observer, useStore } from '@deriv/stores';
1212

1313
const SetCurrency = observer(({ setLoading, onSuccessSetAccountCurrency, onError, is_loading, ...props }) => {
1414
const { client } = useStore();
15-
const { available_crypto_currencies, has_fiat, landing_company_shortcode } = client;
15+
const { available_crypto_currencies, has_fiat, landing_company_shortcode, setAccountCurrency } = client;
1616
const form_error = React.useState('');
1717
const form_value = React.useState({ currency: '' });
1818

1919
const setCurrency = (obj, setSubmitting) => {
2020
setLoading(true);
2121
const { currency } = obj;
2222
if (currency) {
23-
props
24-
.setCurrency(currency)
23+
setAccountCurrency(currency)
2524
.then(response => {
2625
setSubmitting(false);
2726
onSuccessSetAccountCurrency('', response.echo_req.set_account_currency);

0 commit comments

Comments
 (0)