@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
import React from 'react' ;
4
4
import { withTranslation } from 'react-i18next' ;
5
5
import { connect } from 'react-redux' ;
6
- import { Link , withRouter } from 'react-router' ;
6
+ import { Link } from 'react-router-dom ' ;
7
7
import { availableLanguages , languageKeyToLabel } from '../i18n' ;
8
8
import * as IDEActions from '../modules/IDE/actions/ide' ;
9
9
import * as toastActions from '../modules/IDE/actions/toast' ;
@@ -37,12 +37,12 @@ class Nav extends React.PureComponent {
37
37
}
38
38
39
39
handleNew ( ) {
40
- const { unsavedChanges, warnIfUnsavedChanges } = this . props ;
40
+ const { unsavedChanges } = this . props ;
41
41
if ( ! unsavedChanges ) {
42
42
this . props . showToast ( 1500 ) ;
43
43
this . props . setToastText ( 'Toast.OpenedNewSketch' ) ;
44
44
this . props . newProject ( ) ;
45
- } else if ( warnIfUnsavedChanges && warnIfUnsavedChanges ( ) ) {
45
+ } else if ( window . confirm ( this . props . t ( 'Nav.WarningUnsavedChanges' ) ) ) {
46
46
this . props . showToast ( 1500 ) ;
47
47
this . props . setToastText ( 'Toast.OpenedNewSketch' ) ;
48
48
this . props . newProject ( ) ;
@@ -73,11 +73,10 @@ class Nav extends React.PureComponent {
73
73
}
74
74
75
75
handleShare ( ) {
76
- const { username } = this . props . params ;
77
76
this . props . showShareModal (
78
77
this . props . project . id ,
79
78
this . props . project . name ,
80
- username
79
+ this . props . project . owner . username
81
80
) ;
82
81
}
83
82
@@ -351,14 +350,14 @@ Nav.propTypes = {
351
350
id : PropTypes . string ,
352
351
name : PropTypes . string ,
353
352
owner : PropTypes . shape ( {
354
- id : PropTypes . string
353
+ id : PropTypes . string ,
354
+ username : PropTypes . string
355
355
} )
356
356
} ) ,
357
357
logoutUser : PropTypes . func . isRequired ,
358
358
showShareModal : PropTypes . func . isRequired ,
359
359
showErrorModal : PropTypes . func . isRequired ,
360
360
unsavedChanges : PropTypes . bool . isRequired ,
361
- warnIfUnsavedChanges : PropTypes . func ,
362
361
showKeyboardShortcutModal : PropTypes . func . isRequired ,
363
362
cmController : PropTypes . shape ( {
364
363
tidyCode : PropTypes . func ,
@@ -374,9 +373,6 @@ Nav.propTypes = {
374
373
rootFile : PropTypes . shape ( {
375
374
id : PropTypes . string . isRequired
376
375
} ) . isRequired ,
377
- params : PropTypes . shape ( {
378
- username : PropTypes . string
379
- } ) ,
380
376
t : PropTypes . func . isRequired ,
381
377
setLanguage : PropTypes . func . isRequired ,
382
378
language : PropTypes . string . isRequired ,
@@ -391,10 +387,6 @@ Nav.defaultProps = {
391
387
} ,
392
388
cmController : { } ,
393
389
layout : 'project' ,
394
- warnIfUnsavedChanges : undefined ,
395
- params : {
396
- username : undefined
397
- } ,
398
390
editorLink : '/'
399
391
} ;
400
392
@@ -420,6 +412,6 @@ const mapDispatchToProps = {
420
412
} ;
421
413
422
414
export default withTranslation ( ) (
423
- withRouter ( connect ( mapStateToProps , mapDispatchToProps ) ( Nav ) )
415
+ connect ( mapStateToProps , mapDispatchToProps ) ( Nav )
424
416
) ;
425
417
export { Nav as NavComponent } ;
0 commit comments