Skip to content

Commit

Permalink
Merge branch 'sergei/wall-1140/limited-functionality-wallets' of gith…
Browse files Browse the repository at this point in the history
…ub.com:sergei-deriv/deriv-app into sergei/wall-1140/limited-functionality-wallets
  • Loading branch information
sergei-deriv committed Aug 2, 2023
2 parents d585843 + 292f462 commit 2b1b84a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@
padding: 0;
}

&--disabled {
opacity: 0.32;
}

&-icon {
width: 16px;
height: 16px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
useIsRealAccountNeededForCashier,
useIsP2PEnabled,
usePaymentAgentTransferVisible,
useWalletMigration,
} from '@deriv/hooks';
import { routes, PlatformContext, getStaticUrl, whatsapp_url } from '@deriv/shared';
import { observer, useStore } from '@deriv/stores';
Expand All @@ -22,7 +23,18 @@ import useLiveChat from 'App/Components/Elements/LiveChat/use-livechat.ts';
import PlatformSwitcher from './platform-switcher';

const MenuLink = observer(
({ link_to, icon, is_active, is_disabled, is_language, suffix_icon, text, onClickLink, is_hidden }) => {
({
link_to,
icon,
is_active,
is_disabled,
as_disabled,
is_language,
suffix_icon,
text,
onClickLink,
is_hidden,
}) => {
const { common, ui, client } = useStore();
const { changeCurrentLanguage } = common;
const deriv_static_url = getStaticUrl(link_to);
Expand Down Expand Up @@ -113,7 +125,9 @@ const MenuLink = observer(
<div
className={classNames('header__menu-mobile-link', {
'header__menu-mobile-link--disabled': is_disabled,
'dc-mobile-drawer__submenu-toggle--disabled': as_disabled,
})}
onClick={onClickLink}
>
<Icon className='header__menu-mobile-link-icon' icon={icon} />
<span className='header__menu-mobile-link-text'>{text}</span>
Expand Down Expand Up @@ -184,6 +198,7 @@ const ToggleMenuDrawer = observer(({ platform_config }) => {
is_landing_company_loaded,
is_pending_proof_of_ownership,
is_eu,
setWalletsMigrationInProgressPopup,
} = client;
const { cashier } = modules;
const { payment_agent } = cashier;
Expand All @@ -203,6 +218,7 @@ const ToggleMenuDrawer = observer(({ platform_config }) => {
const { is_appstore } = React.useContext(PlatformContext);
const timeout = React.useRef();
const history = useHistory();
const { is_in_progress } = useWalletMigration();

React.useEffect(() => {
const processRoutes = () => {
Expand Down Expand Up @@ -260,14 +276,21 @@ const ToggleMenuDrawer = observer(({ platform_config }) => {
const has_access = route_config.is_authenticated ? is_logged_in : true;
if (!has_access) return null;

if (!route_config.routes) {
const is_cashier = route_config.path === routes.cashier;
const should_disable_cashier = is_cashier && is_in_progress;

if (should_disable_cashier || !route_config.routes) {
return (
<MobileDrawer.Item key={idx}>
<MenuLink
link_to={route_config.path}
link_to={should_disable_cashier ? undefined : route_config.path}
icon={route_config.icon_component}
text={route_config.getTitle()}
onClickLink={toggleDrawer}
as_disabled={should_disable_cashier}
onClickLink={() => {
toggleDrawer();
if (should_disable_cashier) setWalletsMigrationInProgressPopup(true);
}}
/>
</MobileDrawer.Item>
);
Expand All @@ -287,6 +310,7 @@ const ToggleMenuDrawer = observer(({ platform_config }) => {
}
return false;
};

return (
<MobileDrawer.SubMenu
key={idx}
Expand Down

0 comments on commit 2b1b84a

Please sign in to comment.