@@ -7,7 +7,7 @@ import decksLibraryContent from '../lib/libraries/decks/index.jsx';
77import tutorialTags from '../lib/libraries/tutorial-tags' ;
88
99import analytics from '../lib/analytics' ;
10- import { notScratchDesktop } from '../lib/isScratchDesktop' ;
10+ import { isScratchDesktop } from '../lib/isScratchDesktop' ;
1111
1212import LibraryComponent from '../components/library/library.jsx' ;
1313
@@ -63,13 +63,24 @@ class TipsLibrary extends React.PureComponent {
6363 render ( ) {
6464 const decksLibraryThumbnailData = Object . keys ( decksLibraryContent )
6565 . filter ( id => {
66- if ( notScratchDesktop ( ) ) return true ; // Do not filter anything in online editor
66+ /**
67+ * Scratch desktop can't support project and video-only tutorials.
68+ * NGP can't support project tutorials.
69+ * The online editor, conversely, should show all tutorials.
70+ */
71+
6772 const deck = decksLibraryContent [ id ] ;
68- // Scratch Desktop doesn't want tutorials with `requiredProjectId`
69- if ( Object . prototype . hasOwnProperty . call ( deck , 'requiredProjectId' ) ) return false ;
70- // Scratch Desktop should not load tutorials that are _only_ videos
71- if ( deck . steps . filter ( s => s . title ) . length === 0 ) return false ;
72- // Allow any other tutorials
73+ const isProjectTutorial = Object . prototype . hasOwnProperty . call ( deck , 'requiredProjectId' ) ;
74+ const isVideoOnlyTutorial = decksLibraryContent [ id ] . steps . filter ( s => s . title ) . length === 0 ;
75+
76+ if ( isProjectTutorial && ( this . props . hideTutorialProjects || isScratchDesktop ( ) ) ) {
77+ return false ;
78+ }
79+
80+ if ( isVideoOnlyTutorial && isScratchDesktop ( ) ) {
81+ return false ;
82+ }
83+
7384 return true ;
7485 } )
7586 . map ( id => ( {
@@ -106,7 +117,8 @@ TipsLibrary.propTypes = {
106117 onActivateDeck : PropTypes . func . isRequired ,
107118 onRequestClose : PropTypes . func ,
108119 projectId : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . number ] ) ,
109- visible : PropTypes . bool
120+ visible : PropTypes . bool ,
121+ hideTutorialProjects : PropTypes . bool
110122} ;
111123
112124const mapStateToProps = state => ( {
0 commit comments