Repository navigation
In review
In review
Copy link
Description
First of four small issues that add One paragraph at a time to Study: a concept step shows its first paragraph and each tap brings the next. This issue adds only the switch and remembers it. The switch changes nothing on the page yet; the next issue reads it.
Decided
- Study stages only (
/study/{slug}), not the lesson page under Lessons. - Off for everyone until they switch it on.
- Remembered in the browser, like the audio switch (
speech:audioinstatic/core.js). No database column, no server code.
What to build
templates/stage.html: in<div class="stage-hud">, before<span class="hud-step">, add a button:type="button",class="switch",role="switch",aria-checked="false",id="one-paragraph",data-testid="stage-one-paragraph".- Inside it:
<span class="switch-knob" aria-hidden="true"></span>and the label{{ crate::t("guide.play.one_paragraph") }}. - Reuse the existing
.switch/.switch-knobstyles (static/style.css, near line 1403). Look at another.switchintemplates/and copy its markup shape so it looks the same. Add no new switch CSS unless the HUD row needs a wrap rule;.stage-hudmust wrap at phone width (400px) without horizontal scroll.
static/guide.js:onePara()readslocalStorage.getItem("study:one-paragraph") === "1"insidetry/catch(private mode throws; then it isfalse).- On load, set the button's
aria-checkedandroot.dataset.oneParagraph("true"/"false") from it. - On click, flip it, write
"1"or"0"(intry/catch), update both attributes, and dispatchnew CustomEvent("oneparagraph")onrootso the next issue can listen.
- i18n: add
one_paragraphunderguide.play(besidegot_it) in all six files.cargo testfails if one file lacks the key.en:"One paragraph at a time"es:"Un párrafo a la vez"de:"Ein Absatz nach dem anderen"fr:"Un paragraphe à la fois"pt:"Um parágrafo de cada vez"zh:"一次一段"
Done when
- A stage shows the switch beside the step counter, off.
- Clicking it turns it on; reloading the page, or opening another stage, shows it still on.
#stage[data-one-paragraph]and the button'saria-checkedalways agree.- Nothing else on the stage changes.
Not in this issue
Hiding paragraphs, the animation, the e2e spec, docs and changelog (the three issues after this one). Don't run cargo fmt.
Checks
cargo build, then push and read gh pr checks. By eye: ./.dev-start --reset --seed --background, /dev/login, open a Study stage.
Metadata
Metadata
Assignees
Labels
No labels
Activity