Skip to content

Commit 5c295ee

Browse files
dognose24claude
andauthored
Stats: remove the Traffic page settings onboarding tour (#113271)
The tooltip copy promised "all your Jetpack Stats settings" behind the gear icon, but the icon only toggles module visibility; the copy was written for widget features that never shipped. Remove the tour Popover, the traffic_page_settings notice wiring, and the now-unused withNoticeHook/delay logic left in StatsNavigation from when the toggler lived there. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 7e07509 commit 5c295ee

6 files changed

Lines changed: 1 addition & 120 deletions

File tree

client/assets/stylesheets/shared/functions/_z-index.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ $z-layers: (
133133
".drop-zone__content": 1010,
134134
".tooltip.popover": 100000,
135135
".tooltip.popover.page-modules-settings-popover": 175,
136-
".tooltip.popover.highlight-card__settings-tooltip": 170,
137136
".fullscreen-overlay": 100005,
138137
"#wp_editbtns": 100020,
139138
"#wp-fullscreen-body": 100010,

client/blocks/stats-navigation/index.jsx

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import QueryJetpackModules from 'calypso/components/data/query-jetpack-modules';
1111
import SectionNav from 'calypso/components/section-nav';
1212
import NavItem from 'calypso/components/section-nav/item';
1313
import NavTabs from 'calypso/components/section-nav/tabs';
14-
import useNoticeVisibilityMutation from 'calypso/my-sites/stats/hooks/use-notice-visibility-mutation';
15-
import { useNoticeVisibilityQuery } from 'calypso/my-sites/stats/hooks/use-notice-visibility-query';
1614
import { canCurrentUser } from 'calypso/state/selectors/can-current-user';
1715
import isGoogleMyBusinessLocationConnectedSelector from 'calypso/state/selectors/is-google-my-business-location-connected';
1816
import isJetpackModuleActive from 'calypso/state/selectors/is-jetpack-module-active';
@@ -42,29 +40,6 @@ import './style.scss';
4240
* }} StatsNavItem
4341
*/
4442

45-
// Use HOC to wrap hooks of `react-query` for fetching the notice visibility state.
46-
function withNoticeHook( HookedComponent ) {
47-
return function WrappedComponent( props ) {
48-
const { data: showSettingsTooltip, refetch: refetchNotices } = useNoticeVisibilityQuery(
49-
props.siteId,
50-
'traffic_page_settings'
51-
);
52-
53-
const { mutateAsync: mutateNoticeVisbilityAsync } = useNoticeVisibilityMutation(
54-
props.siteId,
55-
'traffic_page_settings'
56-
);
57-
58-
return (
59-
<HookedComponent
60-
{ ...props }
61-
showSettingsTooltip={ showSettingsTooltip }
62-
refetchNotices={ refetchNotices }
63-
mutateNoticeVisbilityAsync={ mutateNoticeVisbilityAsync }
64-
/>
65-
);
66-
};
67-
}
6843
/**
6944
* @param { { navItems: StatsNavItem[], selectedItemName: keyof typeof allNavItems, isLegacy: boolean, interval: string, pathTemplate: string } } props
7045
*/
@@ -166,7 +141,6 @@ class StatsNavigation extends Component {
166141
isLegacy: PropTypes.bool,
167142
adminUrl: PropTypes.string,
168143
showLock: PropTypes.bool,
169-
delayTooltipPresentation: PropTypes.bool,
170144
};
171145

172146
isValidItem = ( item ) => {
@@ -271,25 +245,6 @@ class StatsNavigation extends Component {
271245
}
272246
}
273247

274-
function shouldDelayTooltipPresentation( state, siteId ) {
275-
// Check the 'created_at' time stamp.
276-
// Can return null (Redux hydration?) which we'll treat as a delay.
277-
const siteCreatedTimeStamp = getSiteOption( state, siteId, 'created_at' );
278-
if ( siteCreatedTimeStamp === null ) {
279-
return true;
280-
}
281-
282-
// Check if the site is less than one week old.
283-
const WEEK_IN_MILLISECONDS = 7 * 1000 * 3600 * 24;
284-
const siteIsLessThanOneWeekOld =
285-
new Date( siteCreatedTimeStamp ) > new Date( Date.now() - WEEK_IN_MILLISECONDS );
286-
if ( siteIsLessThanOneWeekOld ) {
287-
return true;
288-
}
289-
290-
return false;
291-
}
292-
293248
export default connect(
294249
( state, { siteId, selectedItem } ) => {
295250
return {
@@ -307,8 +262,7 @@ export default connect(
307262
siteId,
308263
pageModuleToggles: getModuleToggles( state, siteId, [ selectedItem ] ),
309264
adminUrl: getSiteAdminUrl( state, siteId ),
310-
delayTooltipPresentation: shouldDelayTooltipPresentation( state, siteId ),
311265
};
312266
},
313267
{ requestModuleToggles, updateModuleToggles }
314-
)( localize( withNoticeHook( StatsNavigation ) ) );
268+
)( localize( StatsNavigation ) );

client/blocks/stats-navigation/page-module-toggler.tsx

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import { AVAILABLE_PAGE_MODULES, ModuleToggleItem } from './constants';
1212

1313
type PageModuleTogglerProps = {
1414
moduleToggles: { [ name: string ]: boolean };
15-
isTooltipShown: boolean;
16-
onTooltipDismiss: () => void;
1715
customToggleIcon?: React.ReactNode;
1816
siteId: number;
1917
selectedItem: string;
@@ -40,8 +38,6 @@ export default function PageModuleToggler( {
4038
selectedItem,
4139
moduleToggles,
4240
siteId,
43-
isTooltipShown,
44-
onTooltipDismiss,
4541
customToggleIcon = <Icon className="gridicon" icon={ cog } />,
4642
}: PageModuleTogglerProps ) {
4743
const translate = useTranslate();
@@ -63,7 +59,6 @@ export default function PageModuleToggler( {
6359
}, [] );
6460

6561
const toggleSettingsMenu = () => {
66-
onTooltipDismiss();
6762
setIsSettingsMenuVisible( ( isSettingsMenuVisible ) => {
6863
return ! isSettingsMenuVisible;
6964
} );
@@ -89,17 +84,6 @@ export default function PageModuleToggler( {
8984
>
9085
{ customToggleIcon }
9186
</button>
92-
<Popover
93-
className="tooltip tooltip--darker highlight-card-tooltip highlight-card__settings-tooltip"
94-
isVisible={ isTooltipShown }
95-
position="bottom left"
96-
context={ settingsActionElement }
97-
>
98-
<div className="highlight-card-tooltip-content">
99-
<p>{ translate( 'Here’s where you can find all your Jetpack Stats settings.' ) }</p>
100-
<button onClick={ onTooltipDismiss }>{ translate( 'Got it' ) }</button>
101-
</div>
102-
</Popover>
10387
<Popover
10488
className="tooltip highlight-card-popover page-modules-settings-popover"
10589
isVisible={ isSettingsMenuVisible }

client/blocks/stats-navigation/test/page-module-toggler.test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ jest.mock( '@wordpress/icons', () => ( {
6262
const defaultProps = {
6363
selectedItem: 'traffic',
6464
siteId: 123,
65-
isTooltipShown: false,
66-
onTooltipDismiss: jest.fn(),
6765
customToggleIcon: <span>Settings</span>,
6866
};
6967

client/my-sites/stats/components/highlight-cards/style.scss

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,6 @@ $highlight-card-tooltip-font: Inter, $sans !default;
201201
}
202202
}
203203

204-
&.highlight-card__settings-tooltip {
205-
// Make the popover under `.page-modules-settings-popover` of z-index: 175.
206-
z-index: z-index("root", ".tooltip.popover.highlight-card__settings-tooltip");
207-
}
208-
209204
// @TODO: Introduce the support for the border of white background arrows in the popover component.
210205
// Set the border of the white background bottom arrows.
211206
&.highlight-card-popover {
@@ -344,29 +339,6 @@ $highlight-card-tooltip-font: Inter, $sans !default;
344339
color: var(--studio-gray-30);
345340
font-size: $font-body-small;
346341
}
347-
.highlight-card__settings-tooltip {
348-
.highlight-card-tooltip-content {
349-
flex-direction: column;
350-
align-items: flex-end;
351-
352-
p {
353-
margin-bottom: 24px;
354-
}
355-
356-
button {
357-
font-family: $font-sf-pro-text;
358-
font-weight: 600;
359-
font-size: $font-body-extra-small;
360-
line-height: 20px;
361-
color: var(--studio-black);
362-
padding: 4px 8px;
363-
background-color: var(--studio-white);
364-
border-radius: 4px;
365-
cursor: pointer;
366-
}
367-
}
368-
}
369-
370342
@media (max-width: $custom-mobile-breakpoint) {
371343
.highlight-cards-heading {
372344
margin-left: $font-body-small;

client/my-sites/stats/site.jsx

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ import {
3131
STATS_PRODUCT_NAME,
3232
} from 'calypso/my-sites/stats/constants';
3333
import { useMomentInSite } from 'calypso/my-sites/stats/hooks/use-moment-site-zone';
34-
import useNoticeVisibilityMutation from 'calypso/my-sites/stats/hooks/use-notice-visibility-mutation';
35-
import { useNoticeVisibilityQuery } from 'calypso/my-sites/stats/hooks/use-notice-visibility-query';
3634
import { recordCurrentScreen } from 'calypso/my-sites/stats/hooks/use-stats-navigation-history';
3735
import { getChartRangeParams } from 'calypso/my-sites/stats/utils';
3836
import {
@@ -208,9 +206,6 @@ function StatsBody( { siteId, chartTab = 'views', date, context, isInternal, ...
208206
const moduleToggles = useSelector( ( state ) => getModuleToggles( state, siteId, 'traffic' ) );
209207
const momentInSite = useMomentInSite( siteId );
210208
const hasVideoPress = useSelector( ( state ) => siteHasFeature( state, siteId, 'videopress' ) );
211-
const [ isPageSettingsTooltipDismissed, setIsPageSettingsTooltipDismissed ] = useState(
212-
!! localStorage.getItem( 'notices_dismissed__traffic_page_settings' )
213-
);
214209

215210
// Determine module visibility based on user settings, VideoPress availability, AND defaults.
216211
const moduleVisibility = useMemo(
@@ -548,25 +543,6 @@ function StatsBody( { siteId, chartTab = 'views', date, context, isInternal, ...
548543
getJetpackStatsAdminVersion( state, siteId )
549544
);
550545

551-
const { data: showSettingsTooltip, refetch: refetchNotices } = useNoticeVisibilityQuery(
552-
siteId,
553-
'traffic_page_settings'
554-
);
555-
const { mutateAsync: mutateNoticeVisbilityAsync } = useNoticeVisibilityMutation(
556-
siteId,
557-
'traffic_page_settings'
558-
);
559-
560-
const onTooltipDismiss = () => {
561-
if ( isPageSettingsTooltipDismissed || ! showSettingsTooltip ) {
562-
return;
563-
}
564-
565-
setIsPageSettingsTooltipDismissed( true );
566-
localStorage.setItem( 'notices_dismissed__traffic_page_settings', 1 );
567-
mutateNoticeVisbilityAsync().finally( refetchNotices );
568-
};
569-
570546
// Module settings for Odyssey are not supported until stats-admin@0.9.0-alpha.
571547
const isModuleSettingsSupported =
572548
! config.isEnabled( 'is_running_in_jetpack_site' ) ||
@@ -610,8 +586,6 @@ function StatsBody( { siteId, chartTab = 'views', date, context, isInternal, ...
610586
selectedItem="traffic"
611587
moduleToggles={ moduleToggles }
612588
siteId={ siteId }
613-
isTooltipShown={ showSettingsTooltip && ! isPageSettingsTooltipDismissed }
614-
onTooltipDismiss={ onTooltipDismiss }
615589
customToggleIcon={ <Icon className="gridicon" icon={ settings } /> }
616590
/>
617591
)

0 commit comments

Comments
 (0)