Add loading state functionality to Schedule button in the calendar (#45645)

* Add loading state functionality to Schedule button in the calendar

* Add changelog

* Updated changelog file
This commit is contained in:
Mahesh Bohara 2024-03-20 00:30:27 +05:45 committed by GitHub
parent b88821f685
commit 6ce72a25ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: add
Product Editor: Add loading state functionality to Schedule Product modal

View File

@ -26,7 +26,7 @@ export function PublishButtonMenu( {
postType,
...props
}: PublishButtonMenuProps ) {
const { isScheduled, schedule, date, formattedDate } =
const { isScheduling, isScheduled, schedule, date, formattedDate } =
useProductScheduled( postType );
const [ showScheduleModal, setShowScheduleModal ] = useState<
'schedule' | 'edit' | undefined
@ -62,6 +62,7 @@ export function PublishButtonMenu( {
<SchedulePublishModal
postType={ postType }
value={ showScheduleModal === 'edit' ? date : undefined }
isScheduling={ isScheduling }
onCancel={ () => setShowScheduleModal( undefined ) }
onSchedule={ scheduleProduct }
/>

View File

@ -26,6 +26,7 @@ export function SchedulePublishModal( {
className,
onCancel,
onSchedule,
isScheduling,
...props
}: SchedulePublishModalProps ) {
const [ date, setDate ] = useState< string | undefined >(
@ -77,6 +78,8 @@ export function SchedulePublishModal( {
</Button>
<Button
variant="primary"
isBusy={ isScheduling }
disabled={ isScheduling }
onClick={ () => onSchedule?.( date ) }
>
{ __( 'Schedule', 'woocommerce' ) }

View File

@ -13,4 +13,5 @@ export type SchedulePublishModalProps = Omit<
value?: string;
onCancel?(): void;
onSchedule?( value?: string ): void;
isScheduling?: boolean;
};