kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Add unit detail page with lesson accordions and learning objectives

Open rtibbles opened this issue 8 months ago • 1 comments

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

Add a unit detail page to the coach course monitoring experience. When a coach clicks a unit on the course summary page, they navigate to a view showing the unit's lessons as accordion items, with each lesson's associated learning objectives listed inside the accordion. Sparkline bars show mastery distribution per LO, reusing SparklineBar and the score bucketing utilities from the recently merged LO reports work.

Complexity: Medium Target branch: release-v0.19.x

Context

  • lesson_objectives in the unit's ContentNode.options maps lesson ContentNode IDs to arrays of LO IDs
  • The unit report API already provides learning objectives, scores, and sparkline data at the unit level
  • The lesson completion status endpoint (#14473) returns lesson ContentNodes and per-learner content status data, so no separate tree fetch is needed
  • StatusSummary from Lesson/Quiz reports can be reused to display aggregate learner completion progress (completed/started/helpNeeded/notStarted breakdown) per lesson

The Change

  • Add a unit detail route and page component, wired from the unit links on CourseSummaryPage (currently stubbed as :to="{}")
  • Fetch data from the existing unit report API and the lesson completion status endpoint (#14473), which returns both lesson ContentNodes and per-learner content status data
  • Display lessons as accordion items using AccordionContainer/AccordionItem, with StatusSummary showing aggregate learner completion progress per lesson
  • Inside each accordion, list the lesson's learning objectives (mapped via lesson_objectives from unit options) with SparklineBar showing mastery distribution per LO
  • No tabs — single view only

Out of Scope

  • "View by groups" filtering
  • "Preview as learner" button
  • Side panel detail views for individual learners or learning objectives (covered in parent issue design but not this task)

Acceptance Criteria

General

  • [ ] Clicking a unit on CourseSummaryPage navigates to the new unit detail page
  • [ ] Page displays the unit title with a back link to the course summary
  • [ ] Lessons are rendered as accordion items using AccordionContainer/AccordionItem, all collapsed by default
  • [ ] Each lesson accordion header shows StatusSummary with aggregate learner completion progress
  • [ ] Inside each accordion, the lesson's learning objectives are listed (mapped via lesson_objectives from unit options)
  • [ ] Each learning objective row shows a SparklineBar with mastery distribution
  • [ ] No tabs — single view only

Accessibility and i18n

  • [ ] Hidden header row for the LO/mastery table, matching the pattern in LearningObjectivesReport
  • [ ] All user-visible strings use existing coach strings where available, new strings added to the courses translator in kolibri-common
  • [ ] Keyboard navigation works for accordion expand/collapse

Testing

  • [ ] Tests written before implementation (TDD)
  • [ ] Unit detail route is registered and navigable
  • [ ] Accordion rendering with lesson data is tested
  • [ ] LO-to-lesson mapping via lesson_objectives is tested
  • [ ] SparklineBar integration with per-LO mastery data is tested

Design Checklist

Page Header

Layout:

  • [ ] Back link/breadcrumb above unit title, linking to course summary page
  • [ ] Unit title displayed as a heading

Lesson Accordion Items

Layout:

  • [ ] Lessons rendered using AccordionContainer/AccordionItem components
  • [ ] All accordions collapsed by default
  • [ ] Accordion header shows lesson title and StatusSummary completion indicator

States:

  • [ ] Collapsed: shows lesson title + completion status only
  • [ ] Expanded: reveals list of learning objectives with sparkline bars

Learning Objectives List (inside accordion)

Layout:

  • [ ] Each LO row displays LO text and SparklineBar on the right
  • [ ] LO text and sparkline aligned in a two-column layout matching LearningObjectivesReport pattern
  • [ ] Hidden thead for accessibility, matching the pattern in LearningObjectivesReport (visually hidden via display: none, caption provides screen reader context)

Spacing:

  • [ ] LO name cell: padding: 12px 0 12px 16px (matching LearningObjectivesReport .lo-link)
  • [ ] Sparkline cell: padding: 12px 16px 12px 0 (matching LearningObjectivesReport .lo-sparkline)

Colors:

  • [ ] SparklineBar segments use existing palette colors: low palette.red.v_600, mid palette.yellow.v_500, high palette.green.v_600

Empty state:

  • [ ] When no test is activated for the unit, show appropriate empty state message

Spec shows desktop only — responsive behavior not specified. The AccordionContainer/AccordionItem components and responsive-window/responsive-element system handle responsive behavior.

References

  • Design spec: image
  • Existing components: AccordionContainer/AccordionItem in packages/kolibri-common/components/accordion/, SparklineBar in kolibri/plugins/coach/frontend/views/common/, StatusSummary in kolibri/plugins/coach/frontend/views/common/status/, LearningObjectivesReport in kolibri/plugins/coach/frontend/views/courses/

AI usage

This issue was drafted collaboratively with Claude Code. Visual acceptance criteria were extracted from the design spec screenshot. Component references and theme token values were verified against the current codebase.

rtibbles avatar Mar 31 '26 04:03 rtibbles

Watching for resolution on behalf of learningequality/kolibri#14458.

rtibblesbot avatar Apr 04 '26 04:04 rtibblesbot