balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

NeedsPermissionModal.js (1776B)


      1 import { __, sprintf } from '@wordpress/i18n'
      2 import { Modal, Button } from '@wordpress/components'
      3 import { render } from '@wordpress/element'
      4 import ExtendifyLibrary from '../ExtendifyLibrary'
      5 import { useWantedTemplateStore } from '../state/Importing'
      6 import { getPluginDescription } from '../util/general'
      7 
      8 export default function NeedsPermissionModal() {
      9     const wantedTemplate = useWantedTemplateStore(store => store.wantedTemplate)
     10     const closeModal = () => render(<ExtendifyLibrary show={true}/>, document.getElementById('extendify-root'))
     11     const requiredPlugins = wantedTemplate?.fields?.required_plugins || []
     12     return <Modal
     13         title={__('Plugins required', 'extendify-sdk')}
     14         isDismissible={false}>
     15         <p style={{
     16             maxWidth: '400px',
     17         }}>
     18             {sprintf(__('In order to add this %s to your site, the following plugins are required to be installed and activated.', 'extendify-sdk'), wantedTemplate?.fields?.type ?? 'template')}
     19         </p>
     20         <ul>
     21             {
     22                 // Hardcoded temporarily to not force EP install
     23                 // requiredPlugins.map((plugin) =>
     24                 requiredPlugins.filter((p) => p !== 'editorplus').map((plugin) =>
     25                     <li key={plugin}>
     26                         {getPluginDescription(plugin)}
     27                     </li>)
     28             }
     29         </ul>
     30         <p style={{
     31             maxWidth: '400px',fontWeight: 'bold',
     32         }}>
     33             {__('Please contact a site admin for assistance in adding these plugins to your site.', 'extendify-sdk')}
     34         </p>
     35         <Button isPrimary onClick={closeModal} style={{
     36             boxShadow: 'none',
     37         }}>
     38             {__('Return to library', 'extendify-sdk')}
     39         </Button>
     40     </Modal>
     41 }