Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #425 from sandeep-deriv/sandeep/wall-3540/replace-…
Browse files Browse the repository at this point in the history
…the-funds-button

sandeep/wall-3540/added manage funds for wallets account
  • Loading branch information
sandeep-deriv authored Mar 21, 2024
2 parents d2ae19a + 0a8b0b8 commit 493e1c1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import Text from '../../common/text/text.jsx';
import './account-wallet-dropdown.scss';

const AccountWalletDropdown = React.forwardRef(({ setIsAccDropdownOpen }, dropdownRef) => {
const { accounts, account_list, is_virtual } = useSelector(state => state.client);
const { accounts, account_list } = useSelector(state => state.client);
const container_ref = React.useRef();
let all_accounts = [];
const { deposit } = config;
const { label, url } = deposit;
const { manage_funds } = config;

const transformAccounts = () =>
Object.keys(accounts).forEach(account => {
Expand Down Expand Up @@ -80,10 +79,12 @@ const AccountWalletDropdown = React.forwardRef(({ setIsAccDropdownOpen }, dropdo
<WalletContent setIsAccDropdownOpen={setIsAccDropdownOpen} accounts={all_accounts} />
</div>
<div>
{isMobile() && !is_virtual && (
{isMobile() && (
<div className='account__switcher-manage-funds'>
<a href={url}>
<button className='account__switcher-wallet-btn'>{translate(label)}</button>
<a href={manage_funds.url}>
<button className='account__switcher-wallet-btn'>
{translate(manage_funds.label)}
</button>
</a>
</div>
)}
Expand Down
18 changes: 9 additions & 9 deletions src/components/Header/account-actions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ import AccountMenu from './account-menu.jsx';

const AccountActions = () => {
const { is_virtual, has_wallet_account } = useSelector(state => state.client);
const { deposit, deposit_wallets } = config;
const { visible, label, url } = deposit;
const { deposit, manage_funds } = config;
const { account_switcher_id, is_bot_running } = useSelector(state => state.ui);
const [is_acc_dropdown_open, setIsAccDropdownOpen] = React.useState(false);
const dropdownRef = React.useRef();
Expand Down Expand Up @@ -98,13 +97,14 @@ const AccountActions = () => {
{is_acc_dropdown_open && (
<AccountDropdown virtual={is_virtual} ref={dropdownRef} setIsAccDropdownOpen={setIsAccDropdownOpen} />
)}

{visible && (!has_wallet_account || (!is_virtual && has_wallet_account)) && (
<a
className='url-cashier-deposit btn btn--primary header__deposit mobile-hide'
href={!has_wallet_account ? url : deposit_wallets.url}
>
{translate(label)}
{deposit.visible && !has_wallet_account && (
<a className='url-cashier-deposit btn btn--primary header__deposit mobile-hide' href={deposit.url}>
{deposit.label}
</a>
)}
{manage_funds.visible && has_wallet_account && (
<a className='url-cashier-deposit btn btn--primary header__deposit mobile-hide' href={manage_funds.url}>
{manage_funds.label}
</a>
)}
{account_switcher_id && (
Expand Down
6 changes: 4 additions & 2 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,10 @@ const getConfig = () => ({
url: `${related_deriv_origin.origin}/cashier/deposit?lang=${localStorage.getItem('lang')}`,
label: translate('Deposit'),
},
deposit_wallets: {
url: `${related_deriv_origin.origin}/wallets/cashier/deposit?lang=${localStorage.getItem('lang')}`,
manage_funds: {
visible: true,
url: `${related_deriv_origin.origin}/wallets/cashier/transfer?lang=${localStorage.getItem('lang')}`,
label: translate('Manage Funds'),
},
});

Expand Down

0 comments on commit 493e1c1

Please sign in to comment.