This commit is contained in:
Cassie Tarakajian 2017-01-05 15:27:57 -05:00
parent 3ba03d709a
commit 074f5b35b1
3 changed files with 10 additions and 2 deletions

View file

@ -8,7 +8,11 @@ function Nav(props) {
<li className="nav__item"> <li className="nav__item">
<a <a
className="nav__new" className="nav__new"
onClick={props.newProject} onClick={() => {
if (props.warnIfUnsavedChanges()) {
props.newProject();
}
}}
> >
New New
</a> </a>

View file

@ -143,7 +143,9 @@ export function resetProject() {
} }
export function newProject() { export function newProject() {
setTimeout(() => {
browserHistory.push('/'); browserHistory.push('/');
}, 0);
return resetProject(); return resetProject();
} }

View file

@ -191,6 +191,7 @@ class IDEView extends React.Component {
return false; return false;
} }
this.props.setUnsavedChanges(false); this.props.setUnsavedChanges(false);
return true;
} }
} }
@ -209,6 +210,7 @@ class IDEView extends React.Component {
stopSketch={this.props.stopSketch} stopSketch={this.props.stopSketch}
showShareModal={this.props.showShareModal} showShareModal={this.props.showShareModal}
openForceAuthentication={this.props.openForceAuthentication} openForceAuthentication={this.props.openForceAuthentication}
warnIfUnsavedChanges={this.warnIfUnsavedChanges}
/> />
<Toolbar <Toolbar
className="Toolbar" className="Toolbar"