Fix publish dropdown visibility in new product after hiding pre-publish modal (#45682)

* Publish dropdown visible after hidding panel

* Add changelog

* Rename prop
This commit is contained in:
Fernando Marichal 2024-03-19 12:15:33 -04:00 committed by GitHub
parent 5485665727
commit 506a8b0086
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 16 additions and 5 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: fix
Fix publish dropdown visibility in new product after hiding pre-publish modal #45682

View File

@ -249,7 +249,8 @@ export function Header( {
<PublishButton
productType={ productType }
prePublish={ showPrepublishChecks }
isPrePublishPanelVisible={ showPrepublishChecks }
isMenuButton
/>
<WooHeaderItem.Slot name="product" />

View File

@ -25,7 +25,8 @@ import type { PublishButtonProps } from './types';
export function PublishButton( {
productType = 'product',
prePublish,
isMenuButton,
isPrePublishPanelVisible = true,
...props
}: PublishButtonProps ) {
const { createErrorNotice } = useDispatch( 'core/notices' );
@ -68,7 +69,7 @@ export function PublishButton( {
if (
productType === 'product' &&
window.wcAdminFeatures[ 'product-pre-publish-modal' ] &&
prePublish
isMenuButton
) {
function renderPublishButtonMenu(
menuProps: Dropdown.RenderProps
@ -78,7 +79,11 @@ export function PublishButton( {
);
}
if ( editedStatus !== 'publish' && editedStatus !== 'future' ) {
if (
editedStatus !== 'publish' &&
editedStatus !== 'future' &&
isPrePublishPanelVisible
) {
function handlePrePublishButtonClick(
event: MouseEvent< HTMLButtonElement >
) {

View File

@ -8,5 +8,6 @@ export type PublishButtonProps = Omit<
'aria-disabled' | 'variant' | 'children'
> & {
productType?: string;
prePublish?: boolean;
isMenuButton?: boolean;
isPrePublishPanelVisible?: boolean;
};