PluginProbe
Extendify / 3.2.1
Extendify v3.2.1
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / Agent / workflows / content / components / UpdatePostStatusConfirm.jsx

UpdatePostStatusConfirm.jsx in Extendify 3.2.1, at src/Agent/workflows/content/components/UpdatePostStatusConfirm.jsx

57 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { useCallback } from '@wordpress/element';
2 import { __, sprintf } from '@wordpress/i18n';
3
4 const statusMap = {
5 draft: __('Draft'),
6 publish: __('Published'),
7 };
8
9 export const UpdatePostStatusConfirm = ({ inputs, onConfirm, onCancel }) => {
10 const handleConfirm = () => {
11 if (window?.extAgentData?.context) {
12 window.extAgentData.context.postStatus = inputs.updatedStatus;
13 }
14 onConfirm({ data: inputs });
15 };
16
17 const handleCancel = useCallback(() => {
18 onCancel();
19 }, [onCancel]);
20
21 return (
22 <div className="mb-4 ms-2 me-2 flex flex-col rounded-lg border border-gray-300 bg-gray-50">
23 <div className="rounded-lg border-b border-gray-300 bg-white">
24 <div className="p-3">
25 <p className="m-0 p-0 text-sm text-gray-900">
26 {sprintf(
27 // translators: %1$s is the current page or post status, and %2$s is the updated page or post status.
28 __(
29 'Status will change from "%s" to "%s", please confirm to save.',
30 'extendify-local',
31 ),
32 statusMap[inputs.postStatus],
33 statusMap[inputs.updatedStatus],
34 )}
35 </p>
36 </div>
37 </div>
38 <div className="flex justify-start gap-2 p-3">
39 <button
40 type="button"
41 className="w-full rounded-sm border border-gray-500 bg-white p-2 text-sm text-gray-900"
42 onClick={handleCancel}
43 >
44 {__('Cancel', 'extendify-local')}
45 </button>
46 <button
47 type="button"
48 className="w-full rounded-sm border border-design-main bg-design-main p-2 text-sm text-white"
49 onClick={handleConfirm}
50 >
51 {__('Confirm', 'extendify-local')}
52 </button>
53 </div>
54 </div>
55 );
56 };
57