Skip to content

Commit

Permalink
hamid/hide-reset-balance (binary-com#6104)
Browse files Browse the repository at this point in the history
* Hide reset button if balance is 10000

* Fix console error of propTypes

* Change the location of the condition

* Add const for account init balance

* Ignore eslint warning

* Change namve convention of the method
  • Loading branch information
Hamid authored and adrienne-deriv committed Oct 7, 2022
1 parent 4af1417 commit a9be90a
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const AccountSwitcher = props => {
getExchangeRate(props.accounts[vrtc_loginid].currency, props.obj_total_balance.currency).then(res =>
setExchangedRate(res)
);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

React.useEffect(() => {
Expand Down Expand Up @@ -454,6 +455,11 @@ const AccountSwitcher = props => {
return props.is_dxtrade_allowed;
};

const canResetBalance = account => {
const account_init_balance = 10000;
return account.is_virtual && account.balance < account_init_balance;
};

const checkMultipleSvgAcc = () => {
const all_svg_acc = [];
getRealMT5().map(acc => {
Expand Down Expand Up @@ -495,7 +501,7 @@ const AccountSwitcher = props => {
country_standpoint={props.country_standpoint}
display_type={'currency'}
has_balance={'balance' in props.accounts[account.loginid]}
has_reset_balance={props.accounts[props.account_loginid].is_virtual}
has_reset_balance={canResetBalance(props.accounts[props.account_loginid])}
is_disabled={account.is_disabled}
is_virtual={account.is_virtual}
loginid={account.loginid}
Expand Down

0 comments on commit a9be90a

Please sign in to comment.