Change Visibility section label when a password is set (#44624)
* Change visibility section label * Add changelog * Fix changelog
This commit is contained in:
parent
d2e25b91b3
commit
cb967f6dfd
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: minor
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
[Product editor block]: Change visibility label when a password is set #44623
|
|
@ -31,17 +31,25 @@ export function VisibilitySection( { productType }: VisibilitySectionProps ) {
|
||||||
'post_password'
|
'post_password'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
function getVisibilityLabel() {
|
||||||
|
if ( postPassword !== '' ) {
|
||||||
|
return __( 'Password protected', 'woocommerce' );
|
||||||
|
}
|
||||||
|
if ( catalogVisibility === 'visible' ) {
|
||||||
|
return __( 'Public', 'woocommerce' );
|
||||||
|
}
|
||||||
|
return __( 'Hidden', 'woocommerce' );
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PanelBody
|
<PanelBody
|
||||||
initialOpen={ false }
|
initialOpen={ false }
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore We need to send an Element.
|
// @ts-ignore We need to send an Element.
|
||||||
title={ [
|
title={ [
|
||||||
__( 'Visibility:', 'woocommerce' ),
|
__( 'Visibility: ', 'woocommerce' ),
|
||||||
<span className="editor-post-publish-panel__link" key="label">
|
<span className="editor-post-publish-panel__link" key="label">
|
||||||
{ catalogVisibility === 'visible'
|
{ getVisibilityLabel() }
|
||||||
? __( 'Public', 'woocommerce' )
|
|
||||||
: __( 'Hidden', 'woocommerce' ) }
|
|
||||||
</span>,
|
</span>,
|
||||||
] }
|
] }
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in New Issue