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:
parent
b88821f685
commit
6ce72a25ba
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: minor
|
||||||
|
Type: add
|
||||||
|
|
||||||
|
Product Editor: Add loading state functionality to Schedule Product modal
|
|
@ -26,7 +26,7 @@ export function PublishButtonMenu( {
|
||||||
postType,
|
postType,
|
||||||
...props
|
...props
|
||||||
}: PublishButtonMenuProps ) {
|
}: PublishButtonMenuProps ) {
|
||||||
const { isScheduled, schedule, date, formattedDate } =
|
const { isScheduling, isScheduled, schedule, date, formattedDate } =
|
||||||
useProductScheduled( postType );
|
useProductScheduled( postType );
|
||||||
const [ showScheduleModal, setShowScheduleModal ] = useState<
|
const [ showScheduleModal, setShowScheduleModal ] = useState<
|
||||||
'schedule' | 'edit' | undefined
|
'schedule' | 'edit' | undefined
|
||||||
|
@ -62,6 +62,7 @@ export function PublishButtonMenu( {
|
||||||
<SchedulePublishModal
|
<SchedulePublishModal
|
||||||
postType={ postType }
|
postType={ postType }
|
||||||
value={ showScheduleModal === 'edit' ? date : undefined }
|
value={ showScheduleModal === 'edit' ? date : undefined }
|
||||||
|
isScheduling={ isScheduling }
|
||||||
onCancel={ () => setShowScheduleModal( undefined ) }
|
onCancel={ () => setShowScheduleModal( undefined ) }
|
||||||
onSchedule={ scheduleProduct }
|
onSchedule={ scheduleProduct }
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -26,6 +26,7 @@ export function SchedulePublishModal( {
|
||||||
className,
|
className,
|
||||||
onCancel,
|
onCancel,
|
||||||
onSchedule,
|
onSchedule,
|
||||||
|
isScheduling,
|
||||||
...props
|
...props
|
||||||
}: SchedulePublishModalProps ) {
|
}: SchedulePublishModalProps ) {
|
||||||
const [ date, setDate ] = useState< string | undefined >(
|
const [ date, setDate ] = useState< string | undefined >(
|
||||||
|
@ -77,6 +78,8 @@ export function SchedulePublishModal( {
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="primary"
|
variant="primary"
|
||||||
|
isBusy={ isScheduling }
|
||||||
|
disabled={ isScheduling }
|
||||||
onClick={ () => onSchedule?.( date ) }
|
onClick={ () => onSchedule?.( date ) }
|
||||||
>
|
>
|
||||||
{ __( 'Schedule', 'woocommerce' ) }
|
{ __( 'Schedule', 'woocommerce' ) }
|
||||||
|
|
|
@ -13,4 +13,5 @@ export type SchedulePublishModalProps = Omit<
|
||||||
value?: string;
|
value?: string;
|
||||||
onCancel?(): void;
|
onCancel?(): void;
|
||||||
onSchedule?( value?: string ): void;
|
onSchedule?( value?: string ): void;
|
||||||
|
isScheduling?: boolean;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue