Skip to content

Adaptive player: panels, questions, saved progress - #75364

Closed
lfryemason wants to merge 3 commits into
lc/adaptive-state-apifrom
lc/adaptive-player
Closed

lfryemason wants to merge 3 commits into
lc/adaptive-state-apifrom
lc/adaptive-player

Conversation

@lfryemason

@lfryemason lfryemason commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Frontend half of the Adaptive player. Stacked on #75363 (the state save routes) and #75305 (the level type scaffolding).

Turns the Adaptive scaffolding into a working Lab2 player for the content format in apps/src/adaptive/types.ts. A lesson is a list of steps played in array order, with next to jump or end early. Two step kinds so far:

  • panels: a sequence of captions, each with an optional image.
  • question: multiple choice, one question at a time, optionally multi-select. A question with any option marked correct gates progression until the chosen set matches exactly; one with none records the answer and moves on. dontKnowEnabled adds an "I don't know" button that records a dontKnow failure, reveals the correct options, and lets the student continue.

Player state (position, path, completed steps, answers, finished flag) lives in an RTK slice. It saves on every step completion through the routes in #75363 and restores on load. Nothing is saved when the level is viewed outside a unit. Completing a step posts an attempted result through the Lab2 milestone path, and the last step hands off to the standard continue flow, which posts ALL_PASS.

apps/src/adaptive/README.md documents the content format and state handling.

Commits

Review commit by commit. The first is a byte-for-byte copy so the second shows exactly what was kept from the hackathon.

  1. Copy hackathon question flow into adaptive. Verbatim copies from sanchit/hackathon, moved from apps/src/aiLessons into apps/src/adaptive with no edits: QuestionFlow.tsx, types.ts, studentInputs.ts, the stylesheet, and the QuestionFlow test. This commit does not build on its own, since it imports hackathon modules that were not brought over. Only the PR head runs in CI.
  2. Adaptive player: panels, questions, saved progress. The port. Drops free response, scale questions, branch options, recommendations, the LLM judge and the StudentInputs wrapper from the question flow; keeps the question and pill button styles and drops the rest of the hackathon page. Adds PanelsStep, the redux slice, the progress API client, the AdaptiveView wiring, and tests. sample.json gains a question step exercising every option shape.
  3. Add dontKnowEnabled to multiple choice questions. The "I don't know" flow described above, with four tests.

Links

Testing story

Unit tests under apps/test/unit/adaptive/: QuestionFlowTest.tsx (11 tests: ungraded and graded flow, multi-select grading, attempt counting, progress dots, and the dontKnow paths), adaptiveReduxTest.ts, and typesTest.ts. Run with:

cd apps && yarn test:unit test/unit/adaptive/QuestionFlowTest.tsx

Typecheck and lint pass on the PR head. Not yet played through in a browser on this branch: the adaptive-dev unit with sample.json is the place to do that, checking that state restores on reload, wrong answers shake and block, and "I don't know" reveals and continues.

@lfryemason
lfryemason added this pull request to stack #75365 September 17, 2026 18:00
Byte-for-byte copies from sanchit/hackathon, moved from apps/src/aiLessons
into apps/src/adaptive with no other edits, so the next commit's diff
shows exactly what the Adaptive port keeps and drops:

  aiLessons/QuestionFlow.tsx       -> adaptive/QuestionFlow.tsx
  aiLessons/types.ts               -> adaptive/types.ts
  aiLessons/studentInputs.ts       -> adaptive/studentInputs.ts
  aiLessons/aiLessons.module.scss  -> adaptive/adaptiveView.module.scss
  test/unit/aiLessons/QuestionFlowTest.tsx
                                   -> test/unit/adaptive/QuestionFlowTest.tsx

This commit does not build: the copied files import hackathon modules
that were not brought over. Lint is skipped for the same reason.
Turn the Adaptive scaffolding into a working Lab2 player for the content
format in types.ts: a lesson is a list of steps played in array order,
with `next` to jump or end early. Two step kinds so far, panels
(captions with optional images) and question (multiple choice, one at a
time, optionally multi-select, graded when any option is marked correct).

Cut the hackathon question flow down to what Adaptive needs. Gone are
free response, scale questions, branch options, recommendations, the LLM
judge, and the StudentInputs wrapper; AnswerRecord moves into types.ts
and keeps only the fields the player writes. The stylesheet keeps the
question and pill button rules and drops the rest of the hackathon page.

Player state (position, path, completed steps, answers, finished flag)
lives in an RTK slice. It saves on every step completion through
/user_levels/adaptive_state and restores on load; nothing is saved when
the level is viewed outside a unit. Completing a step posts an attempted
result through the Lab2 milestone path, and the last step hands off to
the standard continue flow, which posts ALL_PASS.

sample.json gains a question step exercising every option shape.
A graded question with dontKnowEnabled shows an "I don't know" button
next to Next. Choosing it records an answer with the new dontKnow
outcome, which is a failure like incorrect and keeps whatever the student
had selected, then tints every correct option green, any wrong selection
red, and names the correct answer in a status line so the reveal does not
rest on color alone. The options lock and Next simply advances, so a
dontKnow cannot be turned into a correct after seeing the answer.

Ungraded questions ignore the flag. sample.json turns it on for the
paragraph question.
@lfryemason lfryemason changed the title lc/adaptive player Adaptive player: panels, questions, saved progress Sep 17, 2026
@lfryemason lfryemason closed this Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant