PluginProbe
Extendify / 0.9.3
Extendify v0.9.3
3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 0.7.0 All 126 releases
extendify / src / Library / middleware / NeedsPermissionModal.js

NeedsPermissionModal.js in Extendify 0.9.3, at src/Library/middleware/NeedsPermissionModal.js

66 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { Modal, Button } from '@wordpress/components'
2 import { render } from '@wordpress/element'
3 import { __, sprintf } from '@wordpress/i18n'
4 import ExtendifyLibrary from '@library/ExtendifyLibrary'
5 import { useWantedTemplateStore } from '@library/state/Importing'
6 import { getPluginDescription } from '@library/util/general'
7
8 export default function NeedsPermissionModal() {
9 const wantedTemplate = useWantedTemplateStore(
10 (store) => store.wantedTemplate,
11 )
12 const closeModal = () =>
13 render(
14 <ExtendifyLibrary show={true} />,
15 document.getElementById('extendify-root'),
16 )
17 const requiredPlugins = wantedTemplate?.fields?.required_plugins || []
18 return (
19 <Modal
20 title={__('Plugins required', 'extendify')}
21 isDismissible={false}>
22 <p
23 style={{
24 maxWidth: '400px',
25 }}>
26 {sprintf(
27 __(
28 'In order to add this %s to your site, the following plugins are required to be installed and activated.',
29 'extendify',
30 ),
31 wantedTemplate?.fields?.type ?? 'template',
32 )}
33 </p>
34 <ul>
35 {
36 // Hardcoded temporarily to not force EP install
37 // requiredPlugins.map((plugin) =>
38 requiredPlugins
39 .filter((p) => p !== 'editorplus')
40 .map((plugin) => (
41 <li key={plugin}>{getPluginDescription(plugin)}</li>
42 ))
43 }
44 </ul>
45 <p
46 style={{
47 maxWidth: '400px',
48 fontWeight: 'bold',
49 }}>
50 {__(
51 'Please contact a site admin for assistance in adding these plugins to your site.',
52 'extendify',
53 )}
54 </p>
55 <Button
56 isPrimary
57 onClick={closeModal}
58 style={{
59 boxShadow: 'none',
60 }}>
61 {__('Return to library', 'extendify')}
62 </Button>
63 </Modal>
64 )
65 }
66