WaitingCrunchingModal.js (778B)
1 import { Button, Modal } from '@wordpress/components' 2 import { useEffect } from '@wordpress/element' 3 import { __ } from '@wordpress/i18n' 4 5 export default function WaitingCrunchingModal({ action, callback, text }) { 6 useEffect(() => { 7 action.then(async () => await callback()) 8 }) 9 10 // Currently this is just a basic WP modal that is invoked/rendered outside of the 11 // application, but could instead act as a mediary page that renderes within. It's 12 // just not yet used there at this time. 13 return <Modal 14 title={text} 15 isDismissible={false}> 16 <Button style={{ 17 width: '100%', 18 }} disabled isPrimary isBusy onClick={() => {}}> 19 {__('Please wait...', 'extendify-sdk')} 20 </Button> 21 </Modal> 22 }