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">
<a
className="nav__new"
onClick={props.newProject}
onClick={() => {
if (props.warnIfUnsavedChanges()) {
props.newProject();
}
}}
>
New
</a>

View file

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

View file

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