| 1 |
import FormControl from '@elementor/ui/FormControl'; |
| 2 |
import Button from '@elementor/ui/Button'; |
| 3 |
import Typography from '@elementor/ui/Typography'; |
| 4 |
import { __ } from '@wordpress/i18n'; |
| 5 |
import useStorage from '../hooks/use-storage'; |
| 6 |
import { WORDPRESS_REVIEW_LINK } from '../constants'; |
| 7 |
|
| 8 |
const ReviewForm = ( { close } ) => { |
| 9 |
const { save, get } = useStorage(); |
| 10 |
|
| 11 |
const handleSubmit = async () => { |
| 12 |
await save( { |
| 13 |
image_optimizer_review_data: { |
| 14 |
...get.data.image_optimizer_review_data, |
| 15 |
repo_review_clicked: true, |
| 16 |
}, |
| 17 |
} ); |
| 18 |
|
| 19 |
close(); |
| 20 |
window.open( WORDPRESS_REVIEW_LINK, '_blank' ); |
| 21 |
}; |
| 22 |
|
| 23 |
return ( |
| 24 |
<FormControl fullWidth> |
| 25 |
<Typography variant="body1" marginBottom={ 1 }> |
| 26 |
{ __( 'It would mean a lot if you left us a quick review, so others can discover it too.', 'image-optimization' ) } |
| 27 |
</Typography> |
| 28 |
<Button |
| 29 |
color="primary" |
| 30 |
variant="contained" |
| 31 |
onClick={ handleSubmit } |
| 32 |
> |
| 33 |
{ __( 'Leave a review', 'image-optimization' ) } |
| 34 |
</Button> |
| 35 |
</FormControl> |
| 36 |
); |
| 37 |
}; |
| 38 |
|
| 39 |
export default ReviewForm; |
| 40 |
|