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

Nav Redesign: Remove notifications pointer #91061

Merged
merged 1 commit into from
May 24, 2024
Merged
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
1 change: 0 additions & 1 deletion client/layout/global-sidebar/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export const GlobalSidebarFooter: FC< {
className="sidebar__item-notifications"
tooltip={ translate( 'Notifications' ) }
onClick={ () => recordTracksEvent( GLOBAL_SIDEBAR_EVENTS.NOTIFICATION_CLICK ) }
translate={ translate }
/>
</>
) }
Expand Down
59 changes: 10 additions & 49 deletions client/layout/global-sidebar/menu-items/notifications/index.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
import { englishLocales } from '@automattic/i18n-utils';
import { hasTranslation } from '@wordpress/i18n';
import classNames from 'classnames';
import PropTypes from 'prop-types';
import { Component } from 'react';
import { createPortal } from 'react-dom';
import { connect } from 'react-redux';
import DismissibleCard from 'calypso/blocks/dismissible-card';
import TranslatableString from 'calypso/components/translatable/proptype';
import SidebarMenuItem from 'calypso/layout/global-sidebar/menu-items/menu-item';
import { isE2ETest } from 'calypso/lib/e2e';
import { getCurrentUserId } from 'calypso/state/current-user/selectors';
import getCurrentLocaleSlug from 'calypso/state/selectors/get-current-locale-slug';
import getUnseenCount from 'calypso/state/selectors/get-notification-unseen-count';
import isNotificationsOpen from 'calypso/state/selectors/is-notifications-open';
import { toggleNotificationsPanel } from 'calypso/state/ui/actions';
Expand All @@ -27,9 +20,6 @@ class SidebarNotifications extends Component {
isNotificationsOpen: PropTypes.bool,
unseenCount: PropTypes.number,
tooltip: TranslatableString,
translate: PropTypes.func,
currentUserId: PropTypes.number,
locale: PropTypes.string,
};

state = {
Expand Down Expand Up @@ -97,44 +87,17 @@ class SidebarNotifications extends Component {
'is-initial-load': this.state.animationState === -1,
} );

const shouldShowNotificationsPointer =
// Show pointer for 2 weeks.
Date.now() < Date.parse( '23 May 2024' ) &&
// Show pointer to users registered before 08-May-2024 (when we moved the notifications to the footer).
this.props.currentUserId < 250450000 &&
// Show pointer only if translated.
( englishLocales.includes( this.props.locale ) ||
hasTranslation( 'Looking for your notifications? They have been moved here.' ) ) &&
// Hide pointer on E2E tests so it doesn't hide menu items that are expected to be visible.
! isE2ETest();

return (
<>
{ shouldShowNotificationsPointer &&
createPortal(
<DismissibleCard
className="sidebar-notifications-pointer"
preferenceName="nav-redesign-notifications-footer-pointer"
>
<span>
{ this.props.translate(
'Looking for your notifications? They have been moved here.'
) }
</span>
</DismissibleCard>,
document.querySelector( '.layout' )
) }
<SidebarMenuItem
url="/notifications"
icon={ <BellIcon newItems={ this.state.newNote } active={ this.props.isActive } /> }
onClick={ this.handleClick }
isActive={ this.props.isActive }
tooltip={ this.props.tooltip }
tooltipPlacement="top"
className={ classes }
key={ this.state.animationState }
/>
</>
<SidebarMenuItem
url="/notifications"
icon={ <BellIcon newItems={ this.state.newNote } active={ this.props.isActive } /> }
onClick={ this.handleClick }
isActive={ this.props.isActive }
tooltip={ this.props.tooltip }
tooltipPlacement="top"
className={ classes }
key={ this.state.animationState }
/>
);
}
}
Expand All @@ -145,8 +108,6 @@ const mapStateToProps = ( state ) => {
isActive: isPanelOpen || window.location.pathname === '/read/notifications',
isNotificationsOpen: isPanelOpen,
unseenCount: getUnseenCount( state ),
currentUserId: getCurrentUserId( state ),
locale: getCurrentLocaleSlug( state ),
};
};
const mapDispatchToProps = {
Expand Down
68 changes: 0 additions & 68 deletions client/layout/global-sidebar/menu-items/notifications/style.scss
Original file line number Diff line number Diff line change
@@ -1,71 +1,3 @@
.sidebar-notifications__panel {
position: absolute;
}

.sidebar-notifications-pointer {
position: absolute;
z-index: z-index("root", ".layout__secondary");
bottom: 55px;
left: 35px;
background: var(--studio-black);
color: var(--studio-white);
/* stylelint-disable-next-line scales/font-sizes */
font-size: 0.8125rem;
margin: 0;
padding: 12px;
box-shadow: none;
display: flex;
flex-direction: column-reverse;
width: 250px;

&::after {
content: "";
position: absolute;
top: 100%;
left: 0;
right: 0;
margin: 0 auto;
width: 0;
height: 0;
border-top: 8px solid var(--studio-black);
border-left: 8px solid transparent;
border-right: 8px solid transparent;
visibility: visible;
}

.dismissible-card__close-button {
position: relative;
width: auto;
height: auto;
top: auto;
right: auto;
margin-top: 12px;
margin-right: 0;
background-color: var(--color-accent);
border-color: var(--color-accent);
color: var(--color-text-inverted);
font-size: $font-body-extra-small;
line-height: 1;
border-radius: 2px;
padding: 7px;
align-self: flex-end;

&::before {
content: attr(aria-label);
}

svg {
display: none;
}
}
}

.is-global-sidebar-collapsed .sidebar-notifications-pointer {
display: none;
}

@media ( max-width: 782px ) {
.sidebar-notifications-pointer {
display: none;
}
}
Loading