Files
speaking-practice/docs/superpowers/specs/2026-06-08-speaking-lab-study-practice-modes-design.md
T

7.3 KiB

Speaking Lab Study Practice Modes Design

Goal

Add lightweight sentence-level practice modes to the study page, using the current video sentence as the learning unit. The page should keep the video and controls on the left as the active practice area, while the transcript on the right remains a browsing and navigation surface.

The confirmed direction is "mode bar + current sentence practice area":

  • Keep practice tied to the current subtitle cue.
  • Put dictation and translation input on the left, below the video control area.
  • Keep the right transcript focused on finding, jumping to, and marking sentences.
  • Remove the cloze / fill-in-the-blank idea from this version.

Scope

Included:

  • Add study modes: 双语, 英文, 中文, 听写, 中译英.
  • Remove 挖空 from the planned feature set.
  • Add a current sentence practice panel in the left control area.
  • Move dictation-style input to the left practice panel.
  • Keep the right transcript panel for subtitle browsing, sentence jumping, practiced status, difficult status, and favorites.
  • Add simple answer checking for input modes.
  • Reset the practice input and feedback when the current sentence or mode changes.
  • Add focused tests for answer normalization and checking helpers.

Excluded:

  • AI scoring or natural-language feedback.
  • Backend changes.
  • Database changes.
  • Persistent per-sentence practice history.
  • New routes or pages.
  • Cloze / fill-in-the-blank practice.
  • Replacing the existing video, recording, or transcript systems.

UX

The study page keeps its current two-column learning layout:

  • Left: video, playback controls, recording controls, current sentence practice panel.
  • Right: transcript list and sentence status controls.

The mode controls should feel like one connected learning mode bar, not separate unrelated buttons. They can reuse the existing subtitle tab pattern if that fits the current markup and styling.

When the user selects a display-only mode:

  • 双语: show English and Chinese for the current sentence and transcript.
  • 英文: emphasize or show English only.
  • 中文: emphasize or show Chinese only.

When the user selects an input mode:

  • 听写: the left practice panel prompts the user to listen and type the current English sentence.
  • 中译英: the left practice panel shows the Chinese sentence and asks the user to type the English sentence.

The input area should sit close to the replay / previous / next controls so the workflow is natural:

  1. Replay the current sentence.
  2. Type an answer.
  3. Check the answer.
  4. Move to the next sentence.

The right transcript should not contain the dictation input. It may still visually reflect the selected mode, but its primary job remains scanning and navigation.

Behavior

Mode changes:

  • Selecting a mode updates the active learning mode immediately.
  • Changing mode clears the practice text and feedback.
  • Display modes do not require an answer field.
  • Input modes show the answer field and check action.

Sentence changes:

  • Moving to previous, replaying, next, or clicking a transcript cue keeps the selected mode.
  • Changing the active cue clears the current practice text and feedback.
  • Existing loop, favorite, practiced, difficult, recording, and replay behavior remains unchanged.

Answer checking:

  • Normalize both the learner answer and expected English before comparison.
  • Ignore letter case.
  • Ignore common punctuation and extra whitespace.
  • If normalized answers match, show a positive "correct" result.
  • If they do not match, show a short mismatch result with the reference English answer.

Empty answer handling:

  • If the user checks an empty answer, show a gentle prompt to type an answer first.
  • Empty answers should not be marked correct.

Missing subtitle data:

  • If the current cue has no English text, disable checking and show that no reference answer is available.
  • If 中译英 has no Chinese text, still allow the mode but show a neutral placeholder instead of breaking layout.

Components

Use existing study page structures where possible:

  • study.html: add or adjust mode controls and the left practice panel markup.
  • app.js: extend the current subtitle mode state into practice modes.
  • styles.css: style the mode bar and practice panel so they match the current focused learning UI.

Recommended helper boundaries in app.js:

  • normalizePracticeAnswer(text): returns a comparison-safe answer string.
  • comparePracticeAnswer(input, expected): returns an object describing empty, correct, or incorrect state.
  • getPracticeViewState(mode, cue): derives prompt text, expected answer availability, and whether input should be visible.

These helpers should be pure where practical so they can be tested without a browser.

Data Flow

The feature should use the current in-browser state only:

  • Active mode is held in the existing page state.
  • Practice input is held in DOM state or lightweight page state.
  • Feedback is recalculated when the user checks an answer.
  • No new API calls are needed.
  • No new localStorage schema is needed for this first version.

The selected material and subtitle cues continue to come from the existing material loading flow.

Visual Design

The practice panel should feel like part of the left control surface, not a separate dashboard card.

Design requirements:

  • Compact enough to keep the video dominant.
  • Clear prompt label for 听写 and 中译英.
  • Stable height so switching modes does not make the page jump heavily.
  • Input, check button, and feedback should fit on desktop and mobile.
  • Feedback should use restrained color states, such as soft green for correct and soft amber or red for mismatch.
  • No decorative backgrounds, large hero styling, or nested cards.

On small screens:

  • The mode bar may wrap.
  • The input and check action may stack.
  • Text must not overflow buttons or overlap adjacent content.

Testing

Automated checks should include:

node --check app.js
node tests\progress-helpers.test.mjs
node tests\admin-file-input.test.mjs

Add a focused Node test for practice helpers, covering:

  • Case-insensitive matching.
  • Punctuation-insensitive matching.
  • Extra whitespace normalization.
  • Empty answer handling.
  • Incorrect answer returns the reference answer.

Manual browser checks:

  1. Open http://127.0.0.1:8000/study.html.
  2. Confirm the mode bar shows 双语, 英文, 中文, 听写, 中译英.
  3. Confirm 挖空 does not appear.
  4. Select 听写 and confirm the input appears on the left below the video controls.
  5. Confirm the right transcript does not contain the dictation input.
  6. Type a matching answer with different case or punctuation and confirm it passes.
  7. Type a wrong answer and confirm the reference English appears.
  8. Move to another sentence and confirm input and feedback reset.
  9. Confirm replay, previous, next, loop, favorite, practiced, difficult, and recording still work.
  10. Check a narrow viewport for wrapping and text overflow.

Acceptance Criteria

  • The study page has five modes: 双语, 英文, 中文, 听写, 中译英.
  • No 挖空 mode exists in the UI or implementation for this version.
  • Dictation input lives in the left control / practice area.
  • The right transcript remains a navigation and status panel.
  • Simple answer checking works without backend or AI dependencies.
  • Existing study page controls continue to work.