diff --git a/src/components/menu-bar/menu-bar.jsx b/src/components/menu-bar/menu-bar.jsx
index 3702f5996..dda83cd37 100644
--- a/src/components/menu-bar/menu-bar.jsx
+++ b/src/components/menu-bar/menu-bar.jsx
@@ -21,6 +21,7 @@ import DeletionRestorer from '../../containers/deletion-restorer.jsx';
import TurboMode from '../../containers/turbo-mode.jsx';
import {openTipsLibrary} from '../../reducers/modals';
+import {ProjectState, stepTowardsNewProject} from '../../reducers/project-id';
import {setPlayer} from '../../reducers/mode';
import {
openAccountMenu,
@@ -131,6 +132,21 @@ class MenuBar extends React.Component {
]);
this.state = {projectSaveInProgress: false};
}
+ componentWillReceiveProps (newProps) {
+ // if we're no longer showing the project (loading, or whatever), close menus
+ if (!newProps.isShowingProject && this.props.isShowingProject) {
+ this.props.onRequestCloseFile();
+ this.props.onRequestCloseEdit();
+ }
+ // if we're now saving, show save in progress
+ if (newProps.isSavingWithId && !this.props.isSavingWithId) {
+ this.setState({projectSaveInProgress: true});
+ }
+ // if we're no longer saving, don't show save in progress
+ if (!newProps.isSavingWithId && this.props.isSavingWithId) {
+ this.setState({projectSaveInProgress: false});
+ }
+ }
handleLanguageMouseUp (e) {
if (!this.props.languageMenuOpen) {
this.props.onClickLanguage(e);
@@ -142,23 +158,27 @@ class MenuBar extends React.Component {
this.props.onRequestCloseEdit();
};
}
+ // NOTE: not using updateFun currently
+ // NOTE: need some sort of reducer or some place to do saves, besides a component.
+ // then it can listen for state changes into saving, and do them.
handleNewProject (updateFun) {
return () => {
- this.props.onRequestCloseFile();
- if (this.props.userOwnsProject) {
- this.setState({projectSaveInProgress: true},
- () => {
- updateFun().then(() => {
- this.props.onRequestNewProject(() => {
- this.setState({projectSaveInProgress: false});
- });
- });
- }
- );
- } else {
- this.props.onRequestNewProject();
- }
+ this.props.stepTowardsNewProject();
};
+ // if (this.props.userOwnsProject) {
+ // this.setState({projectSaveInProgress: true},
+ // () => {
+ // updateFun().then(() => {
+ // this.props.onRequestNewProject(() => {
+ // this.setState({projectSaveInProgress: false});
+ // });
+ // });
+ // }
+ // );
+ // } else {
+ // this.props.onRequestNewProject();
+ // }
+ // };
}
handleUpdateProject (updateFun) {
return () => {
@@ -284,11 +304,12 @@ class MenuBar extends React.Component {
place={this.props.isRtl ? 'left' : 'right'}
onRequestClose={this.props.onRequestCloseFile}
>
-
- {(saveProject, updateProject, createProject) => (
+ {/*
+ {(downloadProject, updateProject, createProject) => ( */}
- )}
-
+ {/* )}
+ */}
- {(saveProject, updateProject) => (
+ {(downloadProject, updateProject) => (
this.props.canUpdateProject && this.props.userOwnsProject ? (
)}
- {saveProject => (
+ {downloadProject => (