google / site-kit-wp

Site Kit is a one-stop solution for WordPress users to use everything Google has to offer to make them successful on the web.
https://sitekit.withgoogle.com
Apache License 2.0
1.25k stars 290 forks source link

Add a content area to the Header in the Unified Dashboard for Entity Info and notifications #4050

Closed tofumatt closed 2 years ago

tofumatt commented 3 years ago

Feature Description

There should be a section in the header of the dashboard that displays content in the view between the header and the pill links, see:

Screenshot 2021-09-28 at 16 19 49

The logic to display this content is covered elsewhere; this issue is just above creating the component that can be used to style either the Entity information (shown above) or the Notifications that appear in this area when any are present.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation Brief

Integration in Header

Test Coverage

QA Brief

Changelog entry

kuasha420 commented 3 years ago

I have made some observation while working on the IB according to Acceptance Criteria.

Looking for feedback.

CC @tofumatt @aaemnnosttv

tofumatt commented 3 years ago

Totally, that's actually a way better approach and I think will totally work for what we want to do. I think I even wanted to propose it in the ACs originally, but for some reason I guess my brain went with the more imperative approach.

But Slot/Fill is way nicer AND less code! 🙂

I've updated the ACs, let's go with that approach. If any other ACs related to this issue need updating I'll do that too 👍🏻

tofumatt commented 3 years ago

After a discussion with Eugene, Felix, and Evan, we actually realised that we don't need the slot/fill implementation here, at least for now, and can get away with this component rendering a few, specific things according to the design:

  1. On the Entity Dashboard only, the current page name, URL, and a "Back to Dashboard" link.
  2. The notifications area on both the Main and Entity dashboard.

I think originally we had planned for this to be a more generic content are that would be used by other things, but we couldn't remember what for and I think that need has gone 😓

So I've reworked the ACs as this is now a much less complicated component/set of ACs

Sorry @kuasha420 for making you think on theses ACs and write up that solid IB for slot/fill, though I have copied it to a new issue (#4212) in case we want to revisit slot/fill for the header (or any other section of the plugin) in the future.

I've moved this back to IB now that there are new, simpler ACs (again!) for the issue. Hopefully this is the last revision we make to the ACs! 😅

felixarntz commented 3 years ago

@tofumatt I think the ACs could even be further simplified, as there's already dedicated issues for the two pieces of content (#4146 and #4152) to conditionally render in here. I think the last two bullet points could be removed from the ACs, as those parts are to be implemented in those issues. I'd say in this issue we should focus only on getting the area ready, and it might be a good idea to include a Storybook story with some demo content for it, just to see what it looks like with "any" content inside and to ensure the styling makes sense.

cc @kuasha420

tofumatt commented 3 years ago

Hmmm, we shouldn't be rendering the <Subheader> area at all if there are no notifications/no entity info to show though. It requires another border to be drawn between the Header and the Navigation bar.

I suppose if it's currently only possible for one piece of content to appear in the header at a time—given notifications won't appear on the Entity Dashobard… maybe this should just be thought of as the "wrapper component" with no logic. I think that makes sense, but it's just a re-framing of the issue.

I've updated the ACs again, but I've assigned you to have a look at them to make sure they make sense @felixarntz. If they're good feel free to move this over to IB 👍🏻

felixarntz commented 3 years ago

@tofumatt Ah that's a good point that we need an actual container. I wonder though, we might still be able to have the Subheader not have any visual effects when rendered empty - the border is technically a shadow I believe from looking at the Figma files, and the shadow would be on the headerbar and the tab/pill bar, so not on the Subheader itself. We don't need any padding within it for example (the padding would be handled in the respective inner components), so I'd think if its inner content is empty / null, it wouldn't show at all (while technically still being in the DOM). I'd be okay with that.

Regarding the Figma design itself, it looks like that new shadow above was recently added - but the Figma file also has some note about advising not to do that. I left a comment asking for clarification.

felixarntz commented 3 years ago

In order to unblock #4152 (which is already in Execution Backlog), I've added one more bullet point here, essentially reversing the order on which these two items should be worked on.

felixarntz commented 3 years ago

@tofumatt Any particular reason why you removed the one extra bullet point I had added to the ACs (see https://github.com/google/site-kit-wp/issues/4050#issuecomment-941742576)? I assume it was by accident, so I've added it back for now. Let me know your thoughts - if we keep it, we should also mention that in one extra point in the IB (otherwise the IB looks good).

felixarntz commented 3 years ago

@tofumatt Actually, one more question about the ACs:

This prop should be used by the components in #4146 and #4152 to wrap their output when inside the <Header> component

How do you envision that to work? The Notifications component e.g. would be rendered within the Header, how can it pass a prop to the Header?

felixarntz commented 3 years ago

@tofumatt Last but not least, I've updated the ACs one more time: The Figma link you had pointed to before was outdated, indeed there should not be a border between the header and subheader, as Jenna clarified on that previous Figma file in response to my comment. There should only be one border/shadow at the bottom of the header or subheader, as originally defined.

tofumatt commented 3 years ago

@tofumatt Any particular reason why you removed the one extra bullet point I had added to the ACs (see #4050 (comment))? I assume it was by accident, so I've added it back for now. Let me know your thoughts - if we keep it, we should also mention that in one extra point in the IB (otherwise the IB looks good).

Oh, sorry, I think I was thinking that the BannerNotifications component would add themselves into the subHeader once available, but I suppose since the issue is already in the backlog that won't work.

In that case I'll add it to the IB here, that's fine 👍🏻

How do you envision that to work? The Notifications component e.g. would be rendered within the Header, how can it pass a prop to the Header?

I don't think it would need to be—I think the notifications component (in this case, BannerNotifications from #4152) could be supplied to the subHeader prop whenever needed (eg in the DashboardMainApp component, right here: https://github.com/google/site-kit-wp/blob/94ab93a3bf301b165aebfdb0b4df75a815ffd96b/assets/js/components/DashboardMainApp.js#L42).

We can supply multiple components into the subHeader when needed by wrapping in a <Fragment>, though I think for now the Main Dashboard just needs notifications and the Entity Dashboard just needs the component in #4146.

Does that sound good?

felixarntz commented 3 years ago

@tofumatt Ahh, thanks for clarifying. I think I was confused by the wording: "This prop should be used by the components in #4146 and #4152 to wrap their output when inside the <Header> component" says it should be used by the components, but the way I understand you now, which makes sense to me, the prop should be used by any component to pass the inner components :)

Now that that's clarified, that makes sense. Note though that current approach still wouldn't ensure that the sub-header only renders if there is actually something in there. That is because e.g. the BannerNotifications component contains logic inside and based on the logic may return null. In that case, there would still be an empty sub-header. Which again, may not be a dealbreaker if we can ensure that empty container doesn't have a visual impact, but I want to make sure you've considered that.

tofumatt commented 3 years ago

In that case, there would still be an empty sub-header. Which again, may not be a dealbreaker if we can ensure that empty container doesn't have a visual impact, but I want to make sure you've considered that.

Yes, especially now that there is only one border between the nav bar and the entire header, I think this will be fine. Essentially, if there is zero height to whatever is rendered inside the subHeader prop then the "subheader" area should be empty.

So I think this approach should do fine and this IB should cover it, but let me know if you have any other questions about this approach. 👍🏻

felixarntz commented 3 years ago

Sounds good - IB ✅

asvinb commented 2 years ago

@tofumatt @felixarntz @kuasha420 A few things I noticed

I have a PR created for the above points.

Let me know what you think.

felixarntz commented 2 years ago

@asvinb Great points. Your point about a full-width container is also in the ACs - it says there that it shouldn't have any inner padding, which I basically meant to express with that it should be full-width and not assume/restrict anything about the content within :)

wpdarren commented 2 years ago

@felixarntz @asvinb @tofumatt Looking at the initial ticket description and AC's, the QAB doesn't appear to be accurate. Please could you clarify if it is, and if not, any additional info would be appreciated.

asvinb commented 2 years ago

@wpdarren The QAB says going to the following URL: /wp-admin/admin.php?page=googlesitekit-dashboard&notification=authentication_success. In doing so, the BannerNotifications component will be passed to the Header component via the subHeader prop. It's a way to test the latter. Then it should match the designs in Figma, meaning there should no be any borders between the header and the sub header (BannerNotifications in this case), and then only the header is sticky upon scrolling.

Let me know if that clears things up.

wpdarren commented 2 years ago

QA Update: ✅

Verified:

image

image