@@ -13,6 +13,8 @@ import {
1313 getIsShowingProject
1414} from '../reducers/project-state' ;
1515import { setProjectTitle } from '../reducers/project-title' ;
16+ import { detectTutorialId } from '../lib/tutorial-from-url' ;
17+ import { activateDeck } from '../reducers/cards' ;
1618import {
1719 activateTab ,
1820 BLOCKS_TAB_INDEX ,
@@ -47,6 +49,7 @@ class GUI extends React.Component {
4749 componentDidMount ( ) {
4850 this . setReduxTitle ( this . props . projectTitle ) ;
4951 this . props . onStorageInit ( storage ) ;
52+ this . setActiveCards ( detectTutorialId ( ) ) ;
5053 }
5154 componentDidUpdate ( prevProps ) {
5255 if ( this . props . projectId !== prevProps . projectId && this . props . projectId !== null ) {
@@ -65,6 +68,11 @@ class GUI extends React.Component {
6568 this . props . onUpdateReduxProjectTitle ( newTitle ) ;
6669 }
6770 }
71+ setActiveCards ( tutorialId ) {
72+ if ( tutorialId && tutorialId !== 'all' ) {
73+ this . props . onUpdateReduxDeck ( tutorialId ) ;
74+ }
75+ }
6876 render ( ) {
6977 if ( this . props . isError ) {
7078 throw new Error (
@@ -80,6 +88,7 @@ class GUI extends React.Component {
8088 isShowingProject,
8189 onStorageInit,
8290 onUpdateProjectId,
91+ onUpdateReduxDeck,
8392 onUpdateReduxProjectTitle,
8493 projectHost,
8594 projectId,
@@ -119,6 +128,7 @@ GUI.propTypes = {
119128 onStorageInit : PropTypes . func ,
120129 onUpdateProjectId : PropTypes . func ,
121130 onUpdateProjectTitle : PropTypes . func ,
131+ onUpdateReduxDeck : PropTypes . func ,
122132 onUpdateReduxProjectTitle : PropTypes . func ,
123133 previewInfoVisible : PropTypes . bool ,
124134 projectHost : PropTypes . string ,
@@ -169,6 +179,7 @@ const mapDispatchToProps = dispatch => ({
169179 onActivateSoundsTab : ( ) => dispatch ( activateTab ( SOUNDS_TAB_INDEX ) ) ,
170180 onRequestCloseBackdropLibrary : ( ) => dispatch ( closeBackdropLibrary ( ) ) ,
171181 onRequestCloseCostumeLibrary : ( ) => dispatch ( closeCostumeLibrary ( ) ) ,
182+ onUpdateReduxDeck : tutorialId => dispatch ( activateDeck ( tutorialId ) ) ,
172183 onUpdateReduxProjectTitle : title => dispatch ( setProjectTitle ( title ) )
173184} ) ;
174185
0 commit comments