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

Implement Idea Hub setup UI

Open felixarntz opened this issue 5 years ago • 20 comments

While the Idea Hub module does not have any settings for now (see #3521), it still needs to have a setup screen, for now with just a note about privacy and terms of service of this API that the user has to acknowledge.


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

Acceptance criteria

  • The Idea Hub module should have its basic information (in Idea_Hub::setup_info) updated:
    • The description should be: _ Idea Hub suggests what you can write about next, based on searches that haven't been answered yet_
    • The homepage should be entirely removed.
  • The Idea Hub module should have a new setting tosAccepted which expects a boolean. The module should only consider itself connected (via Idea_Hub::is_connected) if the value in that settings is true.
  • The Idea Hub module should have a setup screen via a SetupMain component in assets/js/modules/idea-hub/components/setup/SetupMain.js.
    • It should follow the design in the Figma file, with two exceptions:
      • Instead of the first sentence below the Idea Hub heading, the same description that is present above should be used (taken directly from the Idea Hub module's data).
      • Instead of "Done", the submit button should say "Continue", for consistency with e.g. the AdSense setup.
    • The checkbox on that screen should control the above tosAccepted setting. Until the checkbox is clicked, the submit button should be disabled.

Implementation Brief

  • Using includes/Modules/Idea_Hub.php,
    • Update the description in the setup_info method as per the AC and remove homepage.
    • Add the tosAccepted to the $required_keys array of the is_connected method.
  • Using includes/Modules/Idea_Hub/Settings.php,
    • Add tosAccepted to the array found in get_default, with false as default value.
  • Using assets/js/modules/idea-hub/datastore/base.js,
    • Add tosAccepted to the settingSlugs array when calling the createModuleStore function.
  • Create assets/js/modules/idea-hub/components/setup/SetupMain.js with exports the SetupMain functional component with the following details:
    • The component should be rendered as per the designs in Figma.
    • Most of the code can be taken from the Optimize SetupMain component assets/js/modules/optimize/components/setup/SetupMain.js with the following changes:
      • SVG for the logo can be found here: assets/svg/idea-hub.svg
  • Create assets/js/modules/idea-hub/components/setup/SetupForm.js which exports the SetupForm functional component with the following details:
    • The component will be responsible for rendering the content between the logo and the cancel button and styled as per the designs in Figma.
    • The submit button should be "Continue" instead of "Done" as per the AC.
    • The SetupForm of other modules (Optimize) can be taken as example.
    • To get the module description, query the core/modules data store via the getModule selector, passing idea-hub as the module slug and then accessing the description property of the result.
    • Get the value of the tosAccepted setting via the getTosAccepted selector of the module's data store.
    • The Checkbox component is used to render the checkbox with the label as per the designs in Figma.
      • The value prop should be 1.
      • The checked prop should be dependent of the tosAccepted value.
      • Upon change, the setTosAccepted action of the module's data store should be dispatched with the checked state of the checkbox.
    • The Continue button should be disabled if tosAccepted is false.
  • Create assets/sass/components/idea-hub/_googlesitekit-idea-hub-setup.scss which will contain all the styles for above components, namely:
    • The notice found in SetupForm ("Idea Hub is only available in the US for now").

Storybook coverage

  • Add Storybook coverage for the two components under assets/js/modules/idea-hub/components/setup/Setup.stories.js
  • Use Modules/Idea Hub/Setup/SetupForm as the title

Test Coverage

  • No tests to be added.

Visual Regression Changes

  • N/A

QA Brief

Already done

  • Enable the ideaHubModule feature flag.
  • You should see the Idea Hub CTA widget on the main Site Kit dashboard.
  • Click the 'set up' button, and the setup form should be rendered.
  • Verify that the submit button is disabled unless the checkbox is checked.
  • Checking the checkbox and hitting the submit button should connect Idea Hub and return you to the Site Kit dashboard.
  • Verify that the components match the Figma design (there is a Story as well).

Follow-up

  • Activate the Idea Hub module and verify that you can complete the module setup as expected.

Changelog entry

  • Add Idea Hub setup UI.

felixarntz avatar Jun 08 '21 21:06 felixarntz

Looks like the IB doesn't fulfil this part of the ACs:

The Idea Hub module should have a new setting tosAccepted which expects a boolean. The module should only consider itself connected (via Idea_Hub::is_connected) if the value in that settings is true.

Looks like $required_keys needs 'tosAccepted' added to it.

(Otherwise the IB looks good, but I have a question about copy below.)

tofumatt avatar Jun 16 '21 15:06 tofumatt

A note about copy:

Idea Hub provides ideas for things to write about based on searches that haven't been answered yet I find this a bit hard to parse.

Do you have a problem updating this to something like: "_ Idea Hub provides topics to write about based on searches that haven't been answered yet_"? Using "Idea" twice so close together in the same sentence is hard-to-read, and the non-specififc noun "things" reads clearer as "topics".

Thoughts @felixarntz @marrrmarrr?

tofumatt avatar Jun 16 '21 15:06 tofumatt

@tofumatt IB updated to update the $required_keys array with tosAccepted. Assigning ticket to @felixarntz to review your suggested copy change.

asvinb avatar Jun 16 '21 15:06 asvinb

@marrrmarrr would it be possible to please provide some guidance on the messaging here so we can get this ticket over to Execution Backlog today if possible, thank you

eclarke1 avatar Jun 21 '21 11:06 eclarke1

@eclarke1 @tofumatt In the Idea Hub nomenclature, a "topic" is the higher level category (e.g. "Electronics") and an "idea" is the individual prompts within this category. To avoid confusing users which is which, I'd suggest not calling the ideas topics. We could go with "suggestions" or similar.

marrrmarrr avatar Jun 22 '21 12:06 marrrmarrr

In this case it's the topic of the post though—I'm not sure what better word can be used there to signify what Idea Hub is providing. I don't think "suggestions" helps, because it then reads like:

Idea Hub provides suggestions to write about based on searches that haven't been answered yet.

We want a noun to convey what it is that Idea Hub is suggesting—in this case it's "post topic". Maybe the whole sentence could use rewording, what about:

Idea Hub suggests what you should write about next, based on searches that don't have answers or many search results.

tofumatt avatar Jun 22 '21 13:06 tofumatt

I like the updated first clause, I'd just replace the "should" with a different modal verb -- we can't really tell them what to do (: So, combining the two, we have: Idea Hub suggests what you can write about next, based on searches that haven't been answered yet

marrrmarrr avatar Jun 23 '21 09:06 marrrmarrr

Sounds great! I've updated the ACs to reflect that wording, and this now looks good to go!

IB ✅

tofumatt avatar Jun 23 '21 13:06 tofumatt

@johnPhillips pointed out this could use storybook coverage as well, so that's been added to the IB and the estimate has been tweaked—we have the capacity in this sprint but just highlighting here 🙂

tofumatt avatar Jun 24 '21 12:06 tofumatt

QA :white_check_mark:

Looks good to me :+1:

danielgent avatar Jul 01 '21 13:07 danielgent

Approval ❌

@johnPhillips @danielgent Something was missed here, I am not able to access the Idea Hub setup UI at all. While the UI was implemented in the PR, I don't get redirected there and can't access it via direct URL either. I assume it's because of https://github.com/google/site-kit-wp/pull/3629/files#diff-742fe552dc9514fbe56f9c0fa0b23cb7fd5b6cb934248191f2e1ba51b1bfcc5cR27. I assume that was missed due to the added "QA: Eng" label here. This change has direct user-facing implications, so it shouldn't be "QA: Eng" only as such issues should be reserved to e.g. pure infrastructure changes that are expected to not affect user-facing behavior at all.

felixarntz avatar Jul 13 '21 20:07 felixarntz

@johnPhillips Since this is targeting 1.37.0 which is already branched off into main, can you please create a follow-up PR based off and targeting main? At a high-level, at least the two following things need to be fixed to make this work as expected:

  • The Idea Hub module store should not be registered with requiresSetup: false.
  • The Idea Hub module should include its setup component during module registration.

It would also be helpful to extend the QA instructions so that the user-facing flow of actually setting up the module and seeing and using the setup UI is tested.

felixarntz avatar Jul 13 '21 20:07 felixarntz

Sorry @felixarntz, yes: it seems something fell between the cracks here. I think it wasn't clear to me that connecting up the form was a requirement of this issue (I mean vs building a UI component), and since the ACs seemed to be around technical points I erroneously added the QA: eng label. Apologies again. I've added a PR targeting main that hopefully fixes this, and updated the QAB. Let me know what you think 👍

johnPhillips avatar Jul 14 '21 16:07 johnPhillips

@johnPhillips No worries - the ACs indeed don't clearly state that. In general, such changes should always be incorporated in a user-facing way, unless there is a note that it should be only in Storybook for now, or something along those lines. 👍

felixarntz avatar Jul 14 '21 16:07 felixarntz

QA Update: ❌

@johnPhillips I have a few initial observations that I'd like to share:

  1. I can only get the widget to appear when widgets.dashboard is enabled on the tester plugin. I am assuming this is because quite rightly we have no plans to update legacy, but wanted to double check.

  2. When the Idea hub connect screen loads, the checkbox is enabled by default. Is this expected? I can confirm that the button is inactive when the checkbox is disabled.

image

  1. The description text is slightly different than on the Figma designs. I am assuming what I see below is the correct version but wanted to double check.

image

  1. The blue notice background goes to the end of the right margin, looks different than Figma.

image

wpdarren avatar Jul 15 '21 11:07 wpdarren

Thanks @wpdarren.

I can only get the widget to appear when widgets.dashboard is enabled on the tester plugin. I am assuming this is because quite rightly we have no plans to update legacy, but wanted to double check.

I think this is expected, but worth double checking (CC @felixarntz). I think that the legacy dashboard is about to be removed (see https://github.com/google/site-kit-wp/pull/3439)

When the Idea hub connect screen loads, the checkbox is enabled by default. Is this expected? I can confirm that the button is inactive when the checkbox is disabled.

This is strange. The form reads whatever the value is set to in the back end, and that value defaults to false.

I wonder whether something else is at play here: did you use Evan's plugin for example? I think that coerces this setting to true? 🤔 (CC @aaemnnosttv). If so, perhaps try disabling that plugin and re-connecting?

The description text is slightly different than on the Figma designs. I am assuming what I see below is the correct version but wanted to double check.

This was discussed above in a bit of detail, and I went with the version here: https://github.com/google/site-kit-wp/issues/3522#issuecomment-866681650

The blue notice background goes to the end of the right margin, looks different than Figma.

There's some context here. We had a discussion about the icon (which was originally different) which led to a decision to use the star. This meant I was able to use the default notice component and be consistent with other notices across the codebase. This has a maximum width of 1098px by default anyway. Worth checking with @Pratheep-lab if I was supposed to provide a custom max-width here - I assumed (perhaps incorrectly) that I could just use the default notice as-is. Happy to change this if required.

johnPhillips avatar Jul 15 '21 14:07 johnPhillips

@wpdarren @johnPhillips

The description text is slightly different than on the Figma designs. I am assuming what I see below is the correct version but wanted to double check.

As per the above discussion, this text is changed. I have now updated the Figma file with the latest text.

The blue notice background goes to the end of the right margin, looks different than Figma.

Yes, we recently updated the notice component to make sure that it doesn't go full width on big screens. So I agree with using the default notice component. For now the 1098px max-width works. (Figma designs updated to reflect this.)

Pratheep-lab avatar Jul 15 '21 15:07 Pratheep-lab

@Pratheep-lab @johnPhillips thanks for comments. Yes, I did use Evan’s plugin, but I know Ivan made some changes to a new version (just remembered), so let me pick this up tomorrow and give it a re-test.

wpdarren avatar Jul 15 '21 15:07 wpdarren

@johnPhillips @wpdarren @Pratheep-lab Following up here on my end: Points 1., 3., and 4. are good to go for now as is.

Only point 2. should be re-examined. I haven't been able to replicate it, for me the checkbox is disabled initially. I wonder whether it is because somehow the setting value still persisted from before?

Moving back to QA to double-check on point 2.

felixarntz avatar Jul 15 '21 19:07 felixarntz

QA Update: Pass ✅

  • When I enabled the ideaHubModule feature flag, the Idea Hub CTA widget appeared on the main Site Kit dashboard.
  • When I clicked on the 'set up' button, the setup form should be rendered.
  • Verified that the submit button is disabled unless the checkbox is checked.

image

  • When I enabled the checkbox and hit the continue button I was returned you to the Site Kit dashboard.

image

  • Verify that the components match the Figma design, but observed a few differences which were highlighted here and confirmed as fine for now.

A quick note for reference: the issue with the enabled checkbox by default, this was due to the Idea hub connection plugin, when this was disabled, I successfully connected and the checkbox was disabled by default.

wpdarren avatar Jul 16 '21 14:07 wpdarren