From 110ce59cc713824e82baa6d9048f2e2f93bf00b1 Mon Sep 17 00:00:00 2001 From: Benjamin Wheeler Date: Mon, 26 Aug 2019 15:41:32 -0400 Subject: [PATCH 1/3] Revert "Revert "on complete join flow, take user to new project"" --- src/components/navigation/www/navigation.jsx | 1 + src/components/registration/scratch3-registration.jsx | 9 +++++++-- src/redux/navigation.js | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/navigation/www/navigation.jsx b/src/components/navigation/www/navigation.jsx index 7bc3ca663..90d34bcad 100644 --- a/src/components/navigation/www/navigation.jsx +++ b/src/components/navigation/www/navigation.jsx @@ -217,6 +217,7 @@ class Navigation extends React.Component { {this.props.registrationOpen && ( this.props.useScratch3Registration ? ( diff --git a/src/components/registration/scratch3-registration.jsx b/src/components/registration/scratch3-registration.jsx index 03f53d763..c345c168e 100644 --- a/src/components/registration/scratch3-registration.jsx +++ b/src/components/registration/scratch3-registration.jsx @@ -23,17 +23,22 @@ const Registration = ({ ); Registration.propTypes = { + createProjectOnComplete: PropTypes.bool, handleCloseRegistration: PropTypes.func, handleCompleteRegistration: PropTypes.func, isOpen: PropTypes.bool }; -const mapDispatchToProps = dispatch => ({ +Registration.defaultProps = { + createProjectOnComplete: false +}; + +const mapDispatchToProps = (dispatch, ownProps) => ({ handleCloseRegistration: () => { dispatch(navigationActions.setRegistrationOpen(false)); }, handleCompleteRegistration: () => { - dispatch(navigationActions.handleCompleteRegistration()); + dispatch(navigationActions.handleCompleteRegistration(ownProps.createProjectOnComplete)); } }); diff --git a/src/redux/navigation.js b/src/redux/navigation.js index 0e71090ae..957f9d4e7 100644 --- a/src/redux/navigation.js +++ b/src/redux/navigation.js @@ -92,9 +92,10 @@ module.exports.setSearchTerm = searchTerm => ({ searchTerm: searchTerm }); -module.exports.handleCompleteRegistration = () => (dispatch => { +module.exports.handleCompleteRegistration = createProject => (dispatch => { dispatch(sessionActions.refreshSession()); dispatch(module.exports.setRegistrationOpen(false)); + if (createProject) window.location = '/projects/editor/?tutorial=getStarted'; }); module.exports.handleLogIn = (formData, callback) => (dispatch => { From 0ebc168f2167ba7c9bb6ece09ac9c8e936cf9047 Mon Sep 17 00:00:00 2001 From: Ben Wheeler Date: Mon, 26 Aug 2019 15:35:17 -0400 Subject: [PATCH 2/3] comment prop for eslint # Conflicts: # src/components/registration/scratch3-registration.jsx --- src/components/registration/scratch3-registration.jsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/components/registration/scratch3-registration.jsx b/src/components/registration/scratch3-registration.jsx index c345c168e..220c01433 100644 --- a/src/components/registration/scratch3-registration.jsx +++ b/src/components/registration/scratch3-registration.jsx @@ -23,16 +23,13 @@ const Registration = ({ ); Registration.propTypes = { - createProjectOnComplete: PropTypes.bool, + // used in mapDispatchToProps; eslint doesn't understand that this prop is used + createProjectOnComplete: PropTypes.bool, // eslint-disable-line react/no-unused-prop-types handleCloseRegistration: PropTypes.func, handleCompleteRegistration: PropTypes.func, isOpen: PropTypes.bool }; -Registration.defaultProps = { - createProjectOnComplete: false -}; - const mapDispatchToProps = (dispatch, ownProps) => ({ handleCloseRegistration: () => { dispatch(navigationActions.setRegistrationOpen(false)); From 65b6475ed67c3502c085f464790ff1bae07d1f8b Mon Sep 17 00:00:00 2001 From: Ben Wheeler Date: Tue, 27 Aug 2019 12:15:49 -0400 Subject: [PATCH 3/3] smarter handling of handleCompleteRegistration --- src/redux/navigation.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/redux/navigation.js b/src/redux/navigation.js index 957f9d4e7..d8dd5ee31 100644 --- a/src/redux/navigation.js +++ b/src/redux/navigation.js @@ -93,9 +93,11 @@ module.exports.setSearchTerm = searchTerm => ({ }); module.exports.handleCompleteRegistration = createProject => (dispatch => { - dispatch(sessionActions.refreshSession()); - dispatch(module.exports.setRegistrationOpen(false)); - if (createProject) window.location = '/projects/editor/?tutorial=getStarted'; + if (createProject) { + window.location = '/projects/editor/?tutorial=getStarted'; + } else { + dispatch(module.exports.setRegistrationOpen(false)); + } }); module.exports.handleLogIn = (formData, callback) => (dispatch => {