handle many modes of new project creation#3391
handle many modes of new project creation#3391benjiwheeler merged 3 commits intoscratchfoundation:developfrom
Conversation
92c9228 to
d3494b4
Compare
| } | ||
|
|
||
| SBFileUploader.propTypes = { | ||
| canSave: PropTypes.bool, // eslint-disable-line react/no-unused-prop-types |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
| componentWillReceiveProps (nextProps) { | ||
| if (this.props.projectTitle !== nextProps.projectTitle) { | ||
| this.props.onUpdateReduxProjectTitle(nextProps.projectTitle); | ||
| setReduxTitle (newTitle) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
src/lib/project-saver-hoc.jsx
Outdated
| import storage from '../lib/storage'; | ||
| import { | ||
| LoadingStates, | ||
| canNowCreateNew, |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
src/lib/project-saver-hoc.jsx
Outdated
| if (this.props.canSave && this.props.isShowingWithoutId && | ||
| (!prevProps.canSave || !prevProps.isShowingWithoutId)) { | ||
| // create the project | ||
| this.props.canNowCreateNew(); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
| } | ||
| componentDidUpdate (prevProps) { | ||
| if (this.props.projectId !== prevProps.projectId && this.props.projectId !== null) { | ||
| this.props.onUpdateProjectId(this.props.projectId); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
| const DONE_LOADING_VM_NEW_DEFAULT = 'scratch-gui/project-state/DONE_LOADING_VM_NEW_DEFAULT'; | ||
| const DONE_LOADING_VM_NEW_DEFAULT_TO_SAVE = 'scratch-gui/project-state/DONE_LOADING_VM_NEW_DEFAULT_TO_SAVE'; | ||
| const DONE_LOADING_VM_FILE_UPLOAD = 'scratch-gui/project-state/DONE_LOADING_VM_FILE_UPLOAD'; | ||
| const DONE_LOADING_VM_WITHOUT_ID = 'scratch-gui/project-state/DONE_LOADING_VM_WITHOUT_ID'; |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
| ERROR: null, | ||
| FETCHING_WITH_ID: null, | ||
| FETCHING_NEW_DEFAULT: null, | ||
| FETCHING_NEW_DEFAULT_TO_SAVE: null, |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
src/reducers/project-state.js
Outdated
| } | ||
| return state; | ||
| case DONE_LOADING_VM_NEW_DEFAULT: | ||
| case DONE_LOADING_VM_TO_CREATE: |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
| type: DONE_LOADING_VM_WITH_ID | ||
| }; | ||
| case LoadingState.LOADING_VM_FILE_UPLOAD: | ||
| if (canSave) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
18f1530 to
1d218ad
Compare
responding to canSave without needing canSaveNew prop removed canSaveNew added default for onUpdateProjectId removed conflict files erroneously added don't pass down onError got tests passing better creating and saving logic and names
1d218ad to
b0c4bee
Compare
|
Rebased on top of develop and added the changes to project-saver-hoc that we discussed. Also removed the unused action from project-state reducer, and added tests for project-saver-hoc. |
rschamp
left a comment
There was a problem hiding this comment.
Tests are still failing.
src/reducers/project-state.js
Outdated
| } | ||
| return state; | ||
| case DONE_LOADING_VM_NEW_DEFAULT: | ||
| case DONE_LOADING_VM_TO_CREATE: |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
src/lib/project-saver-hoc.jsx
Outdated
| import storage from '../lib/storage'; | ||
| import { | ||
| LoadingStates, | ||
| canNowCreateNew, |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Needs scratchfoundation/scratch-www#2197 to work
Handles several states in which the user should be able to create a new project:
And, one state in which the project should be automatically saved:
8. User creates a project; then logs out. Later, the user opens project in editor; makes changes; realizes isn't logged in, so logs in; project should automatically save.