@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
33import React from 'react' ;
44import { withTranslation } from 'react-i18next' ;
55import { connect } from 'react-redux' ;
6- import { Link , withRouter } from 'react-router' ;
6+ import { Link } from 'react-router-dom ' ;
77import { availableLanguages , languageKeyToLabel } from '../i18n' ;
88import * as IDEActions from '../modules/IDE/actions/ide' ;
99import * as toastActions from '../modules/IDE/actions/toast' ;
@@ -38,12 +38,12 @@ class Nav extends React.PureComponent {
3838 }
3939
4040 handleNew ( ) {
41- const { unsavedChanges, warnIfUnsavedChanges } = this . props ;
41+ const { unsavedChanges } = this . props ;
4242 if ( ! unsavedChanges ) {
4343 this . props . showToast ( 1500 ) ;
4444 this . props . setToastText ( 'Toast.OpenedNewSketch' ) ;
4545 this . props . newProject ( ) ;
46- } else if ( warnIfUnsavedChanges && warnIfUnsavedChanges ( ) ) {
46+ } else if ( window . confirm ( this . props . t ( 'Nav.WarningUnsavedChanges' ) ) ) {
4747 this . props . showToast ( 1500 ) ;
4848 this . props . setToastText ( 'Toast.OpenedNewSketch' ) ;
4949 this . props . newProject ( ) ;
@@ -74,11 +74,10 @@ class Nav extends React.PureComponent {
7474 }
7575
7676 handleShare ( ) {
77- const { username } = this . props . params ;
7877 this . props . showShareModal (
7978 this . props . project . id ,
8079 this . props . project . name ,
81- username
80+ this . props . project . owner . username
8281 ) ;
8382 }
8483
@@ -352,14 +351,14 @@ Nav.propTypes = {
352351 id : PropTypes . string ,
353352 name : PropTypes . string ,
354353 owner : PropTypes . shape ( {
355- id : PropTypes . string
354+ id : PropTypes . string ,
355+ username : PropTypes . string
356356 } )
357357 } ) ,
358358 logoutUser : PropTypes . func . isRequired ,
359359 showShareModal : PropTypes . func . isRequired ,
360360 showErrorModal : PropTypes . func . isRequired ,
361361 unsavedChanges : PropTypes . bool . isRequired ,
362- warnIfUnsavedChanges : PropTypes . func ,
363362 showKeyboardShortcutModal : PropTypes . func . isRequired ,
364363 cmController : PropTypes . shape ( {
365364 tidyCode : PropTypes . func ,
@@ -375,9 +374,6 @@ Nav.propTypes = {
375374 rootFile : PropTypes . shape ( {
376375 id : PropTypes . string . isRequired
377376 } ) . isRequired ,
378- params : PropTypes . shape ( {
379- username : PropTypes . string
380- } ) ,
381377 t : PropTypes . func . isRequired ,
382378 setLanguage : PropTypes . func . isRequired ,
383379 language : PropTypes . string . isRequired ,
@@ -392,10 +388,6 @@ Nav.defaultProps = {
392388 } ,
393389 cmController : { } ,
394390 layout : 'project' ,
395- warnIfUnsavedChanges : undefined ,
396- params : {
397- username : undefined
398- } ,
399391 editorLink : '/'
400392} ;
401393
@@ -421,6 +413,6 @@ const mapDispatchToProps = {
421413} ;
422414
423415export default withTranslation ( ) (
424- withRouter ( connect ( mapStateToProps , mapDispatchToProps ) ( Nav ) )
416+ connect ( mapStateToProps , mapDispatchToProps ) ( Nav )
425417) ;
426418export { Nav as NavComponent } ;
0 commit comments