diff --git a/assets/js/src/settings/index.tsx b/assets/js/src/settings/index.tsx index 8664d61e38..b1150874ae 100644 --- a/assets/js/src/settings/index.tsx +++ b/assets/js/src/settings/index.tsx @@ -1,37 +1,14 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import { - HashRouter, Switch, Route, Redirect, -} from 'react-router-dom'; -import Notices from 'notices/notices.jsx'; +import { HashRouter } from 'react-router-dom'; import { GlobalContext, useGlobalContextValue } from 'context'; -import MailPoet from 'mailpoet'; -import { - Advanced, - Basics, - KeyActivation, - SendWith, - SignupConfirmation, - WooCommerce, -} from './pages'; import { initStore } from './store'; -import Tabs from './components/tabs'; +import Settings from './settings'; -const App = () => ( +const Entry = () => ( - -

{MailPoet.I18n.t('settings')}

- - - - - - - - - - +
); @@ -39,5 +16,5 @@ const App = () => ( const container = document.getElementById('settings_container'); if (container) { initStore(window); - ReactDOM.render(, container); + ReactDOM.render(, container); } diff --git a/assets/js/src/settings/settings.tsx b/assets/js/src/settings/settings.tsx new file mode 100644 index 0000000000..d746b88180 --- /dev/null +++ b/assets/js/src/settings/settings.tsx @@ -0,0 +1,32 @@ +import React from 'react'; +import { Switch, Route, Redirect } from 'react-router-dom'; +import Notices from 'notices/notices.jsx'; +import MailPoet from 'mailpoet'; +import { + Advanced, + Basics, + KeyActivation, + SendWith, + SignupConfirmation, + WooCommerce, +} from './pages'; +import Tabs from './components/tabs'; + +export default function Settings() { + return ( + <> + +

{MailPoet.I18n.t('settings')}

+ + + + + + + + + + + + ); +} diff --git a/assets/js/src/webpack_admin_index.jsx b/assets/js/src/webpack_admin_index.jsx index 568471295d..af2943f38f 100644 --- a/assets/js/src/webpack_admin_index.jsx +++ b/assets/js/src/webpack_admin_index.jsx @@ -15,7 +15,6 @@ import 'old_settings/tabs.js'; // side effect - assigns to MailPoet.Router, exec import 'old_settings/premium_tab/premium_tab.jsx'; // side effect - renders ReactDOM to document import 'help/help.jsx'; // side effect - renders ReactDOM to document import 'old_settings/reinstall_from_scratch.js'; // side effect - adds event handler to document -import 'settings/index.tsx'; // side effect - renders Settings to document import 'subscribers/importExport/import.jsx'; // side effect - executes on doc ready, adds events import 'subscribers/importExport/export.js'; // side effect - executes on doc ready import 'wizard/wizard.jsx'; // side effect - renders ReactDOM to document diff --git a/views/settings.html b/views/settings.html index f764a7c36b..195e5ea5aa 100644 --- a/views/settings.html +++ b/views/settings.html @@ -58,3 +58,7 @@ 'premiumTabMssKeyNotValidMessage': __('Your key is not valid for the MailPoet Sending Service', 'mailpoet'), }) %> <% endblock %> + +<% block after_javascript %> +<%= javascript('settings.js')%> +<% endblock %> \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index a6bcc84889..295b2edbd5 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -379,7 +379,18 @@ const postEditorBlock = { }, }; -module.exports = [adminConfig, publicConfig, migratorConfig, formEditorConfig, testConfig, postEditorBlock].map((config) => { +// Settings config +const settingsConfig = { + name: 'settings', + entry: { + settings: 'settings/index.tsx', + }, + externals: { + 'mailpoet': 'MailPoet', + }, +}; + +module.exports = [adminConfig, publicConfig, migratorConfig, formEditorConfig, testConfig, postEditorBlock, settingsConfig].map((config) => { if (config.name !== 'test') { config.plugins = config.plugins || []; config.plugins.push(