import { Modal, Button, ButtonGroup } from '@wordpress/components' import { render } from '@wordpress/element' import { __, sprintf } from '@wordpress/i18n' import ExtendifyLibrary from '@library/ExtendifyLibrary' import { useWantedTemplateStore } from '@library/state/Importing' import { useUserStore } from '@library/state/User' import { getPluginDescription } from '@library/util/general' import NeedsPermissionModal from '../NeedsPermissionModal' import ActivatingModal from './ActivatingModal' export default function ActivatePluginsModal(props) { const wantedTemplate = useWantedTemplateStore( (store) => store.wantedTemplate, ) const closeModal = () => render( , document.getElementById('extendify-root'), ) const installPlugins = () => render(, document.getElementById('extendify-root')) const requiredPlugins = wantedTemplate?.fields?.required_plugins || [] if (!useUserStore.getState()?.canActivatePlugins) { return } return (

{props.message ?? __( sprintf( 'There is just one more step. This %s requires the following plugins to be installed and activated:', wantedTemplate?.fields?.type ?? 'template', ), 'extendify', )}

    { // Hardcoded temporarily to not force EP install // requiredPlugins.map((plugin) => requiredPlugins .filter((p) => p !== 'editorplus') .map((plugin) => (
  • {getPluginDescription(plugin)}
  • )) }
{props.showClose && ( )}
) }