| 1 |
/** |
| 2 |
* WordPress dependencies |
| 3 |
*/ |
| 4 |
import { __ } from '@wordpress/i18n' |
| 5 |
import { Button } from '@wordpress/components'; |
| 6 |
|
| 7 |
/** |
| 8 |
* Internal dependencies |
| 9 |
*/ |
| 10 |
import { getSiteUrl } from '../../utils'; |
| 11 |
import GiveBlankSlate from '../blank-slate'; |
| 12 |
|
| 13 |
/** |
| 14 |
* Render No forms Found UI |
| 15 |
*/ |
| 16 |
|
| 17 |
const EditForm = ( { attributes, setAttributes, formId } ) => { |
| 18 |
const changeForm = () => { |
| 19 |
setAttributes( { prevId: attributes.id } ); |
| 20 |
setAttributes( { id: 0 } ); |
| 21 |
}; |
| 22 |
|
| 23 |
return ( |
| 24 |
<GiveBlankSlate title={ __( 'Edit Form.' ) } |
| 25 |
description={ __( 'An error occured with donation form settings that rendered the preview inaccessible.', 'give' ) }> |
| 26 |
<Button isPrimary |
| 27 |
isLarge |
| 28 |
target="_blank" |
| 29 |
href={ `${ getSiteUrl() }/wp-admin/post.php?post=${ formId }&action=edit` }> |
| 30 |
{ __( 'Edit Donation Form', 'give' ) } |
| 31 |
</Button> |
| 32 |
|
| 33 |
<Button isLarge |
| 34 |
onClick={ changeForm }> |
| 35 |
{ __( 'Change Form', 'give' ) } |
| 36 |
</Button> |
| 37 |
</GiveBlankSlate> |
| 38 |
); |
| 39 |
}; |
| 40 |
|
| 41 |
export default EditForm; |
| 42 |
|