@@ -17,6 +17,7 @@ import ProjectWatcher from '../../containers/project-watcher.jsx';
1717import MenuBarMenu from './menu-bar-menu.jsx' ;
1818import { MenuItem , MenuSection } from '../menu/menu.jsx' ;
1919import ProjectTitleInput from './project-title-input.jsx' ;
20+ import AuthorInfo from './author-info.jsx' ;
2021import AccountNav from '../../containers/account-nav.jsx' ;
2122import LoginDropdown from './login-dropdown.jsx' ;
2223import SB3Downloader from '../../containers/sb3-downloader.jsx' ;
@@ -448,17 +449,27 @@ class MenuBar extends React.Component {
448449 < FormattedMessage { ...ariaMessages . tutorials } />
449450 </ div >
450451 < Divider className = { classNames ( styles . divider ) } />
451- < div className = { classNames ( styles . menuBarItem , styles . growable ) } >
452- < MenuBarItemTooltip
453- enable
454- id = "title-field"
455- >
456- < ProjectTitleInput
457- className = { classNames ( styles . titleFieldGrowable ) }
458- onUpdateProjectTitle = { this . props . onUpdateProjectTitle }
459- />
460- </ MenuBarItemTooltip >
461- </ div >
452+ { this . props . canEditTitle ? (
453+ < div className = { classNames ( styles . menuBarItem , styles . growable ) } >
454+ < MenuBarItemTooltip
455+ enable
456+ id = "title-field"
457+ >
458+ < ProjectTitleInput
459+ className = { classNames ( styles . titleFieldGrowable ) }
460+ onUpdateProjectTitle = { this . props . onUpdateProjectTitle }
461+ />
462+ </ MenuBarItemTooltip >
463+ </ div >
464+ ) : ( ( this . props . authorUsername && this . props . authorUsername !== this . props . username ) ? (
465+ < AuthorInfo
466+ className = { styles . authorInfo }
467+ imageUrl = { this . props . authorThumbnailUrl }
468+ projectTitle = { this . props . projectTitle }
469+ userId = { this . props . authorId }
470+ username = { this . props . authorUsername }
471+ />
472+ ) : null ) }
462473 < div className = { classNames ( styles . menuBarItem ) } >
463474 { this . props . canShare ? (
464475 ( this . props . isShowingProject || this . props . isUpdating ) && (
@@ -667,8 +678,12 @@ class MenuBar extends React.Component {
667678
668679MenuBar . propTypes = {
669680 accountMenuOpen : PropTypes . bool ,
681+ authorId : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . bool ] ) ,
682+ authorThumbnailUrl : PropTypes . string ,
683+ authorUsername : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . bool ] ) ,
670684 canCreateCopy : PropTypes . bool ,
671685 canCreateNew : PropTypes . bool ,
686+ canEditTitle : PropTypes . bool ,
672687 canRemix : PropTypes . bool ,
673688 canSave : PropTypes . bool ,
674689 canShare : PropTypes . bool ,
@@ -704,6 +719,7 @@ MenuBar.propTypes = {
704719 onShare : PropTypes . func ,
705720 onToggleLoginOpen : PropTypes . func ,
706721 onUpdateProjectTitle : PropTypes . func ,
722+ projectTitle : PropTypes . string ,
707723 renderLogin : PropTypes . func ,
708724 sessionExists : PropTypes . bool ,
709725 showComingSoon : PropTypes . bool ,
@@ -726,6 +742,7 @@ const mapStateToProps = state => {
726742 isShowingProject : getIsShowingProject ( loadingState ) ,
727743 languageMenuOpen : languageMenuOpen ( state ) ,
728744 loginMenuOpen : loginMenuOpen ( state ) ,
745+ projectTitle : state . scratchGui . projectTitle ,
729746 sessionExists : state . session && typeof state . session . session !== 'undefined' ,
730747 username : user ? user . username : null
731748 } ;
0 commit comments