Skip to content
Snippets Groups Projects
Commit 91e2fc92 authored by Ben Wheeler's avatar Ben Wheeler
Browse files

on showing project without id, tell owner of GUI to set title to default

parent 5fed732e
No related branches found
No related tags found
No related merge requests found
......@@ -433,7 +433,6 @@ GUIComponent.defaultProps = {
isCreating: false,
isShared: false,
loading: false,
onUpdateProjectTitle: () => {},
showComingSoon: false,
stageSizeMode: STAGE_SIZE_MODES.large
};
......
......@@ -9,7 +9,8 @@ import {defineMessages, injectIntl, intlShape} from 'react-intl';
import ErrorBoundaryHOC from '../lib/error-boundary-hoc.jsx';
import {
getIsError,
getIsShowingProject
getIsShowingProject,
getIsShowingWithoutId
} from '../reducers/project-state';
import {setProjectTitle} from '../reducers/project-title';
import {
......@@ -66,6 +67,9 @@ class GUI extends React.Component {
// At this time the project view in www doesn't need to know when a project is unloaded
this.props.onProjectLoaded();
}
if (this.props.isShowingWithoutId && !prevProps.isShowingWithoutId) {
this.props.onUpdateProjectTitle(this.props.intl.formatMessage(messages.defaultProjectTitle));
}
}
setReduxTitle (newTitle) {
if (newTitle === null || typeof newTitle === 'undefined') {
......@@ -126,6 +130,7 @@ GUI.propTypes = {
isLoading: PropTypes.bool,
isScratchDesktop: PropTypes.bool,
isShowingProject: PropTypes.bool,
isShowingWithoutId: PropTypes.bool,
loadingStateVisible: PropTypes.bool,
onProjectLoaded: PropTypes.func,
onSeeCommunity: PropTypes.func,
......@@ -146,6 +151,7 @@ GUI.defaultProps = {
onStorageInit: storageInstance => storageInstance.addOfficialScratchWebStores(),
onProjectLoaded: () => {},
onUpdateProjectId: () => {},
onUpdateProjectTitle: () => {},
onVmInit: (/* vm */) => {}
};
......@@ -166,6 +172,7 @@ const mapStateToProps = state => {
isPlayerOnly: state.scratchGui.mode.isPlayerOnly,
isRtl: state.locales.isRtl,
isShowingProject: getIsShowingProject(loadingState),
isShowingWithoutId: getIsShowingWithoutId(loadingState),
loadingStateVisible: state.scratchGui.modals.loadingProject,
projectId: state.scratchGui.projectState.projectId,
soundsTabVisible: state.scratchGui.editorTab.activeTabIndex === SOUNDS_TAB_INDEX,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment