site-kit-wp icon indicating copy to clipboard operation
site-kit-wp copied to clipboard

Implement Idea Hub notice in WP dashboard widget

Open felixarntz opened this issue 5 years ago • 5 comments

If there are already any saved ideas in the Idea Hub module, the Site Kit WordPress dashboard widget should display a notice that links to the "Saved" tab of the Idea Hub widget, with the notice following the Figma design.


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

Acceptance criteria

  • If the ideaHubModule feature flag is enabled and if the Idea Hub module is active and if there are any saved ideas stored, Site Kit's WP dashboard widget should display a notice per this Figma design which links to the Idea Hub widget (more specifically, to its "Saved" tab) in the Site Kit dashboard.

Implementation Brief

  • Create new file /assets/js/components/wp-dashboard/WPDashboardIdeaHub.js which exports the WPDashboardIdeaHub functional component.
  • Check if the ideaHubModule feature flag is enabled via the useFeature hook.
  • Check if the idea-hub module is active by querying the core/modules data store via the isModuleActive selector.
  • Check if there are saved ideas by querying the idea-hub data store via the getSavedIdeas selector.
  • If all of the above three conditions are met, then WPDashboardIdeaHub should render a notice as per the designs in Figma. If not, the component should return null.
  • Create assets/sass/components/idea-hub/_googlesitekit-idea-hub-wpdashboard-widget.scss which will contain all the styles for the notification. BEM methodology should be used for the class names. For e.g .googlesitekit-idea-hub__wpdashboard--title.
  • The Google logo should be rendered as inline SVG and the existing assets/svg/logo-g.svg file can be used.
  • The text for the notice and the View texts should link to the Site Kit dashboard.
    • The URL for the dashboard can be obtained by querying the core/site data store via the getAdminURL selector.
    • To automatically scroll the user to the Saved tab of the Idea Hub widget, append the saved-ideas hash to the dashboard URL.
  • Create /assets/js/components/wp-dashboard/WPDashboardIdeaHub.stories.js which will contain the story for the component.
    • Title of the story for the default export should be Views/WPDashboardApp.

Test Coverage

  • No new tests to be added.

Visual Regression Changes

  • N/A

QA Brief

  • You will need the ideaHubModule feature enabled.
  • Verify that the notice component is rendered under the conditions described in the ACs above and that it links to the Idea Hub widget correctly.
  • Check that the rendered component meets the design criteria in the Figma file above.
  • Verify that there is Storybook coverage for the new component.

Changelog entry

  • Add Idea Hub notice to the WP dashboard widget.

felixarntz avatar May 13 '21 22:05 felixarntz

IB :heavy_check_mark:

eugene-manuilov avatar May 18 '21 11:05 eugene-manuilov

@johnPhillips I had a look and this is how the notice looks for me: image Basically everything is stacked within the notice. It kinda makes sense because in the designs, the width is 590px whereas when I tested the widget width is 447px. I do think however that even at 447px, the content should not stack. One suggestion of how the widget can be is like this: image

On small screens I think the content can remain stacked. @Pratheep-lab @aaemnnosttv @felixarntz Curious to know your thoughts on that.

QA: Waiting for UX.

asvinb avatar May 26 '21 13:05 asvinb

@asvinb @Pratheep-lab CC @felixarntz Yes, this was my best guess as to how it might work on a narrower viewport when the content can't simply be inline like the design. I just let it wrap as the container got narrower so that each part (logo, text, 'view') stacked one after the other.

Asvin's suggestion is a good one and occurred to me but I wondered whether keeping the columns like that would still work on mobile with more verbose translations?

Anyway, very happy to adjust as advised, just let me know.

Might I also add a thought: do we really need the 'view', since the whole text is a link anyway?

johnPhillips avatar May 26 '21 14:05 johnPhillips

@asvinb Good catch! The CTA of that notice should always be on the right side. The above-proposed solution to stack just the copy in the middle is good. Another issue here is that the copy and the CTA look almost the same and that is not a good practice. Hence, I have changed the copy to regular font and made CTA uppercase medium font. Use this style unless you want the whole notice to be clickable.

Pratheep-lab avatar May 26 '21 17:05 Pratheep-lab

QA: ✅

asvinb avatar Jun 02 '21 09:06 asvinb