Change Visibility section label when a password is set (#44624)

* Change visibility section label

* Add changelog

* Fix changelog
This commit is contained in:
Fernando Marichal 2024-02-16 08:54:37 -03:00 committed by GitHub
parent d2e25b91b3
commit cb967f6dfd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 4 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
[Product editor block]: Change visibility label when a password is set #44623

View File

@ -31,17 +31,25 @@ export function VisibilitySection( { productType }: VisibilitySectionProps ) {
'post_password'
);
function getVisibilityLabel() {
if ( postPassword !== '' ) {
return __( 'Password protected', 'woocommerce' );
}
if ( catalogVisibility === 'visible' ) {
return __( 'Public', 'woocommerce' );
}
return __( 'Hidden', 'woocommerce' );
}
return (
<PanelBody
initialOpen={ false }
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore We need to send an Element.
title={ [
__( 'Visibility:', 'woocommerce' ),
__( 'Visibility: ', 'woocommerce' ),
<span className="editor-post-publish-panel__link" key="label">
{ catalogVisibility === 'visible'
? __( 'Public', 'woocommerce' )
: __( 'Hidden', 'woocommerce' ) }
{ getVisibilityLabel() }
</span>,
] }
>