PluginProbe
Extendify / 0.10.0
Extendify v0.10.0
3.2.1 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 All 127 releases
extendify / src / Library / middleware / hasPluginsActivated / ActivatePluginsModal.js

ActivatePluginsModal.js in Extendify 0.10.0, at src/Library/middleware/hasPluginsActivated/ActivatePluginsModal.js

79 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { Modal, Button, ButtonGroup } 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 { useUserStore } from '@library/state/User'
7 import { getPluginDescription } from '@library/util/general'
8 import NeedsPermissionModal from '../NeedsPermissionModal'
9 import ActivatingModal from './ActivatingModal'
10
11 export default function ActivatePluginsModal(props) {
12 const wantedTemplate = useWantedTemplateStore(
13 (store) => store.wantedTemplate,
14 )
15 const closeModal = () =>
16 render(
17 <ExtendifyLibrary show={true} />,
18 document.getElementById('extendify-root'),
19 )
20 const installPlugins = () =>
21 render(<ActivatingModal />, document.getElementById('extendify-root'))
22 const requiredPlugins = wantedTemplate?.fields?.required_plugins || []
23
24 if (!useUserStore.getState()?.canActivatePlugins) {
25 return <NeedsPermissionModal />
26 }
27
28 return (
29 <Modal
30 title={__('Activate required plugins', 'extendify')}
31 isDismissible={false}>
32 <div>
33 <p
34 style={{
35 maxWidth: '400px',
36 }}>
37 {props.message ??
38 __(
39 sprintf(
40 'There is just one more step. This %s requires the following plugins to be installed and activated:',
41 wantedTemplate?.fields?.type ?? 'template',
42 ),
43 'extendify',
44 )}
45 </p>
46 <ul>
47 {
48 // Hardcoded temporarily to not force EP install
49 // requiredPlugins.map((plugin) =>
50 requiredPlugins
51 .filter((p) => p !== 'editorplus')
52 .map((plugin) => (
53 <li key={plugin}>
54 {getPluginDescription(plugin)}
55 </li>
56 ))
57 }
58 </ul>
59 <ButtonGroup>
60 <Button isPrimary onClick={installPlugins}>
61 {__('Activate Plugins', 'extendify')}
62 </Button>
63 {props.showClose && (
64 <Button
65 isTertiary
66 onClick={closeModal}
67 style={{
68 boxShadow: 'none',
69 margin: '0 4px',
70 }}>
71 {__('No thanks, return to library', 'extendify')}
72 </Button>
73 )}
74 </ButtonGroup>
75 </div>
76 </Modal>
77 )
78 }
79