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

Add pre-publish sidebar #44331

Merged
merged 18 commits into from Feb 7, 2024
Merged

Add pre-publish sidebar #44331

merged 18 commits into from Feb 7, 2024

Conversation

octaedro
Copy link
Contributor

@octaedro octaedro commented Feb 2, 2024

Submission Review Guidelines:

Changes proposed in this Pull Request:

This PR adds a prepublish sidebar to the product editor.

Screenshot 2024-02-05 at 16 27 52

Closes #43704.

ACs

Tasks

Edit tasklist title
Beta Give feedback Tasklist Tasks, more options

Delete tasklist

Delete tasklist block?
Are you sure? All relationships in this tasklist will be removed.
  1. Create the sidebar/modal and add it to the right side of the product editor AkVNGImLgSqCObTQ3idVn7-fi-3359_345477
    Options
  2. When the user clicks Add in the top right corner, a panel slides out from the right edge of the screen. It looks and works exactly like the pre-publish sidebar in the post/site editor.
    Options
  3. Add the Add button to the sidebar to persist the unsaved changes AkVNGImLgSqCObTQ3idVn7-fi-3359_345477
    Options
  4. Add the Cancel button to the sidebar to hide/close it AkVNGImLgSqCObTQ3idVn7-fi-3359_345477
    Options
  5. Add the title section of the sidebar AkVNGImLgSqCObTQ3idVn7-fi-3359_345477
    Options

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. Make sure the New product editor and the Prepublish sidebar (product-pre-publish-modal) are enabled under /wp-admin/admin.php?page=wc-settings&tab=advanced&section=features.
  2. Go to Products > Add New
  3. Add a product Name and press Add.
  4. The new prepublish sidebar should be visible.
  5. Verify that the Cancel button closes the sidebar.
  6. Press the Add button inside the sidebar and verify it works correctly.

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Comment

@octaedro octaedro changed the title Add/43704 prepublish sidebar modal Add prepublish sidebar Feb 2, 2024
Copy link
Contributor

github-actions bot commented Feb 2, 2024

Test Results Summary

Commit SHA: 6ce7d48

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 37s
E2E Tests273003703107m 44s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

@octaedro octaedro changed the title Add prepublish sidebar Add prepublish modal Feb 5, 2024
@octaedro octaedro requested a review from a team February 5, 2024 19:32
@octaedro octaedro self-assigned this Feb 5, 2024
Copy link
Contributor

github-actions bot commented Feb 5, 2024

Hi @louwie17,

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

@octaedro octaedro added focus: new product ux revamped product management experience team: Mothra labels Feb 5, 2024
@octaedro octaedro marked this pull request as ready for review February 5, 2024 19:40
@octaedro octaedro changed the title Add prepublish modal Add pre-publish modal Feb 6, 2024
@octaedro octaedro force-pushed the add/43704_prepublish_sidebar_modal branch from 10610a3 to f259ff5 Compare February 6, 2024 14:04
@octaedro octaedro changed the title Add pre-publish modal Add pre-publish sidebar Feb 6, 2024
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.

Nice work @octaedro, this is a great start, I just left a couple suggestions to align a bit more with the GB implementation.
Also notice one small issue around the scrolling, I left an inline comment.

productId={ product.id }
/>
)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It appears that sidebar is used for the actual collapsable sidebar, we may want to use the actions input here, similar to GB. And if we do add an actual expandable/collapsable sidebar we can add it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call! I did it in the commit 9ae966b

} }
isBusy={ isBusy }
aria-disabled={ isDisabled }
children={ __( 'Add', 'woocommerce' ) }
Copy link
Contributor

Choose a reason for hiding this comment

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

We are moving back to the Publish terminology, this may be part of a separate issue. But it may be worth to start using Publish here already.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you think about adding that change in its own PR? We will have to change some E2E tests, as well and I think it makes sense to give that change more visibility. I can create an issue for that if we already don't have one.

Copy link
Contributor

Choose a reason for hiding this comment

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

Change to its own PR sounds great, we may already have an issue that encapsulates this. I think its related to the dropdown addition for scheduling #40374

import { store as productEditorUiStore } from '../../store/product-editor-ui';
import { TRACKS_SOURCE } from '../../constants';

export function PrepublishSidebar( {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should stick with Panel instead of Sidebar here to follow the same naming as GB

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea! 6a1ed97


return (
<div className="woocommerce-product-publish-panel">
<div className="woocommerce-product-publish-panel__actions">
Copy link
Contributor

Choose a reason for hiding this comment

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

A nitpick, but to follow inline with GB implementation maybe use __header here?

<PublishButton
productType={ productType }
productStatus={ lastPersistedProduct?.status }
onSuccess={ closePrepublishSidebar }
Copy link
Contributor

Choose a reason for hiding this comment

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

We actually don't want the side bar to auto close after its been published, to match GB it stays open and instead displays <product name> is now live. with a close button.
See: https://github.com/WordPress/gutenberg/blob/55fbdd96aa2642dff194cb69ebe02c3669eebae0/packages/editor/src/components/post-publish-panel/index.js#L79

bottom: 0;
right: 0;
left: 0;
overflow: auto;
Copy link
Contributor

Choose a reason for hiding this comment

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

We also want a fixed position to avoid it from scrolling with the page.

Copy link
Contributor

Choose a reason for hiding this comment

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

sidebar-scroll.mp4

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in f4f3eed

@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Feb 7, 2024
@octaedro
Copy link
Contributor Author

octaedro commented Feb 7, 2024

Thank you @louwie17 for your suggestions; I just addressed them. Could you take another look at this PR?

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.

Thanks for the updates @octaedro, this looks great and tested well!
I think this is fine as is.
It would be great if we can do these things as follow up:

  • The Add to Publish naming update ( as mentioned in the Add pre-publish sidebar #44331 (comment) )
  • The issue with the Publish button looking disabled when the product isn't published already ( but saved ) logic should be disabled look if saved and published.
  • Updating the sidebar to show [product name] is now live. after it has been published and not show the Add/Cancel buttons but instead just an x ( same as the post/site editor ).

@octaedro octaedro merged commit 19a78cd into trunk Feb 7, 2024
35 checks passed
@octaedro octaedro deleted the add/43704_prepublish_sidebar_modal branch February 7, 2024 18:30
@github-actions github-actions bot added this to the 8.7.0 milestone Feb 7, 2024
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Feb 7, 2024
@nigeljamesstevenson nigeljamesstevenson added needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. status: analysis complete Indicates if a PR has been analysed by Solaris and removed needs: analysis Indicates if the PR requires a PR testing scrub session. labels Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: new product ux revamped product management experience needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. plugin: woocommerce Issues related to the WooCommerce Core plugin. status: analysis complete Indicates if a PR has been analysed by Solaris team: Mothra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create the sidebar/modal component
3 participants