Creating a New Tutorial for MartyBlocksThis guide explains how to add a new tutorial (lesson) to MartyBlocks.
marty-blocks-lib/replacements/scratch-gui/src/lib/libraries/decks/general-lessons/
- Copy an existing tutorial file (e.g.,
cog-and-marty-dummy.js) and rename it for your new tutorial.## 2. Edit the Tutorial File- Update the exported object:- Change the
id,name,type,urlId,description,img,tags, andcollaboratorfields as needed. - Add or modify the
stepsarray to define the tutorial flow.- Each step can include:
type: e.g., "info", "end"description: Use<FormattedMessage />for i18n support.image: (optional) URL to an image for the step (we use aws bucket).nextStepActions: (optional) UI actions (see other tutorials for examples).expectedCode: (optional) Array of block sequences to check for in the workspace.hint: (optional) Hints for the user.## 3. Add Images- Upload any images referenced in your tutorial to the appropriate S3 bucket or public URL.
- Each step can include:
- Change the
- Reference images in your steps using the
imgorimagefields.## 4. Register the Tutorial- Open:marty-blocks-lib/replacements/scratch-gui/src/lib/libraries/decks/index.jsx - Import your new tutorial at the top.
- Add it to the exported object, e.g.:
import myNewTutorial from './general-lessons/my-new-tutorial'; // ...existing code... export default { ...myNewTutorial, // ...existing code... } ```## 5. Test- Run the app and verify your tutorial appears and works as expected.## 6. Tips- Use `<FormattedMessage />` for all user-facing text for localization.
- Use the
stepsarray to guide users through the tutorial, using actions and hints as needed. - Look at existing tutorials for examples of best practices.---## File Responsibilities Summary**
LessonUIHelper.js** Located at:marty-blocks-lib/replacements/scratch-gui/src/components/lessons/LessonUIHelper.js - Provides static helper methods for UI interactions in tutorials, such as highlighting blocks or elements, animating block movements, and managing highlights.
LessonEngine.jsLocated at:marty-blocks-lib/replacements/scratch-gui/src/components/lessons/LessonEngine.js - Orchestrates the tutorial step logic, handling actions (like highlighting or animating), step transitions, and code evaluation for tutorial progress.
cog-and-marty-dummy.jsLocated at:marty-blocks-lib/replacements/scratch-gui/src/lib/libraries/decks/general-lessons/cog-and-marty-dummy.js - Example tutorial definition file. Exports a tutorial object with metadata and an array of steps, each describing UI actions, hints, and code checks.
index.jsxLocated at:marty-blocks-lib/replacements/scratch-gui/src/lib/libraries/decks/index.jsx - Central registry for all tutorials and how-tos. Imports and aggregates tutorial objects for use in the app's tutorial system.