diff --git a/src/containers/tips-library.jsx b/src/containers/tips-library.jsx index 09e34f7faf8633026232a1fb350f191abf12fe3d..7b277136422d44261e340374308644f17868ce4c 100644 --- a/src/containers/tips-library.jsx +++ b/src/containers/tips-library.jsx @@ -35,6 +35,19 @@ class TipsLibrary extends React.PureComponent { ]); } handleItemSelect (item) { + /* + Support tutorials that require specific starter projects. + If a tutorial declares "requiredProjectId", check that the URL contains + it. If it is not, open a new page with this tutorial and project id. + + TODO remove this at first opportunity. If this is still here after HOC2018, + blame Eric R. Andrew is also on record saying "this is temporary". + */ + if (item.requiredProjectId && window.location.href.indexOf(item.requiredProjectId) === -1) { + const urlParams = `?tutorial=${item.urlId}#${item.requiredProjectId}`; + return window.open(window.location.pathname + urlParams, '_blank'); + } + this.props.onActivateDeck(item.id); analytics.event({ category: 'library', @@ -48,7 +61,9 @@ class TipsLibrary extends React.PureComponent { id: id, name: decksLibraryContent[id].name, featured: true, - tags: decksLibraryContent[id].tags + tags: decksLibraryContent[id].tags, + urlId: decksLibraryContent[id].urlId, + requiredProjectId: decksLibraryContent[id].requiredProjectId })); if (!this.props.visible) return null; diff --git a/src/lib/libraries/decks/index.jsx b/src/lib/libraries/decks/index.jsx index 65242b1701bc64648a6baba8c60dacb7a1e4dedf..f44f5fcb215f5c00093159fa50626a42f0042e3f 100644 --- a/src/lib/libraries/decks/index.jsx +++ b/src/lib/libraries/decks/index.jsx @@ -248,6 +248,7 @@ export default { id="gui.howtos.cartoon-network" /> ), + requiredProjectId: '249143200', img: libraryCartoonNetwork, steps: [{ video: 'uz5oz5h9yg'