PluginProbe
Extendify / 0.9.3
Extendify v0.9.3
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 / ActivatingModal.js

ActivatingModal.js in Extendify 0.9.3, at src/Library/middleware/hasPluginsActivated/ActivatingModal.js

59 lines 1.8 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 { useState, render } from '@wordpress/element'
3 import { __ } from '@wordpress/i18n'
4 import { Plugins } from '@library/api/Plugins'
5 import { useWantedTemplateStore } from '@library/state/Importing'
6 import ReloadRequiredModal from '../ReloadRequiredModal'
7 import ErrorActivating from './ErrorActivating'
8
9 export default function ActivatingModal() {
10 const [errorMessage, setErrorMessage] = useState('')
11 const wantedTemplate = useWantedTemplateStore(
12 (store) => store.wantedTemplate,
13 )
14
15 // Hardcoded temporarily to not force EP install
16 // const required = wantedTemplate?.fields?.required_plugins
17 const required = wantedTemplate?.fields?.required_plugins.filter(
18 (p) => p !== 'editorplus',
19 )
20
21 Plugins.installAndActivate(required)
22 .then(() => {
23 useWantedTemplateStore.setState({
24 importOnLoad: true,
25 })
26 })
27 .then(async () => {
28 await new Promise((resolve) => setTimeout(resolve, 1000))
29 render(
30 <ReloadRequiredModal />,
31 document.getElementById('extendify-root'),
32 )
33 })
34 .catch(({ response }) => {
35 setErrorMessage(response.data.message)
36 })
37
38 if (errorMessage) {
39 return <ErrorActivating msg={errorMessage} />
40 }
41
42 return (
43 <Modal
44 title={__('Activating plugins', 'extendify')}
45 isDismissible={false}>
46 <Button
47 style={{
48 width: '100%',
49 }}
50 disabled
51 isPrimary
52 isBusy
53 onClick={() => {}}>
54 {__('Activating...', 'extendify')}
55 </Button>
56 </Modal>
57 )
58 }
59