@@ -7,7 +7,8 @@ import { THooks } from '@/types';
7
7
import { useActiveTradingAccount , useResetVirtualBalance } from '@deriv/api' ;
8
8
import { Provider } from '@deriv/library' ;
9
9
import { StandaloneChevronDownBoldIcon } from '@deriv/quill-icons' ;
10
- import { Button , Text } from '@deriv-com/ui' ;
10
+ import { Button } from '@deriv-com/ui' ;
11
+ import { DemoCurrencySwitcherAccountInfo , RealCurrencySwitcherAccountInfo } from './CurrencySwitcherAccountInfo' ;
11
12
12
13
type AccountActionButtonProps = {
13
14
balance : THooks . ActiveTradingAccount [ 'balance' ] ;
@@ -53,25 +54,20 @@ const CurrencySwitcher = () => {
53
54
54
55
if ( ! isSuccess ) return < CurrencySwitcherLoader /> ;
55
56
57
+ const { icon, text } = IconToCurrencyMapper [ iconCurrency ] ;
58
+
56
59
return (
57
60
< div className = 'flex items-center justify-between w-full border-solid h-3600 p-800 rounded-400 border-75 border-system-light-active-background lg:w-auto lg:shrink-0 gap-800' >
58
- < div className = 'flex-none ' > { IconToCurrencyMapper [ iconCurrency ] . icon } </ div >
61
+ < div className = 'flex-none ' > { icon } </ div >
59
62
< div className = 'grow' >
60
- < Text
61
- as = 'p'
62
- className = { isDemo ? 'text-status-light-information' : 'text-system-light-less-prominent-text' }
63
- size = 'sm'
64
- weight = { isDemo ? 'bold' : 'normal' }
65
- >
66
- { isDemo ? activeAccount . display_balance : IconToCurrencyMapper [ iconCurrency ] . text }
67
- </ Text >
68
- < Text
69
- className = { ! isDemo ? 'text-status-light-success' : '' }
70
- size = 'sm'
71
- weight = { isDemo ? 'normal' : 'bold' }
72
- >
73
- { isDemo ? 'Demo' : activeAccount ?. display_balance }
74
- </ Text >
63
+ { isDemo ? (
64
+ < DemoCurrencySwitcherAccountInfo displayBalance = { activeAccount ?. display_balance } />
65
+ ) : (
66
+ < RealCurrencySwitcherAccountInfo
67
+ currencyText = { text }
68
+ displayBalance = { activeAccount ?. display_balance }
69
+ />
70
+ ) }
75
71
</ div >
76
72
< div className = 'flex-none' >
77
73
< AccountActionButton balance = { activeAccount ?. balance ?? 0 } isDemo = { isDemo ?? false } />
0 commit comments