| 1 |
import { ChoiceBox } from '@auto-launch/components/ChoiceBox'; |
| 2 |
import { checkIn } from '@auto-launch/functions/insights'; |
| 3 |
import { sparkles } from '@auto-launch/icons'; |
| 4 |
import { useEffect } from '@wordpress/element'; |
| 5 |
import { __ } from '@wordpress/i18n'; |
| 6 |
import { cloudUpload } from '@wordpress/icons'; |
| 7 |
import { motion } from 'framer-motion'; |
| 8 |
|
| 9 |
const getMigrateSearchUrl = () => |
| 10 |
`${window.extSharedData.adminUrl}plugin-install.php?tab=search&s=${encodeURIComponent( |
| 11 |
__('migration', 'extendify-local'), |
| 12 |
)}`; |
| 13 |
|
| 14 |
export const MigrateChoice = ({ onBuildNew }) => { |
| 15 |
useEffect(() => { |
| 16 |
checkIn({ stage: 'migrate_screen' }); |
| 17 |
}, []); |
| 18 |
|
| 19 |
return ( |
| 20 |
<motion.div |
| 21 |
animate={{ opacity: 1 }} |
| 22 |
exit={{ opacity: 0 }} |
| 23 |
transition={{ duration: 0.4 }} |
| 24 |
className="grid w-full gap-6 sm:mx-auto sm:max-w-xl sm:grid-cols-2 sm:items-start sm:pt-7" |
| 25 |
> |
| 26 |
<ChoiceBox |
| 27 |
icon={cloudUpload} |
| 28 |
buttonLabel={__('Migrate website', 'extendify-local')} |
| 29 |
description={__( |
| 30 |
'Import an existing WordPress website', |
| 31 |
'extendify-local', |
| 32 |
)} |
| 33 |
onClick={() => { |
| 34 |
checkIn({ stage: 'migrate_screen_migrate' }); |
| 35 |
window.location.assign(getMigrateSearchUrl()); |
| 36 |
}} |
| 37 |
/> |
| 38 |
<ChoiceBox |
| 39 |
icon={sparkles} |
| 40 |
highlight |
| 41 |
badgeLabel={__('Most Popular', 'extendify-local')} |
| 42 |
buttonLabel={__('Build a new website', 'extendify-local')} |
| 43 |
description={__( |
| 44 |
'Create a beautiful website in about a minute', |
| 45 |
'extendify-local', |
| 46 |
)} |
| 47 |
onClick={() => { |
| 48 |
checkIn({ stage: 'migrate_screen_build' }); |
| 49 |
onBuildNew(); |
| 50 |
}} |
| 51 |
/> |
| 52 |
</motion.div> |
| 53 |
); |
| 54 |
}; |
| 55 |
|