Modify pre-publish texts after scheduling product (#44652)

* Modify prepublish texts after scheduling product

* Add changelog
This commit is contained in:
Fernando Marichal 2024-02-16 13:06:05 -03:00 committed by GitHub
parent e8a403b406
commit 587ba79350
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 21 additions and 2 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: dev
[Product editor block]: Modify pre-publish sidebar title after scheduling a product #44651

View File

@ -6,6 +6,7 @@ import { createElement } from '@wordpress/element';
import { Button } from '@wordpress/components';
import { useDispatch, useSelect } from '@wordpress/data';
import { recordEvent } from '@woocommerce/tracks';
import { useEntityProp } from '@wordpress/core-data';
/**
* Internal dependencies
@ -20,12 +21,18 @@ import { ScheduleSection } from './schedule-section';
export function PrepublishPanel( {
productId,
productType = 'product',
title = __( 'Are you ready to add this product?', 'woocommerce' ),
title = __( 'Are you ready to publish this product?', 'woocommerce' ),
description = __(
'Double-check your settings before sharing this product with customers.',
'woocommerce'
),
}: PrepublishPanelProps ) {
const [ editedDate, , date ] = useEntityProp< string >(
'postType',
productType,
'date_created'
);
const lastPersistedProduct = useSelect(
( select ) => {
const { getEntityRecord } = select( 'core' );
@ -36,6 +43,14 @@ export function PrepublishPanel( {
const { closePrepublishPanel } = useDispatch( productEditorUiStore );
if ( editedDate !== date ) {
title = __( 'Are you ready to schedule this product?', 'woocommerce' );
description = __(
'Your product will be published at the specified date and time.',
'woocommerce'
);
}
return (
<div className="woocommerce-product-publish-panel">
<div className="woocommerce-product-publish-panel__header">

View File

@ -122,7 +122,7 @@ export function ScheduleSection( { postType }: ScheduleSectionProps ) {
initialOpen={ false }
// @ts-expect-error title does currently support this value
title={ [
__( 'Add:', 'woocommerce' ),
__( 'Publish:', 'woocommerce' ),
<span className="editor-post-publish-panel__link" key="label">
{ getScheduleLabel(
editedDate === date ? undefined : editedDate