@@ -154,7 +154,7 @@ class MenuBar extends React.Component {
154154 'handleKeyPress' ,
155155 'handleLanguageMouseUp' ,
156156 'handleRestoreOption' ,
157- 'handleSaveToComputer ' ,
157+ 'getSaveToComputerHandler ' ,
158158 'restoreOptionMessage'
159159 ] ) ;
160160 }
@@ -225,7 +225,7 @@ class MenuBar extends React.Component {
225225 event . preventDefault ( ) ;
226226 }
227227 }
228- handleSaveToComputer ( downloadProjectCallback ) {
228+ getSaveToComputerHandler ( downloadProjectCallback ) {
229229 return ( ) => {
230230 this . props . onRequestCloseFile ( ) ;
231231 downloadProjectCallback ( ) ;
@@ -327,11 +327,11 @@ class MenuBar extends React.Component {
327327 [ styles . clickable ] : typeof this . props . onClickLogo !== 'undefined'
328328 } ) }
329329 draggable = { false }
330- src = { scratchLogo }
330+ src = { this . props . logo }
331331 onClick = { this . props . onClickLogo }
332332 />
333333 </ div >
334- < div
334+ { ( this . props . canChangeLanguage ) && ( < div
335335 className = { classNames ( styles . menuBarItem , styles . hoverable , styles . languageMenu ) }
336336 >
337337 < div >
@@ -345,82 +345,86 @@ class MenuBar extends React.Component {
345345 />
346346 </ div >
347347 < LanguageSelector label = { this . props . intl . formatMessage ( ariaMessages . language ) } />
348- </ div >
349- < div
350- className = { classNames ( styles . menuBarItem , styles . hoverable , {
351- [ styles . active ] : this . props . fileMenuOpen
352- } ) }
353- onMouseUp = { this . props . onClickFile }
354- >
355- < FormattedMessage
356- defaultMessage = "File"
357- description = "Text for file dropdown menu"
358- id = "gui.menuBar.file"
359- />
360- < MenuBarMenu
361- className = { classNames ( styles . menuBarMenu ) }
362- open = { this . props . fileMenuOpen }
363- place = { this . props . isRtl ? 'left' : 'right' }
364- onRequestClose = { this . props . onRequestCloseFile }
348+ </ div > ) }
349+ { ( this . props . canManageFiles ) && (
350+ < div
351+ className = { classNames ( styles . menuBarItem , styles . hoverable , {
352+ [ styles . active ] : this . props . fileMenuOpen
353+ } ) }
354+ onMouseUp = { this . props . onClickFile }
365355 >
366- < MenuSection >
367- < MenuItem
368- isRtl = { this . props . isRtl }
369- onClick = { this . handleClickNew }
370- >
371- { newProjectMessage }
372- </ MenuItem >
373- </ MenuSection >
374- { ( this . props . canSave || this . props . canCreateCopy || this . props . canRemix ) && (
356+ < FormattedMessage
357+ defaultMessage = "File"
358+ description = "Text for file dropdown menu"
359+ id = "gui.menuBar.file"
360+ />
361+ < MenuBarMenu
362+ className = { classNames ( styles . menuBarMenu ) }
363+ open = { this . props . fileMenuOpen }
364+ place = { this . props . isRtl ? 'left' : 'right' }
365+ onRequestClose = { this . props . onRequestCloseFile }
366+ >
375367 < MenuSection >
376- { this . props . canSave ? (
377- < MenuItem onClick = { this . handleClickSave } >
378- { saveNowMessage }
379- </ MenuItem >
380- ) : [ ] }
381- { this . props . canCreateCopy ? (
382- < MenuItem onClick = { this . handleClickSaveAsCopy } >
383- { createCopyMessage }
384- </ MenuItem >
385- ) : [ ] }
386- { this . props . canRemix ? (
387- < MenuItem onClick = { this . handleClickRemix } >
388- { remixMessage }
389- </ MenuItem >
390- ) : [ ] }
368+ < MenuItem
369+ isRtl = { this . props . isRtl }
370+ onClick = { this . handleClickNew }
371+ >
372+ { newProjectMessage }
373+ </ MenuItem >
391374 </ MenuSection >
392- ) }
393- < MenuSection >
394- < SBFileUploader
395- canSave = { this . props . canSave }
396- userOwnsProject = { this . props . userOwnsProject }
397- onUpdateProjectTitle = { this . props . onUpdateProjectTitle }
398- >
399- { ( className , renderFileInput , loadProject ) => (
375+ { ( this . props . canSave || this . props . canCreateCopy || this . props . canRemix ) && (
376+ < MenuSection >
377+ { this . props . canSave && (
378+ < MenuItem onClick = { this . handleClickSave } >
379+ { saveNowMessage }
380+ </ MenuItem >
381+ ) }
382+ { this . props . canCreateCopy && (
383+ < MenuItem onClick = { this . handleClickSaveAsCopy } >
384+ { createCopyMessage }
385+ </ MenuItem >
386+ ) }
387+ { this . props . canRemix && (
388+ < MenuItem onClick = { this . handleClickRemix } >
389+ { remixMessage }
390+ </ MenuItem >
391+ ) }
392+ </ MenuSection >
393+ ) }
394+ < MenuSection >
395+ < SBFileUploader
396+ canSave = { this . props . canSave }
397+ userOwnsProject = { this . props . userOwnsProject }
398+ onUpdateProjectTitle = { this . props . onUpdateProjectTitle }
399+ >
400+ { ( className , renderFileInput , handleLoadProject ) => (
401+ < MenuItem
402+ className = { className }
403+ onClick = { handleLoadProject }
404+ >
405+ { /* eslint-disable max-len */ }
406+ { this . props . intl . formatMessage ( sharedMessages . loadFromComputerTitle ) }
407+ { /* eslint-enable max-len */ }
408+ { renderFileInput ( ) }
409+ </ MenuItem >
410+ ) }
411+ </ SBFileUploader >
412+ < SB3Downloader > { ( className , downloadProjectCallback ) => (
400413 < MenuItem
401414 className = { className }
402- onClick = { loadProject }
415+ onClick = { this . getSaveToComputerHandler ( downloadProjectCallback ) }
403416 >
404- { this . props . intl . formatMessage ( sharedMessages . loadFromComputerTitle ) }
405- { renderFileInput ( ) }
417+ < FormattedMessage
418+ defaultMessage = "Save to your computer"
419+ description = "Menu bar item for downloading a project to your computer" // eslint-disable-line max-len
420+ id = "gui.menuBar.downloadToComputer"
421+ />
406422 </ MenuItem >
407- ) }
408- </ SBFileUploader >
409- < SB3Downloader > { ( className , downloadProjectCallback ) => (
410- < MenuItem
411- className = { className }
412- onClick = { this . handleSaveToComputer ( downloadProjectCallback ) }
413- >
414- < FormattedMessage
415- defaultMessage = "Save to your computer"
416- description = "Menu bar item for downloading a project to your computer"
417- id = "gui.menuBar.downloadToComputer"
418- />
419- </ MenuItem >
420- ) } </ SB3Downloader >
421- </ MenuSection >
422- </ MenuBarMenu >
423- </ div >
423+ ) } </ SB3Downloader >
424+ </ MenuSection >
425+ </ MenuBarMenu >
426+ </ div >
427+ ) }
424428 < div
425429 className = { classNames ( styles . menuBarItem , styles . hoverable , {
426430 [ styles . active ] : this . props . editMenuOpen
@@ -698,9 +702,11 @@ MenuBar.propTypes = {
698702 authorThumbnailUrl : PropTypes . string ,
699703 authorUsername : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . bool ] ) ,
700704 autoUpdateProject : PropTypes . func ,
705+ canChangeLanguage : PropTypes . bool ,
701706 canCreateCopy : PropTypes . bool ,
702707 canCreateNew : PropTypes . bool ,
703708 canEditTitle : PropTypes . bool ,
709+ canManageFiles : PropTypes . bool ,
704710 canRemix : PropTypes . bool ,
705711 canSave : PropTypes . bool ,
706712 canShare : PropTypes . bool ,
@@ -717,6 +723,7 @@ MenuBar.propTypes = {
717723 languageMenuOpen : PropTypes . bool ,
718724 locale : PropTypes . string . isRequired ,
719725 loginMenuOpen : PropTypes . bool ,
726+ logo : PropTypes . string ,
720727 onClickAccount : PropTypes . func ,
721728 onClickEdit : PropTypes . func ,
722729 onClickFile : PropTypes . func ,
@@ -751,6 +758,7 @@ MenuBar.propTypes = {
751758} ;
752759
753760MenuBar . defaultProps = {
761+ logo : scratchLogo ,
754762 onShare : ( ) => { }
755763} ;
756764
0 commit comments