Add multi-stage module support with progressive completion tracking - #2
Merged
Conversation
Introduces "multistage" as a new ModuleType alongside "lessons". Multi-stage modules present the module itself as a single ordered journey: stages are gated by their tests, code carries forward between stages (with optional per-stage Starter.java for resets), and progress persists as JSON in the existing UserProgress.code column. - lib/types.ts: ModuleType, Stage, MultiStageModuleData, MultiStageProgressState - lib/lessons.ts: type-aware loader, getMultiStageModuleData, authoring validation - app/lessons/[moduleSlug]/page.tsx + MultiStageModulePage client component - app/lessons/[moduleSlug]/[lessonSlug] redirects multi-stage modules to /lessons/<slug> - components/lesson/ModuleStageStepper - Sidebar branches on module.type, rendering stage checklist for multi-stage - /api/progress validates v2 JSON payloads, keeps legacy strings working - /api/analytics/event accepts stage_complete (new enum value + migration) - Converts 01-getting-started to multi-stage: module-level Starter/Solution, per-stage Starter.java for independent OpModes, stage.json per stage
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Sidebar: unlock any stage at or before saved currentStage so stage 0 is reachable from an unvisited multi-stage module (previously all stage links were disabled until the user was already inside). - Stepper: replace wrapping pill row with a single horizontal track that auto-centers the current stage with a slide animation on advance; no manual scroll or jump interaction.
- Unlock stages based on completions (maxCompleted+1) rather than the transient currentStage, so navigating backward never re-locks a stage you already advanced past. - React to ?stage= changes after mount so sidebar links actually swap the displayed stage instead of just updating the URL. - Dispatch ftc-tests-updated when module state is persisted so the sidebar reflects advancement immediately. - Derive sidebar isCurrent from the URL on the active module to avoid a styling flicker between navigation and localStorage write.
…ices - Prioritize carry-forward over per-stage Starter.java so each stage builds on the learner's prior code by default. - Register testMotor on the servo-control stage test and testServo on the telemetry stage test so carried-forward code referencing earlier devices executes instead of throwing before assertions.
- Add content/lessons/_sections.json declaring 4 sections: The Basics, Sensors & Feedback, Autonomy & Control, Advanced Systems. - getModuleSections() loader resolves slugs in declared order, with an auto 'Other' bucket for unlisted modules. - Sidebar and ProgressPage iterate sections and render a small header above each group; flatten modules internally so progress lookup behavior is unchanged. feat(state-machines): convert module to multi-stage Two stages with carry-forward priority, module-level Starter/Solution. chore: remove multithreading module and curriculum intro section Also bypass generateMetadata for multistage modules to avoid ENOENT on old lesson URLs, drop unused brace-expansion override, and clear a stale eslint-disable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a new "multi-stage" module type that allows lessons to be structured as sequential stages with individual test validation and completion tracking, rather than separate lessons. Users progress through stages linearly, with code persistence per stage and the ability to view solutions.
Key Changes
New Multi-Stage Module Type: Added
ModuleTypeenum ("lessons" | "multistage") to support two module structures"type": "multistage"in_module.jsonstage.jsonmetadata instead of lesson foldersMultiStageModulePage Component: New full-featured editor page for multi-stage modules
?stage=NURL parameterStage Progression System:
Sidebar Enhancements:
Layersicon and expandable stage listModuleStageStepper Component: Visual progress indicator showing all stages
Analytics & Persistence:
stage_completeevent type for tracking stage progressionMultiStageProgressStateschema (v2) stores: currentStage, perStageCode, completedStagesisMultiStageProgressState()ensures data integrityContent Structure:
stage.json(metadata),content.mdx,Test.java, optionalStarter.java/Solution.javaStarter.javaandSolution.javaserve as defaultsRoute Handling:
/lessons/[moduleSlug]now routes to MultiStageModulePage for multi-stage modulesNotable Implementation Details
https://claude.ai/code/session_01W5AZ6xRSdbJ7GzoHnUUAdZ