Skip to content

Conversation

@chrisgarrity
Copy link
Contributor

@chrisgarrity chrisgarrity commented Nov 12, 2018

Resolves

Prerequisite for scratchfoundation/scratch-www#2281

Proposed Changes

Moved the tutorial id handling into gui so it works when gui is embedded in www as well as standalone.

This seemed better than duplicating the query handling in www, in order to pass an id to gui.

Note, the ?tutorial=all handling remains in app-state-hoc. Currently it’s only needed in standalone mode for Hour of Code. It’s easy to move into the gui container if we do want it in gui by default.

Question: are there going to be interactions with project save/new... that will lead to ignoring the query string, or otherwise not the results that users expect.

Reason for Changes

Support opening with a tutorial loaded in www.

Test Coverage

Current tests pass - it didn't change functionality, just where it was included so it's available in www.

Try it:
https://chrisgarrity.github.io/scratch-gui/issue/www-2281-tutorials/

Manual testing:

  • /?tutorial=getStarted should open the getting started tutorial
  • Other tutorials should open as well ('name', 'music', 'chase-game', 'clicker-game', 'animations-that-talk')
  • 'animate-an-adventure-game' should load with a default project
  • /?tutorial=all should load with the tutorials library open
  • if the tutorial isn't recognized it should be ignored

Browser Coverage

Check the OS/browser combinations tested (At least 2)

Mac

  • Chrome
  • Firefox
  • Safari

Windows

  • Chrome
  • Firefox
  • Edge

Chromebook

  • Chrome

iPad

  • Safari

Android Tablet

  • Chrome

@benjiwheeler
Copy link
Contributor

benjiwheeler commented Nov 14, 2018

Hm, seems unfortunate that /?tutorial=getStarted shows the "Try it" modal.

Is it possible to detect the presence of a tutorial in the querystring and hide the modal, as we do in hash-parser-hoc?

@benjiwheeler
Copy link
Contributor

https://chrisgarrity.github.io/scratch-gui/issue/www-2281-tutorials/?tutorial=animate-an-adventure-game does not seem to open a starter project for me... am i doing something wrong?

Copy link
Contributor

@benjiwheeler benjiwheeler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is exciting, and I think we might need to talk about how to handle tutorial URLs more broadly... does the presence of a tutorial querystring mean we are currently showing the tutorial? Or, that we start showing it? Do we have to strip it from the URL when the user closes the tutorial?

getIsShowingProject
} from '../reducers/project-state';
import {setProjectTitle} from '../reducers/project-title';
import {detectTutorialId} from '../lib/tutorial-from-url';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to move this url detection to an HOC? Seems like that's the design pattern we're trying to follow, and moving towards.

I think we could do the same componentDidMount logic in the HOC, and it should just work, because gui watches the reducer values already.

What do you think? Partially, I'm thinking forward to our needing to mess with the url even more... seems like an HOC wrapping the whole gui at the top level would be good.

// handle ?tutorial=all for beta
// if we decide to keep this for www, functionality should move to
// setActiveCards in the GUI container
if (tutorialId === 'all') initializedGui = initTutorialLibrary(initializedGui);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should still disable the preview modal if there's a tutorialId @benjiwheeler

@chrisgarrity
Copy link
Contributor Author

The project id is not automatic. The link from code.org has the project id in the URL. To see it you'd need to add #249143200 to the url. Not suppressing the try-it modal is a problem - I'll fix it.

@benjiwheeler
Copy link
Contributor

Thanks, I was able to bring up the project with id and tutorial. But tests are failing...

Moved the tutorial id handling into gui so it works when gui is embedded in www as well as standalone.

This seemed better than adding the same query handling to www, in order to pass an id to gui.

Note, the `?tutorial=all` handling remains in app-state-hoc. Currently it’s only needed in standalone mode for Hour of Code. It’s easy to move into the gui container if we do want it in gui by default.
@chrisgarrity chrisgarrity force-pushed the issue/www-2281-tutorials branch from 719aaf6 to b287cf6 Compare November 14, 2018 20:24
Also pull out `onUpdateReduxDeck` prop out to avoid warning when it’s passed to nested components.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants