Skip to content
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

DTRA / Kate / FEQ-2213 + FEQ-2205 / Made popover optional #15197

Merged
Show file tree
Hide file tree
Changes from 2 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
31 changes: 19 additions & 12 deletions packages/core/src/App/Components/Layout/Header/account-actions.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as PropTypes from 'prop-types';
import React from 'react';
import { Button, Icon, Popover } from '@deriv/components';
import { routes, formatMoney, PlatformContext, moduleLoader } from '@deriv/shared';
import { routes, formatMoney, PlatformContext, moduleLoader, isTabletOs } from '@deriv/shared';
import { localize, Localize } from '@deriv/translations';
import { LoginButton } from './login-button.jsx';
import { SignupButton } from './signup-button.jsx';
Expand Down Expand Up @@ -41,6 +41,11 @@ const AccountActions = React.memo(
}) => {
const { is_appstore } = React.useContext(PlatformContext);
const { isDesktop } = useDevice();
const accountSettings = (
<BinaryLink className='account-settings-toggle' to={routes.personal_details}>
<Icon icon='IcUserOutline' />
</BinaryLink>
);

if (is_logged_in) {
if (isDesktop) {
Expand All @@ -53,17 +58,19 @@ const AccountActions = React.memo(
tooltip_message={<Localize i18n_default_text='View notifications' />}
should_disable_pointer_events
/>
<Popover
classNameBubble='account-settings-toggle__tooltip'
alignment='bottom'
message={<Localize i18n_default_text='Manage account settings' />}
should_disable_pointer_events
zIndex={9999}
>
<BinaryLink className='account-settings-toggle' to={routes.personal_details}>
<Icon icon='IcUserOutline' />
</BinaryLink>
</Popover>
{isTabletOs ? (
accountSettings
) : (
<Popover
classNameBubble='account-settings-toggle__tooltip'
alignment='bottom'
message={<Localize i18n_default_text='Manage account settings' />}
should_disable_pointer_events
zIndex={9999}
>
{accountSettings}
</Popover>
)}
<React.Suspense fallback={<div />}>
<AccountInfo
acc_switcher_disabled_message={acc_switcher_disabled_message}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Counter, Icon, Popover } from '@deriv/components';
import NotificationsDialog from 'App/Containers/NotificationsDialog';
import 'Sass/app/modules/notifications-dialog.scss';
import { useDevice } from '@deriv-com/ui';
import { isTabletOs } from '@deriv/shared';

const ToggleNotificationsDrawer = ({
count,
Expand Down Expand Up @@ -44,15 +45,19 @@ const ToggleNotificationsDrawer = ({
'notifications-toggle--active': is_visible,
})}
>
<Popover
classNameBubble='notifications-toggle__tooltip'
alignment='bottom'
message={tooltip_message}
should_disable_pointer_events={should_disable_pointer_events}
zIndex='9999'
>
{notifications_toggler_el}
</Popover>
{isTabletOs ? (
notifications_toggler_el
) : (
<Popover
classNameBubble='notifications-toggle__tooltip'
alignment='bottom'
message={tooltip_message}
should_disable_pointer_events={should_disable_pointer_events}
zIndex='9999'
>
{notifications_toggler_el}
</Popover>
)}
<NotificationsDialog is_visible={is_visible} toggleDialog={toggleDialog} />
</div>
);
Expand Down
3 changes: 2 additions & 1 deletion packages/shared/src/utils/os/os_detect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export const isMobileOs = () =>

export const isTabletOs =
/ipad|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase()) ||
(/android/i.test(navigator.userAgent.toLowerCase()) && !/mobile/i.test(navigator.userAgent.toLowerCase()));
(/android/i.test(navigator.userAgent.toLowerCase()) && !/mobile/i.test(navigator.userAgent.toLowerCase())) ||
(/MacIntel|Linux/.test(navigator.platform) && navigator.maxTouchPoints > 0);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: function for detection TabletOS was taken from here. Failing test cases were also fixed there.


export const OSDetect = () => {
// For testing purposes or more compatibility, if we set 'config.os'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import PurchaseButton from 'Modules/Trading/Components/Elements/purchase-button'
import CancelDealInfo from '../Form/Purchase/cancel-deal-info';
import { TProposalTypeInfo, TTradeStore } from 'Types';
import { useDevice } from '@deriv-com/ui';
import { isTabletOs } from '@deriv/shared';

type TPurchaseFieldset = {
basis: string;
Expand Down Expand Up @@ -158,7 +159,7 @@ const PurchaseFieldset = ({
</Popover>
) : (
<React.Fragment>
{is_multiplier ? (
{is_multiplier && !isTabletOs ? (
<Popover
alignment='left'
is_bubble_hover_enabled
Expand Down
Loading