Skip to content

Moiz-Bot 2787-Account switcher fixes on Dbot #371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/components/layout/header/common/demo-accounts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { localize } from '@deriv-com/translations';
import { AccountSwitcher as UIAccountSwitcher } from '@deriv-com/ui';
import AccountSwitcherFooter from './account-swticher-footer';
import { TDemoAccounts } from './types';
import { AccountSwitcherDivider, convertCommaValue } from './utils';
import { convertCommaValue } from './utils';

const DemoAccounts = ({
tabs_labels,
Expand Down Expand Up @@ -51,7 +51,6 @@ const DemoAccounts = ({
</span>
))}
</UIAccountSwitcher.AccountsPanel>
<AccountSwitcherDivider />
<AccountSwitcherFooter loginid={activeLoginId} oAuthLogout={oAuthLogout} is_logging_out={is_logging_out} />
</>
);
Expand Down
31 changes: 18 additions & 13 deletions src/components/layout/header/common/eu-accounts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import clsx from 'clsx';
import { localize } from '@deriv-com/translations';
import { AccountSwitcher as UIAccountSwitcher } from '@deriv-com/ui';
import { TEuAccounts } from './types';
import { AccountSwitcherDivider } from './utils';

const EuAccounts = ({
isVirtual,
Expand All @@ -25,19 +26,23 @@ const EuAccounts = ({
{modifiedMFAccountList.map(account => {
account.currencyLabel = localize('Multipliers');
return (
<span
className={clsx('account-switcher__item', {
'account-switcher__item--disabled': account.is_disabled,
})}
key={account.loginid}
>
<UIAccountSwitcher.AccountsItem
account={account}
onSelectAccount={() => {
if (!account.is_disabled) switchAccount(account.loginid);
}}
/>
</span>
<>
{' '}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove this?

<span
className={clsx('account-switcher__item', {
'account-switcher__item--disabled': account.is_disabled,
})}
key={account.loginid}
>
<UIAccountSwitcher.AccountsItem
account={account}
onSelectAccount={() => {
if (!account.is_disabled) switchAccount(account.loginid);
}}
/>
</span>
{modifiedMFAccountList.length > 0 && <AccountSwitcherDivider />}
</>
);
})}
</UIAccountSwitcher.AccountsPanel>
Expand Down
30 changes: 17 additions & 13 deletions src/components/layout/header/common/non-eu-accounts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import clsx from 'clsx';
import { localize } from '@deriv-com/translations';
import { AccountSwitcher as UIAccountSwitcher } from '@deriv-com/ui';
import { TNonEUAccounts } from './types';
import { AccountSwitcherDivider } from './utils';

const NonEUAccounts = ({
isVirtual,
Expand All @@ -28,19 +29,22 @@ const NonEUAccounts = ({
key={!isVirtual ? tabs_labels.demo.toLowerCase() : tabs_labels?.real.toLowerCase()}
>
{modifiedCRAccountList.map(account => (
<span
className={clsx('account-switcher__item', {
'account-switcher__item--disabled': account.is_disabled,
})}
key={account.loginid}
>
<UIAccountSwitcher.AccountsItem
account={account}
onSelectAccount={() => {
if (!account.is_disabled) switchAccount(account.loginid);
}}
/>
</span>
<>
<span
className={clsx('account-switcher__item', {
'account-switcher__item--disabled': account.is_disabled,
})}
key={account.loginid}
>
<UIAccountSwitcher.AccountsItem
account={account}
onSelectAccount={() => {
if (!account.is_disabled) switchAccount(account.loginid);
}}
/>
</span>
{modifiedCRAccountList.length > 0 && <AccountSwitcherDivider />}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{modifiedCRAccountList.length > 0 && <AccountSwitcherDivider />}
{modifiedCRAccountList.length && <AccountSwitcherDivider />}

</>
))}
</UIAccountSwitcher.AccountsPanel>
</>
Expand Down
2 changes: 0 additions & 2 deletions src/components/layout/header/common/real-accounts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const RealAccounts = ({
tabs_labels={tabs_labels}
is_low_risk_country={is_low_risk_country}
/>
<AccountSwitcherDivider />
</>
) : (
<>
Expand All @@ -52,7 +51,6 @@ const RealAccounts = ({
tabs_labels={tabs_labels}
is_low_risk_country={is_low_risk_country}
/>
<AccountSwitcherDivider />
</>
)}
<AccountSwitcherFooter oAuthLogout={oAuthLogout} loginid={loginid} is_logging_out={is_logging_out} />
Expand Down
Loading