@@ -154,7 +154,7 @@ class MenuBar extends React.Component {
154
154
'handleKeyPress' ,
155
155
'handleLanguageMouseUp' ,
156
156
'handleRestoreOption' ,
157
- 'handleSaveToComputer ' ,
157
+ 'getSaveToComputerHandler ' ,
158
158
'restoreOptionMessage'
159
159
] ) ;
160
160
}
@@ -225,7 +225,7 @@ class MenuBar extends React.Component {
225
225
event . preventDefault ( ) ;
226
226
}
227
227
}
228
- handleSaveToComputer ( downloadProjectCallback ) {
228
+ getSaveToComputerHandler ( downloadProjectCallback ) {
229
229
return ( ) => {
230
230
this . props . onRequestCloseFile ( ) ;
231
231
downloadProjectCallback ( ) ;
@@ -327,11 +327,11 @@ class MenuBar extends React.Component {
327
327
[ styles . clickable ] : typeof this . props . onClickLogo !== 'undefined'
328
328
} ) }
329
329
draggable = { false }
330
- src = { scratchLogo }
330
+ src = { this . props . logo }
331
331
onClick = { this . props . onClickLogo }
332
332
/>
333
333
</ div >
334
- < div
334
+ { ( this . props . canChangeLanguage ) && ( < div
335
335
className = { classNames ( styles . menuBarItem , styles . hoverable , styles . languageMenu ) }
336
336
>
337
337
< div >
@@ -345,82 +345,86 @@ class MenuBar extends React.Component {
345
345
/>
346
346
</ div >
347
347
< 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 }
365
355
>
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
+ >
375
367
< 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 >
391
374
</ 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 ) => (
400
413
< MenuItem
401
414
className = { className }
402
- onClick = { loadProject }
415
+ onClick = { this . getSaveToComputerHandler ( downloadProjectCallback ) }
403
416
>
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
+ />
406
422
</ 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
+ ) }
424
428
< div
425
429
className = { classNames ( styles . menuBarItem , styles . hoverable , {
426
430
[ styles . active ] : this . props . editMenuOpen
@@ -698,9 +702,11 @@ MenuBar.propTypes = {
698
702
authorThumbnailUrl : PropTypes . string ,
699
703
authorUsername : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . bool ] ) ,
700
704
autoUpdateProject : PropTypes . func ,
705
+ canChangeLanguage : PropTypes . bool ,
701
706
canCreateCopy : PropTypes . bool ,
702
707
canCreateNew : PropTypes . bool ,
703
708
canEditTitle : PropTypes . bool ,
709
+ canManageFiles : PropTypes . bool ,
704
710
canRemix : PropTypes . bool ,
705
711
canSave : PropTypes . bool ,
706
712
canShare : PropTypes . bool ,
@@ -717,6 +723,7 @@ MenuBar.propTypes = {
717
723
languageMenuOpen : PropTypes . bool ,
718
724
locale : PropTypes . string . isRequired ,
719
725
loginMenuOpen : PropTypes . bool ,
726
+ logo : PropTypes . string ,
720
727
onClickAccount : PropTypes . func ,
721
728
onClickEdit : PropTypes . func ,
722
729
onClickFile : PropTypes . func ,
@@ -751,6 +758,7 @@ MenuBar.propTypes = {
751
758
} ;
752
759
753
760
MenuBar . defaultProps = {
761
+ logo : scratchLogo ,
754
762
onShare : ( ) => { }
755
763
} ;
756
764
0 commit comments