diff --git a/packages/core/email/admin/src/pages/Settings/components/Configuration.js b/packages/core/email/admin/src/pages/Settings/components/Configuration.js deleted file mode 100644 index c35e6d950b..0000000000 --- a/packages/core/email/admin/src/pages/Settings/components/Configuration.js +++ /dev/null @@ -1,113 +0,0 @@ -/* eslint-disable no-useless-escape */ - -import React from 'react'; - -import { Flex, Grid, GridItem, Option, Select, TextInput, Typography } from '@strapi/design-system'; -import PropTypes from 'prop-types'; -import { useIntl } from 'react-intl'; -import styled from 'styled-components'; - -const DocumentationLink = styled.a` - color: ${({ theme }) => theme.colors.primary600}; -`; - -const Configuration = ({ config }) => { - const { formatMessage } = useIntl(); - - return ( - - - - {formatMessage({ - id: 'email.Settings.email.plugin.title.config', - defaultMessage: 'Configuration', - })} - - - {formatMessage( - { - id: 'email.Settings.email.plugin.text.configuration', - defaultMessage: - 'The plugin is configured through the {file} file, checkout this {link} for the documentation.', - }, - { - file: './config/plugins.js', - link: ( - - {formatMessage({ - id: 'email.link', - defaultMessage: 'Link', - })} - - ), - } - )} - - - - - '", - })} - disabled - onChange={() => {}} - value={config.settings.defaultFrom} - /> - - - '`, - })} - disabled - onChange={() => {}} - value={config.settings.defaultReplyTo} - /> - - - - - - - ); -}; - -Configuration.propTypes = { - config: PropTypes.shape({ - provider: PropTypes.string, - settings: PropTypes.shape({ - defaultFrom: PropTypes.string, - defaultReplyTo: PropTypes.string, - }), - }).isRequired, -}; - -export default Configuration; diff --git a/packages/core/email/admin/src/pages/Settings/index.js b/packages/core/email/admin/src/pages/Settings/index.js index c20f32b466..df66bb164b 100644 --- a/packages/core/email/admin/src/pages/Settings/index.js +++ b/packages/core/email/admin/src/pages/Settings/index.js @@ -55,33 +55,39 @@ const SettingsPage = () => { return config; }); - const mutation = useMutation((body) => post('/email/test', body), { - onError() { - toggleNotification({ - type: 'warning', - message: formatMessage( - { - id: 'email.Settings.email.plugin.notification.test.error', - defaultMessage: 'Failed to send a test mail to {to}', - }, - { to: testAddress } - ), - }); - }, + const mutation = useMutation( + (body) => post('/email/test', body), + { + onError() { + toggleNotification({ + type: 'warning', + message: formatMessage( + { + id: 'email.Settings.email.plugin.notification.test.error', + defaultMessage: 'Failed to send a test mail to {to}', + }, + { to: testAddress } + ), + }); + }, - onSuccess() { - toggleNotification({ - type: 'success', - message: formatMessage( - { - id: 'email.Settings.email.plugin.notification.test.success', - defaultMessage: 'Email test succeeded, check the {to} mailbox', - }, - { to: testAddress } - ), - }); + onSuccess() { + toggleNotification({ + type: 'success', + message: formatMessage( + { + id: 'email.Settings.email.plugin.notification.test.success', + defaultMessage: 'Email test succeeded, check the {to} mailbox', + }, + { to: testAddress } + ), + }); + }, }, - }); + { + retry: false, + } + ); useFocusWhenNavigate(); @@ -138,7 +144,7 @@ const SettingsPage = () => { /> - {isLoading || mutation.isLoading ? ( + {isLoading ? ( ) : (
@@ -171,7 +177,7 @@ const SettingsPage = () => { file: './config/plugins.js', link: ( @@ -199,6 +205,7 @@ const SettingsPage = () => { defaultMessage: "ex: Strapi No-Reply '<'no-reply@strapi.io'>'", })} disabled + onChange={() => {}} value={data.settings.defaultFrom} /> @@ -215,6 +222,7 @@ const SettingsPage = () => { defaultMessage: `ex: Strapi '<'example@strapi.io'>'`, })} disabled + onChange={() => {}} value={data.settings.defaultReplyTo} /> @@ -227,6 +235,7 @@ const SettingsPage = () => { defaultMessage: 'Email provider', })} disabled + onChange={() => {}} value={data.provider} > @@ -236,8 +245,11 @@ const SettingsPage = () => { - { paddingLeft={7} paddingRight={7} > - - - {formatMessage({ - id: 'email.Settings.email.plugin.title.test', - defaultMessage: 'Test email delivery', - })} - + + {formatMessage({ + id: 'email.Settings.email.plugin.title.test', + defaultMessage: 'Test email delivery', + })} + - - - - - - - - - - + + + + + + + + + )} diff --git a/packages/core/email/package.json b/packages/core/email/package.json index 3ea595b8fb..14a36f1c3f 100644 --- a/packages/core/email/package.json +++ b/packages/core/email/package.json @@ -34,6 +34,7 @@ "lodash": "4.17.21", "prop-types": "^15.8.1", "react-intl": "6.4.1", + "react-query": "3.39.3", "yup": "0.32.9" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index b4117b51d0..c379ce9901 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7312,6 +7312,7 @@ __metadata: react: ^18.2.0 react-dom: ^18.2.0 react-intl: 6.4.1 + react-query: 3.39.3 react-router-dom: 5.3.4 styled-components: 5.3.3 yup: 0.32.9