Closed tofumatt closed 5 months ago
@tofumatt @marrrmarrr Nitpick here, but should this be "The top earning content metric is now available..." instead of just "Top earning content metric is now available..."? That reads better to me, but LMK what you think!
Assigning this a rough estimate of 15 just for planning purposes, but as soon as someone can take on the IB it might need slight adjustment.
Increasing this estimate to 19 after adding the Showing only one overlay on-screen at a time section.
Showing only one overlay on-screen at a time
Because this pattern will be used for at least two notifications now (and likely will expand in the future), we should implement at least a basic system that prevents multiple overlays from appearing at the same time/on the same page-load.
@tofumatt how about moving this logic into datastores? We have the UI datastore that can control which overlay notification should be shown and control how many of them can be displayed. So, instead of creating a new hook, we can add a new action displayOverlay( overlayID )
to the UI datastore. Then a top level component (OverlayNotificationBase
) will be responsible to render overlays that are available in the datastore by calling the getCurrentOverlay
(or something like this) selector.
This will also let us remove a need to pack the module related logic in the global component. For example, we can update a resolver in the Analytics 4 module that will "trigger" that overlay when we pull related information. WDYT?
@eugene-manuilov Oh, thanks, that's a much better design! ππ»
I'll amend the IB here with that approach ππ»
Having thought about it more, I'm actually pretty sure the existing system would meet those requirements largely. The hook is an abstraction that allows components to easily setup the logic to show/hide themselves and abstracts the calls needed, but ultimately the component that will render is controlled by the datastore⦠it would still be possible to trigger a particular overlay with:
dispatch( CORE_UI ).setValue( OVERLAY_NOTIFICATION_TO_SHOW, 'someOverlay' );
And I think we'd want to have an OverlayRenderer
component that outputs all overlays, which will allow the "active" one (if one exists) to be output, eg:
<Fragment>
<LinkAnalyticsAndAdSenseAccountsOverlayNotification />
<SomeOtherOverlayNotificationWeMakeLater />
</Fragment>
I've added that last bit to the IB for clarity, but when I tried making the datastore responsible for selecting the component directly I then needed to create a map of values-to-components, which felt pretty similar to what I've proposed, just in a different way. But the approach I'm proposing means that for simpler notifications like this one, it can run its logic for displaying inside itself, but there's still the ability to dispatch an action elsewhere to trigger a different notification.
Ok, let it be it. IB βοΈ
Note, since this issue will introduce the logic for showing only one overlay, it can be used to adapt #8238 notification that should not be shown if the callout from this issue is shown
I created new issue #8335 for updating subtle notification to check if overlay notification is showing, in order not to increase the scope of this issue, as well as QA/testing requirements.
I created new issue #8335 for updating subtle notification to check if overlay notification is showing, in order not to increase the scope of this issue, as well as QA/testing requirements.
I've closed that, as the ACs for this issue include that point and it's an important part of this issue, so it will need to be done as part of this π
(Also, the conditions to render each notification should be mutually exclusive so it won't happen, but I may check to see if one is rendered to prevent the other from rendering, just in case π)
@tofumatt I have two observations:
On mobile, it can probably span the full-width of the screen.
I see the overlay on mobile in the bottom right-hand side, but I wanted to check if it should display full-width.
@wpdarren Oh, it shouldn't appear on the entity page, that's a good point. I thought I checked for that but maybe I forgot to do it as part of this issue π€
I think the right-aligned on mobile is fine, that was just a suggestion really but not a requirement. But if it's appearing on the entity dashboard please move this back to Execution and I'll fix that ππ»
The overlay is appearing on the entity dashboard, so sending it back to @tofumatt to fix.
Back with you for another pass, @wpdarren.
Verified
ga4AdSenseIntegration
feature flag disabled, the notification does not be show.ga4AdSenseIntegration
feature flag enabled, the overlay notification is showing properly.Learn how
button opens a help article in new tab and dismisses the notification.Maybe later
dismisses the notification and is not showing on next page reload.
Feature Description
A new callout (styled somewhat similarly to our surveys in the bottom-right of the screen) should be added for users who have AdSense and GA4 connected, but whose accounts are not detected as "linked".
Figma design: https://www.figma.com/file/7ba0pj1rLuvLvJhy3NiHOj/AdSense?type=design&node-id=7-13&mode=design&t=CHIb34EcBQchWxBL-0
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
ga4AdSenseIntegration
feature flag (#8288) is enabled. When it is disabled, there should be no overlay/prompt shown.adSenseLinked
setting (see #8047) is not set, an overlay prompting them to connect their accounts (see screenshot/Figma design) should appear in the bottom-right corner of the page.AdSenseLinkCTA
eg.:Implementation Brief
assets/js/components/OverlayNotification
OverlayNotificationBase
) in a file (assets/js/components/OverlayNotification/base.js
) for the structure of this notification, it can borrow a fair bit of style from thesurveys
components eg. https://github.com/google/site-kit-wp/blob/cd27c3938c7719175764a36985986b34f945824f/assets/js/components/surveys/CurrentSurvey.js#L284-L289 / https://github.com/google/site-kit-wp/blob/cd27c3938c7719175764a36985986b34f945824f/assets/sass/components/surveys/_googlesitekit-surveys.scss#L21 to start with, but created in its own fileassets/sass/components/overlay-notification.scss
assets/js/components/OverlayNotification/LinkAnalyticsAndAdSenseAccountsOverlayNotification.js
) using theOverlayNotificationBase
component with this overlay's content, roughly:className
s/styles where appropriate/possible. New ones can be created inassets/sass/components/overlay-notification.scss
.LINK_ANALYTICS_ADSENSE_OVERLAY_DISMISSED = 'link-analytics-and-adsense-overlay';
)const { dismissItem } = useDispatch( CORE_USER );
anddismissItem( LINK_ANALYTICS_ADSENSE_OVERLAY_DISMISSED )
supportURL
value mentioned in the ACs, in a new tab/window. (Thearia-label
for this button should mention to the user it will open in a new window).null
when:ga4AdSenseIntegration
feature flag is disabledselect( MODULES_ANALYTICS_4 ).getAdSenseLinked()
istrue
select( CORE_USER ).isItemDismissed( LINK_ANALYTICS_ADSENSE_OVERLAY_DISMISSED )
istrue
Showing only one overlay on-screen at a time
Because this pattern will be used for at least two notifications now (and likely will expand in the future), we should implement at least a basic system that prevents multiple overlays from appearing at the same time/on the same page-load.
Right now we can probably start simple, where only one notification can render itself at a time. It's probably fine to start by having every notification call its render function and whichever one determines it should render, dispatch the to the
CORE_UI
store to be the one the user sees for this page load.In the future, we could add things like priority, etc., but this simple approach will work for now. A hook that allows us to check if a notification should be shown and allows us to set the active one (based on the first notification to meet all of its "should render" requirements) in
assets/js/hooks/useOverlayNotification.js
could look like:assets/js/components/OverlayNotification/LinkAnalyticsAndAdSenseAccountsOverlayNotification.js
) could use it as such:There should be an
OverlayRenderer
component that outputs all overlays, which will allow the "active" one (if one exists) to be output, eg:This can be made in
assets/js/components/OverlayNotification/OverlayRenderer.js
and should be output inDashboardMainApp
or similar.Test Coverage
useOverlayNotification
hook ensuring it does not change the "active" component after it is set, does not set any components to output by default, etc.LinkAnalyticsAndAdSenseAccountsOverlayNotification
component.QA Brief
adSenseLinked
is not receiving real data, it will already befalse
by defaultga4AdSenseIntegration
feature flagLearn how
button should open a help article in new tab and dismiss notificationMaybe later
should just dismiss the notificationChangelog entry