| 1 |
import { useCallback } from '@wordpress/element'; |
| 2 |
import { __ } from '@wordpress/i18n'; |
| 3 |
|
| 4 |
const { homeUrl } = window.extSharedData || {}; |
| 5 |
|
| 6 |
export const GeneratePageResult = ({ inputs, onConfirm }) => { |
| 7 |
const handleConfirm = useCallback(() => { |
| 8 |
const redirectUrl = inputs.postId |
| 9 |
? `${homeUrl}/?page_id=${inputs.postId}` |
| 10 |
: ''; |
| 11 |
onConfirm({ redirectUrl }); |
| 12 |
}, [inputs.postId, onConfirm]); |
| 13 |
|
| 14 |
return ( |
| 15 |
<div className="mb-4 ms-2 me-2 flex flex-col rounded-lg border border-gray-300 bg-gray-50"> |
| 16 |
<div className="rounded-lg border-b border-gray-300 bg-white"> |
| 17 |
<div className="p-3"> |
| 18 |
<p className="m-0 p-0 text-sm text-gray-900"> |
| 19 |
{__( |
| 20 |
'The agent has finished creating your page. Press take me there to visit your new page or dismiss to remove this notice.', |
| 21 |
'extendify-local', |
| 22 |
)} |
| 23 |
</p> |
| 24 |
</div> |
| 25 |
</div> |
| 26 |
<div className="flex justify-start gap-2 p-3"> |
| 27 |
<button |
| 28 |
type="button" |
| 29 |
className="w-full rounded-sm border border-gray-500 bg-white p-2 text-sm text-gray-900" |
| 30 |
onClick={onConfirm} |
| 31 |
> |
| 32 |
{__('Dismiss', 'extendify-local')} |
| 33 |
</button> |
| 34 |
<button |
| 35 |
type="button" |
| 36 |
className="w-full rounded-sm border border-design-main bg-design-main p-2 text-sm text-white" |
| 37 |
onClick={handleConfirm} |
| 38 |
> |
| 39 |
{__('Take me there', 'extendify-local')} |
| 40 |
</button> |
| 41 |
</div> |
| 42 |
</div> |
| 43 |
); |
| 44 |
}; |
| 45 |
|