Skip to content

Conversation

@octaedro
Copy link
Contributor

All Submissions:

Changes proposed in this Pull Request:

This PR adds a Preview store button to the Home screen.

Closes #32156.

Acceptance Criteria:

  • The Preview store button is visible on the Home screen
  • Button uses Gutenberg's external link icon
  • Clicking it opens the store's URL in a new tab

How to test the changes in this Pull Request:

  1. Check out this branch.
  2. Go to the Home screen and verify the Preview store button is visible in the Activity panel.
  3. Press the button.
  4. The store's URL should be opened in a new tab.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?
  • Have you created a changelog file by running pnpm nx affected --target=changelog?

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Apr 22, 2022
@octaedro octaedro marked this pull request as ready for review April 22, 2022 13:52
@octaedro octaedro requested a review from a team April 26, 2022 12:36
@louwie17 louwie17 requested review from louwie17 and removed request for a team April 26, 2022 12:57
Copy link
Contributor

@louwie17 louwie17 left a comment

Choose a reason for hiding this comment

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

@octaedro the styling for this PR looks great, just the store link wasn't working for me. I left a comment on the line that calls window.open with some more context.

icon: <Icon icon={ external } />,
visible: isHomescreen(),
onClick: () => {
window.open( getSetting( 'siteUrl' ) );
Copy link
Contributor

Choose a reason for hiding this comment

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

Mine redirects to /wp-admin/false, because getSetting returns false.
I believe you want to make use of getAdminSetting or do getSetting('admin').siteUrl.

But instead of siteUrl I think you want to use shopUrl? given siteUrl just goes to the home page of the site, not the store.
shopUrl is the same url that is used when hovering over WooCommerce <site name> in the top left and clicking Visit store.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch! I fixed the link in commit 93b9c48

render( <ActivityPanel query={ { page: 'wc-admin' } } /> );

expect( screen.getByText( 'Preview store' ) ).toBeDefined();
} );
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for adding a test for this :)

@louwie17 louwie17 added the needs: developer feedback Issues that need feedback from one of the WooCommerce Core developers. label Apr 26, 2022
@octaedro
Copy link
Contributor Author

Thank you @louwie17 for your review.
I addressed the suggested changes. Could you take another look at this PR?

@octaedro octaedro requested a review from louwie17 April 26, 2022 20:22
@octaedro octaedro removed the needs: developer feedback Issues that need feedback from one of the WooCommerce Core developers. label Apr 26, 2022
Copy link
Contributor

@louwie17 louwie17 left a comment

Choose a reason for hiding this comment

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

LGTM 🚀 Thanks for the fix, this tested well!

@octaedro octaedro merged commit 5bda7ca into trunk Apr 28, 2022
@octaedro octaedro deleted the add/32156_preview-store-button branch April 28, 2022 11:35
@github-actions github-actions bot added this to the 6.6.0 milestone Apr 28, 2022
@github-actions
Copy link
Contributor

Hi @octaedro, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:

  • Add the release: add testing instructions label

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setup experiment: add Preview store button

3 participants