* Add toast to notify when creating new file * Add toast for opposite conditional #1147 * Replaced New file created with New sketch created * re #1140, change copy to 'opened new sketch' to make it clear that the new sketch isn't saved
This commit is contained in:
parent
5695830361
commit
c75e11b631
1 changed files with 8 additions and 0 deletions
|
@ -6,6 +6,7 @@ import { Link } from 'react-router';
|
||||||
import InlineSVG from 'react-inlinesvg';
|
import InlineSVG from 'react-inlinesvg';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import * as IDEActions from '../modules/IDE/actions/ide';
|
import * as IDEActions from '../modules/IDE/actions/ide';
|
||||||
|
import * as toastActions from '../modules/IDE/actions/toast';
|
||||||
import * as projectActions from '../modules/IDE/actions/project';
|
import * as projectActions from '../modules/IDE/actions/project';
|
||||||
import { setAllAccessibleOutput } from '../modules/IDE/actions/preferences';
|
import { setAllAccessibleOutput } from '../modules/IDE/actions/preferences';
|
||||||
import { logoutUser } from '../modules/User/actions';
|
import { logoutUser } from '../modules/User/actions';
|
||||||
|
@ -92,8 +93,12 @@ class Nav extends React.PureComponent {
|
||||||
|
|
||||||
handleNew() {
|
handleNew() {
|
||||||
if (!this.props.unsavedChanges) {
|
if (!this.props.unsavedChanges) {
|
||||||
|
this.props.showToast(1500);
|
||||||
|
this.props.setToastText('Opened new sketch.');
|
||||||
this.props.newProject();
|
this.props.newProject();
|
||||||
} else if (this.props.warnIfUnsavedChanges()) {
|
} else if (this.props.warnIfUnsavedChanges()) {
|
||||||
|
this.props.showToast(1500);
|
||||||
|
this.props.setToastText('Opened new sketch.');
|
||||||
this.props.newProject();
|
this.props.newProject();
|
||||||
}
|
}
|
||||||
this.setDropdown('none');
|
this.setDropdown('none');
|
||||||
|
@ -624,6 +629,8 @@ class Nav extends React.PureComponent {
|
||||||
|
|
||||||
Nav.propTypes = {
|
Nav.propTypes = {
|
||||||
newProject: PropTypes.func.isRequired,
|
newProject: PropTypes.func.isRequired,
|
||||||
|
showToast: PropTypes.func.isRequired,
|
||||||
|
setToastText: PropTypes.func.isRequired,
|
||||||
saveProject: PropTypes.func.isRequired,
|
saveProject: PropTypes.func.isRequired,
|
||||||
autosaveProject: PropTypes.func.isRequired,
|
autosaveProject: PropTypes.func.isRequired,
|
||||||
exportProjectAsZip: PropTypes.func.isRequired,
|
exportProjectAsZip: PropTypes.func.isRequired,
|
||||||
|
@ -678,6 +685,7 @@ function mapStateToProps(state) {
|
||||||
const mapDispatchToProps = {
|
const mapDispatchToProps = {
|
||||||
...IDEActions,
|
...IDEActions,
|
||||||
...projectActions,
|
...projectActions,
|
||||||
|
...toastActions,
|
||||||
logoutUser,
|
logoutUser,
|
||||||
setAllAccessibleOutput
|
setAllAccessibleOutput
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue