Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

402 implement site kit setup flow #21978

Open
wants to merge 16 commits into
base: trunk
Choose a base branch
from

Conversation

vraja-pro
Copy link
Contributor

@vraja-pro vraja-pro commented Jan 20, 2025

Context

Summary

This PR can be summarized in the following changelog entry:

  • [@yoast/ui-library 0.1.0] Adds Stepper Element.
  • Adds unreleased Google Site kit installation flow in the dashboard.

Relevant technical choices:

  • This PR doesn't include the quick tour after connecting, the connecting modal and the remove permanently functionality.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Go to Yoast SEO -> General page.
  • Check you don't see the widget for Google Site Kit setup flow(GSK)
  • Enable the feature flag by adding this code ( use Snippets plugin or add to wp-config.php ):
define( 'YOAST_SEO_GOOGLE_SITE_KIT_FEATURE', true );

UI library - Stepper element

  • Check the stepper works as the flow above.
  • Check the active step label is in primary color.
  • Check completed step label has darker hue.
  • Check steps are in the right direction on rtl.

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes Implement Site Kit setup flow without the consent modal

add stepper to ui library

export stepper

fix stories args

move margin out of the plugin

fix story space
add translation to the stepper
@vraja-pro vraja-pro added the changelog: enhancement Needs to be included in the 'Enhancements' category in the changelog label Jan 20, 2025
@vraja-pro vraja-pro requested a review from a team as a code owner January 20, 2025 10:13
@coveralls
Copy link

coveralls commented Jan 20, 2025

Pull Request Test Coverage Report for Build f007acaf20c302eb1fdd48ebcbcc1eb5ef88a8fb

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 30 of 54 (55.56%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall first build on 402-implement-site-kit-setup-flow at 42.142%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/js/src/dashboard/components/dashboard.js 0 4 0.0%
src/dashboard/application/configuration/dashboard-configuration.php 0 20 0.0%
Totals Coverage Status
Change from base Build f7f95dc739fe7266db4edb615d5011d551edaa57: 42.1%
Covered Lines: 20636
Relevant Lines: 45727

💛 - Coveralls

Copy link
Member

@igorschoester igorschoester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR 🏗️

  • About the changelogs/label: You put enhancement while I don't think the unreleased should go in there, right? So probably you meant to signal enhancement for the UI library one. You can do both, see documentation.

AT ❓

  • Getting the following React warning (first run, but already on just not connected):

Warning: Failed prop type: The prop isComplete is marked as required in Stepper, but its value is undefined.

  • The current step svg does not center in the stepper. In the first it is off to the left/bottom? And the rest is off to the right/bottom?
    image
    image

  • No animations? The FTC' vertical stepper has one -- using our ProgressBar that would be fixed

  • Something seems off with the check size, maybe just the outline thing

  • The UI library storybook story is not responding to the inputs

  • The dropdown menu does not show any hover/selection effect

  • The dropdown menu selected looks weird:
    image

Comment on lines 28 to 37
const googleSiteKitConfiguration = get( window, "wpseoScriptData.dashboard.google_site_kit", {
installed: false,
featureActive: false,
active: false,
setup: false,
connected: false,
installUrl: "",
activateUrl: "",
setupUrl: "",
} );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a whole point to try to make this dashboard with the eyes of it being standalone/platform agnostic.

Perhaps this widget is special in that it would never be part of standalone due to it being for a WP plugin.
However, that would mean you should invent some way of adding to the Dashboard from outside instead? I get that that is a bit strange to do when we have no clue how that would look like.

But now the dashboard has hidden expectations on the window. I think I'd prefer at least a clear API, even if that is going to change for standalone 🤔 (e.g. use props?)

@@ -106,6 +128,38 @@ public function get_configuration(): array {
)->to_array(),
'endpoints' => $this->endpoints_repository->get_all_endpoints()->to_array(),
'nonce' => $this->nonce_repository->get_rest_nonce(),
'google_site_kit' => $this->get_google_site_kit_configuration(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use camelcase for JS here for the rest.

Suggested change
'google_site_kit' => $this->get_google_site_kit_configuration(),
'googleSiteKit' => $this->get_google_site_kit_configuration(),

*
* @return array<string|bool>
*/
public function get_google_site_kit_configuration(): array {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels to me this should really be an 🧅 thing elsewhere. Similar to our editor script data?
And then it can be reused for the integration page.
(sorry to only mention this now)

Comment on lines +38 to +44
const [ showGoogleSiteKit, , , , setRemoveGoogleSiteKit ] = useToggleState( true );

const handleRemovePermanently = useCallback( ()=>{
/* eslint-disable-next-line */
// TODO: Implement the remove permanently functionality.
setRemoveGoogleSiteKit();
}, [ setRemoveGoogleSiteKit ] );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I feel like this too should get the initial data. Which might be part of the remove permanently scope?
    However, it seems strange that you went and implemented this already while it is out of scope.
  • Due to the local state "Until next visit" is back already when you switch tab/page in the dashboard (e..g. to general and back). Is this what is wanted/expected?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole interaction is not controllable from the inputs. It is possible to connect the inputs to the wrapper component. You can take a look at some other stories using updateArgs, like the Select one?

Comment on lines 100 to 101
const linkParams = useSelect( select => select( "@yoast/general" ).selectLinkParams(), [] );
const learnMorelink = addQueryArgs( "https://yoa.st/google-site-kit-learn-more", linkParams );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes the widget be connected to our WordPress integration already

Comment on lines 86 to 89
connected,
active,
setup,
installed,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually indicate boolean names with isX to indicate it is a boolean true/false thing.

const { buttonProps, currentStep, isComplete } = getButtonAndStepperProps(
active, installed, setup, connected, installUrl, activateUrl, setupUrl );
return <Paper className="yst-@container yst-grow yst-max-w-screen-sm yst-p-8 yst-shadow-md yst-relative">
<button
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be the tertiary variant (but then it would be color primary), or maybe it is time to add another variant to the UI library button?
I think this is not good for our focus styles, spacing etc:
image

In fact, the whole popup/menu thing is something the other widgets will also need.
We could chose to extract something at that point, but might be good to think about it a bit at least?

} );
const stepRef = useRef( [] );

useEffect( () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this calculation happen before rendering instead of after?
E.g. there can be a point where the rendered thing is wrong for a moment in time, potentially looking funky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: enhancement Needs to be included in the 'Enhancements' category in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants