Skip to content

Commit c75e11b

Browse files
RickBr0wncatarak
authored andcommitted
Add toast to notify when creating new file. Fixes #1140 (#1147)
* 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
1 parent 5695830 commit c75e11b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

client/components/Nav.jsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Link } from 'react-router';
66
import InlineSVG from 'react-inlinesvg';
77
import classNames from 'classnames';
88
import * as IDEActions from '../modules/IDE/actions/ide';
9+
import * as toastActions from '../modules/IDE/actions/toast';
910
import * as projectActions from '../modules/IDE/actions/project';
1011
import { setAllAccessibleOutput } from '../modules/IDE/actions/preferences';
1112
import { logoutUser } from '../modules/User/actions';
@@ -92,8 +93,12 @@ class Nav extends React.PureComponent {
9293

9394
handleNew() {
9495
if (!this.props.unsavedChanges) {
96+
this.props.showToast(1500);
97+
this.props.setToastText('Opened new sketch.');
9598
this.props.newProject();
9699
} else if (this.props.warnIfUnsavedChanges()) {
100+
this.props.showToast(1500);
101+
this.props.setToastText('Opened new sketch.');
97102
this.props.newProject();
98103
}
99104
this.setDropdown('none');
@@ -624,6 +629,8 @@ class Nav extends React.PureComponent {
624629

625630
Nav.propTypes = {
626631
newProject: PropTypes.func.isRequired,
632+
showToast: PropTypes.func.isRequired,
633+
setToastText: PropTypes.func.isRequired,
627634
saveProject: PropTypes.func.isRequired,
628635
autosaveProject: PropTypes.func.isRequired,
629636
exportProjectAsZip: PropTypes.func.isRequired,
@@ -678,6 +685,7 @@ function mapStateToProps(state) {
678685
const mapDispatchToProps = {
679686
...IDEActions,
680687
...projectActions,
688+
...toastActions,
681689
logoutUser,
682690
setAllAccessibleOutput
683691
};

0 commit comments

Comments
 (0)