From 6caf36e259865bb573527083ec70500dc796950c Mon Sep 17 00:00:00 2001 From: Shay Cojocaru Date: Sat, 18 Feb 2023 02:17:35 +0200 Subject: [PATCH 01/15] chore: bump formik and fix breaking changes --- package.json | 4 +- .../ChangePassword.component.js | 4 + .../Account/Login/Login.component.js | 8 ++ .../ResetPassword/ResetPassword.component.js | 6 + .../Account/SignUp/SignUp.component.js | 6 + yarn.lock | 124 +++++------------- 6 files changed, 56 insertions(+), 96 deletions(-) diff --git a/package.json b/package.json index b929cd591..34df7890c 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "echarts-for-react": "^3.0.2", "file-saver": "^2.0.5", "fontsource-roboto": "^4.0.0", - "formik": "^1.3.2", + "formik": "^2.2.9", "history": "^4.10.1", "i18n-iso-countries": "4.3.1", "intl": "^1.2.5", @@ -85,7 +85,7 @@ "shortid": "^2.2.16", "source-map-explorer": "^2.5.3", "swiper": "^6.8.4", - "yup": "^0.32.11" + "yup": "^1.0.0" }, "devDependencies": { "@wojtekmaj/enzyme-adapter-react-17": "^0.6.0", diff --git a/src/components/Account/ChangePassword/ChangePassword.component.js b/src/components/Account/ChangePassword/ChangePassword.component.js index 4954b3011..b3165ea1e 100644 --- a/src/components/Account/ChangePassword/ChangePassword.component.js +++ b/src/components/Account/ChangePassword/ChangePassword.component.js @@ -111,6 +111,10 @@ export class ChangePassword extends Component { {({ errors, handleChange, handleSubmit }) => (
+
{loginStatus.message}
+ {({ errors, handleChange, handleSubmit }) => ( @@ -82,6 +88,7 @@ export class Login extends Component { name="password" onChange={handleChange} /> + - - - - - - )} - + + + + )} +
- - - - ); - } + + + + ); } +Login.propTypes = { + intl: intlShape.isRequired, + isDialogOpen: PropTypes.bool.isRequired, + onClose: PropTypes.func.isRequired, + onResetPasswordClick: PropTypes.func.isRequired +}; + const mapDispatchToProps = { login }; From 54df9f93203a6f413f6f42725e568a886e1ebfb6 Mon Sep 17 00:00:00 2001 From: Shay Cojocaru Date: Sat, 18 Feb 2023 02:51:12 +0200 Subject: [PATCH 03/15] chore: cleanup --- src/components/Account/Login/Login.component.js | 2 +- src/components/Account/Login/Login.component.test.js | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/Account/Login/Login.component.js b/src/components/Account/Login/Login.component.js index dc106fa6e..f78017fd3 100644 --- a/src/components/Account/Login/Login.component.js +++ b/src/components/Account/Login/Login.component.js @@ -17,7 +17,7 @@ import { login } from './Login.actions'; import messages from './Login.messages'; import './Login.css'; -function Login(props) { +export function Login(props) { const { intl, isDialogOpen, onClose, onResetPasswordClick, login } = props; const [isLogin, setIsLogin] = useState(false); const [loginStatus, setLoginStatus] = useState({}); diff --git a/src/components/Account/Login/Login.component.test.js b/src/components/Account/Login/Login.component.test.js index 72c4ded3d..9c8155bc9 100644 --- a/src/components/Account/Login/Login.component.test.js +++ b/src/components/Account/Login/Login.component.test.js @@ -1,6 +1,5 @@ import React from 'react'; -import { shallow, mount } from 'enzyme'; -import { shallowMatchSnapshot } from '../../../common/test_utils'; +import { shallow } from 'enzyme'; import { Login } from './Login.component'; jest.mock('./Login.messages', () => { @@ -24,7 +23,6 @@ jest.mock('./Login.messages', () => { }; }); -const mockLoginfn = jest.fn(); const props = { isDialogOpen: false, onClose: jest.fn(), From 47ea81e94e3169f055df77ed64c7245e9f352d5d Mon Sep 17 00:00:00 2001 From: Shay Cojocaru Date: Sat, 18 Feb 2023 03:34:11 +0200 Subject: [PATCH 04/15] refactor: to fn comp --- .../ChangePassword.component.js | 243 +++++++++--------- 1 file changed, 117 insertions(+), 126 deletions(-) diff --git a/src/components/Account/ChangePassword/ChangePassword.component.js b/src/components/Account/ChangePassword/ChangePassword.component.js index b3165ea1e..aa7f05a12 100644 --- a/src/components/Account/ChangePassword/ChangePassword.component.js +++ b/src/components/Account/ChangePassword/ChangePassword.component.js @@ -1,4 +1,4 @@ -import React, { Component } from 'react'; +import React, { useState } from 'react'; import { connect } from 'react-redux'; import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; import { Formik } from 'formik'; @@ -18,145 +18,136 @@ import { storePassword } from './ChangePassword.actions'; import messages from './ChangePassword.messages'; import './ChangePassword.css'; -export class ChangePassword extends Component { - static propTypes = { - intl: intlShape.isRequired - }; - - state = { - isSending: false, - storePasswordState: {}, - redirectMessage: '' - }; +export function ChangePassword({ + intl, + history, + storePassword, + match: { + params: { userid, url } + } +}) { + const [isSending, setIsSending] = useState(false); + const [storePasswordState, setStorePasswordState] = useState({}); + const [redirectMessage, setRedirectMessage] = useState(''); + const isButtonDisabled = isSending || !!storePasswordState.success; - sleep = milliseconds => { + function sleep(milliseconds) { return new Promise(resolve => setTimeout(resolve, milliseconds)); - }; - - handleSubmit = values => { - const { - match: { - params: { userid, url } - } - } = this.props; - - const { intl, history, storePassword } = this.props; + } - this.setState({ - isSending: true, - storePasswordState: {} - }); + function handleSubmit(values) { + setIsSending(true); + setStorePasswordState({}); storePassword(userid, values.password, url) - .then(res => { - this.setState({ - storePasswordState: res, - redirectMessage: intl.formatMessage(messages.redirect) - }); - this.sleep(2000).then(() => { + .then(response => { + setStorePasswordState(response); + setRedirectMessage(intl.formatMessage(messages.redirect)); + + sleep(2000).then(() => { history.replace('/login-signup'); }); }) - .catch(err => this.setState({ storePasswordState: err })) - .finally(() => this.setState({ isSending: false })); - }; - - render() { - const { isSending, storePasswordState, redirectMessage } = this.state; - const { intl } = this.props; - - const isButtonDisabled = isSending || !!storePasswordState.success; - - return ( -
- - - - - - {storePasswordState && !storePasswordState.success && ( - - - + .catch(error => setStorePasswordState(error)) + .finally(() => setIsSending(false)); + } + + return ( +
+ + + + + + + {storePasswordState && !storePasswordState.success && ( + + + + )} + +
+ {!!storePasswordState.success ? ( + + {intl.formatMessage(messages.changePasswordSuccess)} + + ) : ( + + {storePasswordState.message} + )} +
+ + {redirectMessage && (
- {!!storePasswordState.success ? ( - - {intl.formatMessage(messages.changePasswordSuccess)} - - ) : ( - - {storePasswordState.message} - + className={classNames( + 'ChangePassword__status', + 'ChangePassword__status--success' )} + > + + {intl.formatMessage(messages.redirect)} +
- {redirectMessage && ( -
- - {intl.formatMessage(messages.redirect)} - -
- )} - {storePasswordState && !storePasswordState.success && ( - - {({ errors, handleChange, handleSubmit }) => ( -
- - - - - - - )} -
- )} -
-
-
- ); - } + )} + + {storePasswordState && !storePasswordState.success && ( + + {({ errors, handleChange, handleSubmit }) => ( +
+ + + + + + + + + )} +
+ )} +
+
+
+ ); } +ChangePassword.propTypes = { + intl: intlShape.isRequired +}; + const mapDispatchToProps = { storePassword }; From e17e769049d22ffaa717d2cc823a4659b9b21afa Mon Sep 17 00:00:00 2001 From: Shay Cojocaru Date: Sat, 18 Feb 2023 03:38:55 +0200 Subject: [PATCH 05/15] refactor: to fn comp --- .../ResetPassword/ResetPassword.component.js | 174 +++++++++--------- 1 file changed, 82 insertions(+), 92 deletions(-) diff --git a/src/components/Account/ResetPassword/ResetPassword.component.js b/src/components/Account/ResetPassword/ResetPassword.component.js index 9dd7b7c94..806daedac 100644 --- a/src/components/Account/ResetPassword/ResetPassword.component.js +++ b/src/components/Account/ResetPassword/ResetPassword.component.js @@ -1,4 +1,4 @@ -import React, { Component } from 'react'; +import React, { useState } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; @@ -18,109 +18,99 @@ import { forgot } from './ResetPassword.actions'; import messages from './ResetPassword.messages'; import './ResetPassword.css'; -export class ResetPassword extends Component { - static propTypes = { - intl: intlShape.isRequired, - isDialogOpen: PropTypes.bool.isRequired, - onClose: PropTypes.func.isRequired - }; +export function ResetPassword({ intl, isDialogOpen, onClose }) { + const [isSending, setIsSending] = useState(false); + const [forgotState, setForgotState] = useState({}); + const isButtonDisabled = isSending || !!forgotState.success; - state = { - isSending: false, - forgotState: {} - }; - - handleSubmit = values => { - const { forgot } = this.props; - - this.setState({ - isSending: true, - forgotState: {} - }); + function handleSubmit(values) { + setIsSending(true); + setForgotState({}); forgot(values) - .then(res => this.setState({ forgotState: res })) - .catch(err => this.setState({ forgotState: err })) - .finally(() => this.setState({ isSending: false })); - }; - - render() { - const { isSending, forgotState } = this.state; - const { intl, isDialogOpen, onClose } = this.props; + .then(response => setForgotState(response)) + .catch(error => setForgotState(error)) + .finally(() => setIsSending(false)); + } - const isButtonDisabled = isSending || !!forgotState.success; + return ( + + + + - return ( - - - - + + + + - - - - +
+ {!!forgotState.success ? ( + + {intl.formatMessage(messages.resetPasswordSuccess)} + + ) : ( + {forgotState.message} + )} +
-
- {!!forgotState.success ? ( - - {intl.formatMessage(messages.resetPasswordSuccess)} - - ) : ( - {forgotState.message} - )} -
+ {({ errors, handleChange, handleSubmit }) => ( +
+ - {forgotState && !forgotState.success && ( - - {({ errors, handleChange, handleSubmit }) => ( - - + + - - - - - - )} - - )} -
-
- ); - } + + + + )} + + )} + +
+ ); } +ResetPassword.propTypes = { + intl: intlShape.isRequired, + forgot: PropTypes.func.isRequired, + isDialogOpen: PropTypes.bool.isRequired, + onClose: PropTypes.func.isRequired +}; + const mapDispatchToProps = { forgot }; From 5017282f2903039cc0424e0c65415f65601ff619 Mon Sep 17 00:00:00 2001 From: Shay Cojocaru Date: Sat, 18 Feb 2023 03:50:04 +0200 Subject: [PATCH 06/15] refactor: to fn comp --- .../Account/SignUp/SignUp.component.js | 288 +++++++++--------- 1 file changed, 138 insertions(+), 150 deletions(-) diff --git a/src/components/Account/SignUp/SignUp.component.js b/src/components/Account/SignUp/SignUp.component.js index 6cbe5b20d..0ccc4a15a 100644 --- a/src/components/Account/SignUp/SignUp.component.js +++ b/src/components/Account/SignUp/SignUp.component.js @@ -1,4 +1,4 @@ -import React, { Component } from 'react'; +import React, { Component, useState, useEffect } from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; import { Formik, ErrorMessage } from 'formik'; @@ -18,167 +18,155 @@ import { signUp } from './SignUp.actions'; import messages from './SignUp.messages'; import './SignUp.css'; -export class SignUp extends Component { - static propTypes = { - intl: intlShape.isRequired, - isDialogOpen: PropTypes.bool.isRequired, - onClose: PropTypes.func.isRequired - }; +export function SignUp({ isDialogOpen, onClose, intl }) { + const [isSigningUp, setIsSigningUp] = useState(false); + const [signUpStatus, setSignUpStatus] = useState({}); + const isButtonDisabled = isSigningUp || !!signUpStatus.success; - state = { - isSigningUp: false, - signUpStatus: {} - }; + function handleSubmit() { + setIsSigningUp(true); + setSignUpStatus({}); - componentDidUpdate({ isDialogOpen }) { - if (this.props.isDialogOpen && this.props.isDialogOpen !== isDialogOpen) { - this.setState({ signUpStatus: {} }); - } + signUp() + .then(response => setSignUpStatus(response)) + .catch(error => setSignUpStatus(error)) + .finally(() => setIsSigningUp(false)); } - handleSubmit = values => { - const { passwordConfirm, ...formValues } = values; + return ( + + + + - this.setState({ - isSigningUp: true, - signUpStatus: {} - }); + +
+ {signUpStatus.message} +
- signUp(formValues) - .then(signUpStatus => this.setState({ signUpStatus })) - .catch(signUpStatus => this.setState({ signUpStatus })) - .finally(() => this.setState({ isSigningUp: false })); - }; + {signUpStatus && !signUpStatus.success && ( + + {({ errors, handleChange, handleSubmit }) => ( +
+ - render() { - const { signUpStatus, isSigningUp } = this.state; - const { isDialogOpen, onClose, intl } = this.props; + - const isButtonDisabled = isSigningUp || !!signUpStatus.success; + - return ( - - - - + - -
- {signUpStatus.message} -
+ + } + label={ + + {intl.formatMessage(messages.termsAndConditions)} + + ), + privacy: ( + + {intl.formatMessage(messages.privacy)} + + ) + }} + /> + } + /> - {signUpStatus && !signUpStatus.success && ( - - {({ errors, handleChange, handleSubmit }) => ( - - - - - - - } - label={ - - {intl.formatMessage(messages.termsAndConditions)} - - ), - privacy: ( - - {intl.formatMessage(messages.privacy)} - - ) - }} - /> - } - /> - + - - - - - - )} - - )} -
-
- ); - } + + + + + + + )} +
+ )} +
+
+ ); } +SignUp.propTypes = { + intl: intlShape.isRequired, + isDialogOpen: PropTypes.bool.isRequired, + onClose: PropTypes.func.isRequired +}; + export default injectIntl(SignUp); From 7a3648b4d6d6ee667ffbf2aba2120d52c73a1636 Mon Sep 17 00:00:00 2001 From: Shay Cojocaru Date: Sat, 18 Feb 2023 04:01:18 +0200 Subject: [PATCH 07/15] chore: cleanup --- .../Account/ResetPassword/ResetPassword.actions.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/Account/ResetPassword/ResetPassword.actions.js b/src/components/Account/ResetPassword/ResetPassword.actions.js index 9ac5af14c..4756fbce3 100644 --- a/src/components/Account/ResetPassword/ResetPassword.actions.js +++ b/src/components/Account/ResetPassword/ResetPassword.actions.js @@ -25,7 +25,7 @@ export function forgotApiSuccess(board) { }; } -export function forgot({ email }, type = 'local') { +export function forgot({ email }) { return async dispatch => { try { dispatch(forgotApiStarted()); @@ -34,12 +34,15 @@ export function forgot({ email }, type = 'local') { return Promise.resolve(res); } catch (err) { dispatch(forgotApiFailure(err.message)); + if (err.response != null) { return Promise.reject(err.response.data); } - var disonnected = { + + const disonnected = { message: 'Unable to contact server. Try in a moment' }; + return Promise.reject(disonnected); } }; From 06e7cac50c2e67ae27f1b13caf7cc5bff272789e Mon Sep 17 00:00:00 2001 From: Shay Cojocaru Date: Sat, 18 Feb 2023 04:01:29 +0200 Subject: [PATCH 08/15] refactor: comp to fn --- .../Account/Activate/Activate.container.js | 69 +++++++++---------- 1 file changed, 32 insertions(+), 37 deletions(-) diff --git a/src/components/Account/Activate/Activate.container.js b/src/components/Account/Activate/Activate.container.js index 601c7bda6..b4aea1c01 100644 --- a/src/components/Account/Activate/Activate.container.js +++ b/src/components/Account/Activate/Activate.container.js @@ -1,48 +1,43 @@ -import React, { Fragment, PureComponent } from 'react'; +import React, { useState, useEffect } from 'react'; import { Link } from 'react-router-dom'; import { activate } from './Activate.actions'; import './Activate.css'; -class ActivateContainer extends PureComponent { - state = { - isActivating: false, - activationStatus: {} - }; - - componentDidMount() { - const { - match: { - params: { url } - } - } = this.props; +function ActivateContainer({ + match: { + params: { url } + } +}) { + const [isActivating, setIsActivating] = useState(false); + const [activationStatus, setActivationStatus] = useState({}); - this.setState({ isActivating: true }); + useEffect( + () => { + setIsActivating(true); - activate(url) - .then(activationStatus => this.setState({ activationStatus })) - .catch(activationStatus => this.setState({ activationStatus })) - .finally(() => this.setState({ isActivating: false })); - } + activate(url) + .then(response => setActivationStatus(response)) + .catch(error => setActivationStatus(error)) + .finally(() => setIsActivating(false)); + }, + [url] + ); - render() { - const { isActivating, activationStatus } = this.state; + return ( +
+ {isActivating ? ( + 'Activating your account...' + ) : ( + <> +
{activationStatus.message}
- return ( -
- {isActivating ? ( - 'Activating your account...' - ) : ( - - {activationStatus.message} -
- - Home page - -
- )} -
- ); - } + + Home page + + + )} +
+ ); } export default ActivateContainer; From 2295d3815316806c1d627962c2b2b5bf5af675e5 Mon Sep 17 00:00:00 2001 From: Shay Cojocaru Date: Sat, 18 Feb 2023 04:04:07 +0200 Subject: [PATCH 09/15] chore: cleanp --- .../Account/ChangePassword/ChangePassword.actions.js | 5 ++++- .../Account/ChangePassword/ChangePassword.component.js | 6 +++--- src/components/Account/ChangePassword/ChangePassword.css | 4 ---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/components/Account/ChangePassword/ChangePassword.actions.js b/src/components/Account/ChangePassword/ChangePassword.actions.js index 8f8691c02..3809c0808 100644 --- a/src/components/Account/ChangePassword/ChangePassword.actions.js +++ b/src/components/Account/ChangePassword/ChangePassword.actions.js @@ -34,12 +34,15 @@ export function storePassword(userid, password, url) { return Promise.resolve(res); } catch (err) { dispatch(storePasswordApiFailure(err.message)); + if (err.response != null) { return Promise.reject(err.response.data); } - var disonnected = { + + const disonnected = { message: 'Unable to contact server. Try in a moment' }; + return Promise.reject(disonnected); } }; diff --git a/src/components/Account/ChangePassword/ChangePassword.component.js b/src/components/Account/ChangePassword/ChangePassword.component.js index aa7f05a12..7014487b6 100644 --- a/src/components/Account/ChangePassword/ChangePassword.component.js +++ b/src/components/Account/ChangePassword/ChangePassword.component.js @@ -40,15 +40,15 @@ export function ChangePassword({ setStorePasswordState({}); storePassword(userid, values.password, url) - .then(response => { - setStorePasswordState(response); + .then(res => { + setStorePasswordState(res); setRedirectMessage(intl.formatMessage(messages.redirect)); sleep(2000).then(() => { history.replace('/login-signup'); }); }) - .catch(error => setStorePasswordState(error)) + .catch(err => setStorePasswordState(err)) .finally(() => setIsSending(false)); } diff --git a/src/components/Account/ChangePassword/ChangePassword.css b/src/components/Account/ChangePassword/ChangePassword.css index e22c079e2..b916dc150 100644 --- a/src/components/Account/ChangePassword/ChangePassword.css +++ b/src/components/Account/ChangePassword/ChangePassword.css @@ -9,10 +9,6 @@ background: linear-gradient(to right, rgb(121, 22, 254), rgb(172, 47, 138)); } -.ChangePassword_home { - margin-top: 1em; - color: inherit; -} .ChangePassword__form > div { width: 100%; } From 3c57ca1fa5d71d24b6ffd8f490bff05d5ef24ad6 Mon Sep 17 00:00:00 2001 From: Shay Cojocaru Date: Sat, 18 Feb 2023 04:11:48 +0200 Subject: [PATCH 10/15] chore: streamline --- src/components/Account/Login/Login.component.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/Account/Login/Login.component.js b/src/components/Account/Login/Login.component.js index f78017fd3..86159c78e 100644 --- a/src/components/Account/Login/Login.component.js +++ b/src/components/Account/Login/Login.component.js @@ -21,12 +21,6 @@ export function Login(props) { const { intl, isDialogOpen, onClose, onResetPasswordClick, login } = props; const [isLogin, setIsLogin] = useState(false); const [loginStatus, setLoginStatus] = useState({}); - - const loginStatusClassName = classNames('Login__status', { - 'Login__status--error': !loginStatus.success, - 'Login__status--success': loginStatus.success - }); - const isButtonDisabled = isLogin || !!loginStatus.success; function handleSubmit(values) { @@ -45,7 +39,12 @@ export function Login(props) { -
+
{loginStatus.message}
From 52acf4a14f0b4130fa94f7af06d7106d2a7ad856 Mon Sep 17 00:00:00 2001 From: Shay Cojocaru Date: Sat, 18 Feb 2023 04:14:22 +0200 Subject: [PATCH 11/15] chore: cleanup --- src/components/Account/SignUp/SignUp.component.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Account/SignUp/SignUp.component.js b/src/components/Account/SignUp/SignUp.component.js index 0ccc4a15a..b147f5252 100644 --- a/src/components/Account/SignUp/SignUp.component.js +++ b/src/components/Account/SignUp/SignUp.component.js @@ -1,4 +1,4 @@ -import React, { Component, useState, useEffect } from 'react'; +import React, { useState } from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; import { Formik, ErrorMessage } from 'formik'; From 950dbbac4f87ba32e202ea5559f1be4709ea6590 Mon Sep 17 00:00:00 2001 From: Shay Cojocaru Date: Sat, 18 Feb 2023 04:17:47 +0200 Subject: [PATCH 12/15] chore: remove unused vars --- src/components/Account/SignUp/Signup.component.test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/Account/SignUp/Signup.component.test.js b/src/components/Account/SignUp/Signup.component.test.js index b59e1d862..6b8b90466 100644 --- a/src/components/Account/SignUp/Signup.component.test.js +++ b/src/components/Account/SignUp/Signup.component.test.js @@ -1,6 +1,5 @@ import React from 'react'; -import { shallow, mount } from 'enzyme'; -import { shallowMatchSnapshot } from '../../../common/test_utils'; +import { shallow } from 'enzyme'; import { SignUp } from './SignUp.component'; jest.mock('./SignUp.messages', () => { From e49165672522a7e7b63fa4993516258f6e1c7248 Mon Sep 17 00:00:00 2001 From: Shay Cojocaru Date: Sat, 18 Feb 2023 04:31:09 +0200 Subject: [PATCH 13/15] chore: streamline --- src/components/Account/Login/Login.component.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/Account/Login/Login.component.js b/src/components/Account/Login/Login.component.js index 86159c78e..a1e31f60f 100644 --- a/src/components/Account/Login/Login.component.js +++ b/src/components/Account/Login/Login.component.js @@ -17,8 +17,13 @@ import { login } from './Login.actions'; import messages from './Login.messages'; import './Login.css'; -export function Login(props) { - const { intl, isDialogOpen, onClose, onResetPasswordClick, login } = props; +export function Login({ + intl, + isDialogOpen, + onClose, + onResetPasswordClick, + login +}) { const [isLogin, setIsLogin] = useState(false); const [loginStatus, setLoginStatus] = useState({}); const isButtonDisabled = isLogin || !!loginStatus.success; From 89b7d598aa307d25f8a8586b6ff4cf38f76a06f5 Mon Sep 17 00:00:00 2001 From: Shay Cojocaru Date: Sun, 19 Feb 2023 00:40:47 +0200 Subject: [PATCH 14/15] fix: add missing effect --- src/components/Account/SignUp/SignUp.component.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/Account/SignUp/SignUp.component.js b/src/components/Account/SignUp/SignUp.component.js index b147f5252..710638a2f 100644 --- a/src/components/Account/SignUp/SignUp.component.js +++ b/src/components/Account/SignUp/SignUp.component.js @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; import { Formik, ErrorMessage } from 'formik'; @@ -33,6 +33,15 @@ export function SignUp({ isDialogOpen, onClose, intl }) { .finally(() => setIsSigningUp(false)); } + useEffect( + () => { + if (!isDialogOpen) { + setSignUpStatus({}); + } + }, + [isDialogOpen] + ); + return ( From 6679dd389c837ab2eb8604ace293c078e9206364 Mon Sep 17 00:00:00 2001 From: Shay Cojocaru Date: Sun, 19 Feb 2023 01:05:17 +0200 Subject: [PATCH 15/15] fix: revert implementation --- src/components/Account/Activate/Activate.container.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Account/Activate/Activate.container.js b/src/components/Account/Activate/Activate.container.js index b4aea1c01..9d335f8a7 100644 --- a/src/components/Account/Activate/Activate.container.js +++ b/src/components/Account/Activate/Activate.container.js @@ -20,7 +20,8 @@ function ActivateContainer({ .catch(error => setActivationStatus(error)) .finally(() => setIsActivating(false)); }, - [url] + // eslint-disable-next-line react-hooks/exhaustive-deps + [] ); return (