From bfe9ad05e6b75ff281c59295ccb14720fe22813d Mon Sep 17 00:00:00 2001 From: Kateryna <10474869+krambertech@users.noreply.github.com> Date: Fri, 27 Nov 2026 18:14:23 +0200 Subject: [PATCH 1/5] feat(site): end Estonian lessons without a repeat drill; make audio pausable - Lessons no longer end on a ten-question drill of what they just asked. A lesson whose drill bank asks a kind of question its own quizzes don't (writing what you hear, changing a sentence, making a form, asking the question) ends with up to six of those as its last exercise. 51 lessons keep one; 21 end at their last quiz. lesson-checks works the list out. - Finishing a lesson puts ten of its questions into Review for the next day, so Review and warm-ups stay fed without the drill. - Every play control stops its own sound on a second press. Listen shows a pause sign while it plays; Hear both and the whole conversation turn into Pause, and the conversation resumes from the line it stopped at. A stopped sequence no longer skips on to its next clip. - Alignment: a form question's cue sits on the word's line, long dot rows fit on a phone, a word list never starts a line with its separator, and the course list's numbers sit closer to their titles. Co-Authored-By: Claude Opus 5.5 --- .agents/skills/estonian-lesson/SKILL.md | 2 +- .../estonian-lesson/references/checklists.md | 2 +- apps/site/src/components/learn/Dialogue.tsx | 52 ++++++--- apps/site/src/components/learn/Drill.tsx | 29 +++-- .../site/src/components/learn/DrillRunner.tsx | 6 +- apps/site/src/components/learn/Explore.tsx | 7 +- apps/site/src/components/learn/FormRound.tsx | 4 +- apps/site/src/components/learn/HubView.tsx | 4 +- apps/site/src/components/learn/LessonView.tsx | 38 +++++-- apps/site/src/components/learn/Morph.tsx | 4 +- apps/site/src/components/learn/Paradigm.tsx | 4 +- apps/site/src/components/learn/Quiz.tsx | 50 +++++++-- apps/site/src/components/learn/ReviewView.tsx | 7 +- apps/site/src/components/learn/Scene.tsx | 4 +- .../src/components/learn/SentenceRound.tsx | 2 +- apps/site/src/components/learn/Sound.tsx | 19 +++- apps/site/src/components/learn/Timeline.tsx | 4 +- apps/site/src/components/learn/drill-banks.ts | 80 +++++++++++++- .../lib/learn/checks/lesson-checks.test.ts | 46 ++++++++ apps/site/src/lib/learn/player.test.ts | 103 ++++++++++++++++++ apps/site/src/lib/learn/player.ts | 59 +++++++++- apps/site/src/lib/learn/review.test.ts | 12 ++ apps/site/src/lib/learn/review.ts | 16 +++ apps/site/src/locales/learn/Kit/en.po | 54 ++++++--- apps/site/src/locales/learn/Kit/ru.po | 54 ++++++--- apps/site/src/locales/learn/Kit/uk.po | 54 ++++++--- docs/analytics.md | 2 +- docs/design/estonian-lessons.md | 9 +- docs/testing.md | 2 +- 29 files changed, 592 insertions(+), 137 deletions(-) create mode 100644 apps/site/src/lib/learn/player.test.ts diff --git a/.agents/skills/estonian-lesson/SKILL.md b/.agents/skills/estonian-lesson/SKILL.md index ea1a2ff49..83deb9fd4 100644 --- a/.agents/skills/estonian-lesson/SKILL.md +++ b/.agents/skills/estonian-lesson/SKILL.md @@ -48,7 +48,7 @@ One file in `components/learn/lessons/` with a `SLUG` constant, its glossary, it - Write every line to [the copy rules](references/copy.md) as you go; step 5 checks them. - Write every quiz to [the quiz rules](references/checklists.md#quizzes). Reviews flagged a giveaway or a skipped item in six of the first seven lesson PRs. - End with What to remember in three to five rules, then the words. -- Write the lesson's drill bank, `.drills.ts`, to [the bank checklist](references/checklists.md#drill-banks). `LessonView` adds the drill, and later lessons' warm-ups and the review page pick it up. +- Write the lesson's drill bank, `.drills.ts`, to [the bank checklist](references/checklists.md#drill-banks). Finishing the lesson puts its questions in review, and later lessons' warm-ups pick them up. When the bank asks a kind of question the lesson's quizzes don't, `lesson-checks.test.ts` prints the `LAST_EXERCISE` line to add, and `LessonView` ends the lesson with those questions. - Fix a kit part in its own file in `components/learn`, never in a copy inside the lesson, and name the fix in the PR and the notes: every lesson uses it. - Each `Quiz` gets a fixed `id` of lowercase letters, digits and hyphens, unique in the lesson: it is the `quiz` property of `learn_quiz_finished`. diff --git a/.agents/skills/estonian-lesson/references/checklists.md b/.agents/skills/estonian-lesson/references/checklists.md index 2668b8736..df8a788f3 100644 --- a/.agents/skills/estonian-lesson/references/checklists.md +++ b/.agents/skills/estonian-lesson/references/checklists.md @@ -117,7 +117,7 @@ Drive the lesson in Playwright at 1280 and 375 px, light and night (`colorScheme - Every `Word` card, by resting on it and by tapping it. - Every key, chip, switch, line and play button. -- The drill from Start to its result and Ten more, with a miss and its return; the warm-up and the review page with the clock moved a day. +- The last exercise, when `LAST_EXERCISE` lists the lesson, from Start to its result and Try again; the warm-up and the review page with the clock moved a day after the lesson is finished. - Every quiz: the Listen-first nudge, right and wrong picks, Hear both, the score, and Try again. - A conversation: play, pause, a tap on a speaker's line, the sentence before and after, five seconds back, both speeds, and a turn's button in the text. In exam mode: a play cut short by another sound, the last play, and Try again. - What to remember, the words card opened, and the links to the previous and next lessons. diff --git a/apps/site/src/components/learn/Dialogue.tsx b/apps/site/src/components/learn/Dialogue.tsx index abe63c451..80cb36000 100644 --- a/apps/site/src/components/learn/Dialogue.tsx +++ b/apps/site/src/components/learn/Dialogue.tsx @@ -1,7 +1,7 @@ import { Trans, useLingui } from "@lingui/react/macro"; import { captureAnalytics } from "@lymi/client/analytics"; import { clsx } from "clsx"; -import { ArrowRight, Check, Ear, MessageCircle, RotateCcw, X } from "lucide-react"; +import { ArrowRight, Check, Ear, MessageCircle, Pause, Play, RotateCcw, X } from "lucide-react"; import { type ReactNode, type Ref, @@ -19,7 +19,13 @@ import { sayReply, startDialogue, } from "../../lib/learn/passage"; -import { playInTurn, playSound, stopSound, usePlaying } from "../../lib/learn/player"; +import { + playInTurn, + stopSound, + toggleInTurn, + toggleSound, + usePlaying, +} from "../../lib/learn/player"; import { Button } from "../Button"; import { SectionContext, useLesson } from "./lesson-context"; import { Feedback, QuizCard, ResultDots } from "./Quiz"; @@ -81,6 +87,17 @@ export function Dialogue({ id, title, part, them, turns, text = "shown" }: Dialo const src = (clip: string) => clipUrl(slug, clip); // Keyed by the dialogue too, so two dialogues with the same lines don't light up together. const key = (clip: string) => `dialogue:${slug}:${id}:${clip}`; + const wholeKey = `dialogue:${slug}:${id}`; + const playingWhole = usePlaying(wholeKey); + const [resumeAt, setResumeAt] = useState(0); + const hearWhole = () => { + const from = resumeAt; + const run = toggleInTurn( + turns.slice(from).map((turn) => ({ src: src(turn.clip), key: key(turn.clip) })), + wholeKey, + ); + void run?.then(({ finished, at }) => setResumeAt(finished ? 0 : from + at)); + }; const rightLine = (turn: Extract) => turn.replies.find((reply) => reply.right)?.line ?? ""; const yours = turns.filter((turn) => turn.who === "you").length; @@ -257,19 +274,28 @@ export function Dialogue({ id, title, part, them, turns, text = "shown" }: Dialo

- } /> ); return ( - + A few questions}> diff --git a/apps/site/src/components/learn/DrillRunner.tsx b/apps/site/src/components/learn/DrillRunner.tsx index f87c796e4..4b07e586f 100644 --- a/apps/site/src/components/learn/DrillRunner.tsx +++ b/apps/site/src/components/learn/DrillRunner.tsx @@ -22,7 +22,7 @@ import { KeepEndings } from "./endings"; import { QuizCard, ResultDots, Score } from "./Quiz"; interface Props { - id: "drill" | "warm-up" | "review" | "checkpoint" | "placement"; + id: "last" | "warm-up" | "review" | "checkpoint" | "placement"; lesson: string; title: ReactNode; questions: readonly Question[]; @@ -91,8 +91,8 @@ export function DrillRunner(props: Props) { - + + run.first[each.id])} now={position} diff --git a/apps/site/src/components/learn/Explore.tsx b/apps/site/src/components/learn/Explore.tsx index 9a8f79f3e..33d75ad8a 100644 --- a/apps/site/src/components/learn/Explore.tsx +++ b/apps/site/src/components/learn/Explore.tsx @@ -1,7 +1,7 @@ import { useLingui } from "@lingui/react/macro"; import { clsx } from "clsx"; import { type ReactNode, useEffect, useState } from "react"; -import { loudness, playSound, usePlaying } from "../../lib/learn/player"; +import { loudness, playSound, toggleSound, usePlaying } from "../../lib/learn/player"; import { Playing, PlayMark } from "./Sound"; /** The stage's tray, where anything to play with sits. Nothing on it is marked right or wrong. */ @@ -105,7 +105,7 @@ function Key({ data-playing={playing ? "" : undefined} onClick={() => { onPress(); - void playSound(item.src); + void toggleSound(item.src); }} className="learn-key relative grid cursor-pointer justify-items-center gap-0.5 rounded-tile bg-plate px-0.5 pt-3 pb-2.5 hoverable:hover:bg-plate-hover" > @@ -248,7 +248,7 @@ function Row({ item, lead }: { item: RowItem; lead: string | undefined }) { - )} + {extra && } {total > 1 && ( + ); +} + /** A word or number from a round, to hear again on the score. */ export interface Recall { label: string; @@ -445,7 +465,7 @@ function RecallChip({ word, mark }: { word: Recall; mark: "right" | "slip" | "wr const Tag = src ? "button" : "span"; return ( void playSound(src) } : {})} + {...(src ? { type: "button" as const, onClick: () => void toggleSound(src) } : {})} className={clsx( "inline-flex items-center gap-1.5 rounded-full border py-1 ps-2 pe-3 text-md font-medium transition-colors duration-150", mark === "right" && "border-success/40 bg-success-soft text-ink", @@ -494,10 +514,14 @@ export function ResultDots({ now: number; total: number; }) { + const dense = total > 12; return (