Skip to content

Commit

Permalink
chore: change to check and trading hub instead of or (#17971)
Browse files Browse the repository at this point in the history
  • Loading branch information
suisin-deriv authored Jan 14, 2025
1 parent 8664cb5 commit 29def0b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ const PlatformDropdown = ({ app_routing_history, closeDrawer, platform_config, s
const { isDesktop } = useDevice();
const { isHubRedirectionEnabled } = useIsHubRedirectionEnabled();
const { client } = useStore();
const { account_settings } = client;
const { account_settings, has_wallet } = client;
const { trading_hub } = account_settings;

const TradersHubRedirect = () => {
return (
<div className='platform-dropdown__cta'>
<BinaryLink
onClick={() => {
if (isHubRedirectionEnabled || !!trading_hub) {
if (isHubRedirectionEnabled && has_wallet && !!trading_hub) {
window.location.assign(platforms.tradershub_os.url);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const AccountSwitcherWalletMobile = observer(({ is_visible, toggle, login
}, [toggle]);

const handleTradersHubRedirect = () => {
if (isHubRedirectionEnabled || !!trading_hub) {
if (isHubRedirectionEnabled && !!trading_hub) {
window.location.assign(platforms.tradershub_os.url);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const AccountSwitcherWallet = observer(({ is_visible, toggle }: TAccountS
useOnClickOutside(wrapper_ref, closeAccountsDialog, validateClickOutside);

const handleTradersHubRedirect = async () => {
if (isHubRedirectionEnabled || !!trading_hub) {
if (isHubRedirectionEnabled && !!trading_hub) {
window.location.assign(platforms.tradershub_os.url);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const RootComponent = observer(props => {
const STAGING_REDIRECT_URL = 'https://staging-hub.deriv.com/tradershub/options';

useEffect(() => {
if (((isHubRedirectionEnabled && has_wallet) || !!trading_hub) && !prevent_redirect_to_hub) {
if (isHubRedirectionEnabled && has_wallet && !!trading_hub && !prevent_redirect_to_hub) {
const redirectUrl = process.env.NODE_ENV === 'production' ? PRODUCTION_REDIRECT_URL : STAGING_REDIRECT_URL;
window.location.assign(redirectUrl);
}
Expand All @@ -53,7 +53,7 @@ const RootComponent = observer(props => {
}}
notificationMessagesUi={notification_messages_ui}
onWalletsOnboardingTourGuideCloseHandler={onWalletsOnboardingTourGuideCloseHandler}
isHubRedirectionEnabled={isHubRedirectionEnabled || !!trading_hub}
isHubRedirectionEnabled={isHubRedirectionEnabled && !!trading_hub}
/>
) : (
<AppStore {...props} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const ModalProvider = ({ children }: React.PropsWithChildren<unknown>) => {
}));
// We need to add this check here because wallets account is coming from Low-Code tradershub.
// This condition is to reload the page when the modal is closed.
if (isHubRedirectionEnabled || !!tradingHub) {
if (isHubRedirectionEnabled && !!tradingHub) {
window.location.reload();
}
};
Expand Down

0 comments on commit 29def0b

Please sign in to comment.