Skip to content

lessons: one light/dark system with a visible course spine - #16

Merged
macayaven merged 1 commit into
mainfrom
design/course-ui
Sep 25, 2026
Merged

macayaven merged 1 commit into
mainfrom
design/course-ui

Conversation

@macayaven

Copy link
Copy Markdown
Owner

Summary

Learner-facing effect: every generated page (index, S01–S14, study plan) shares one light/dark visual system, and the course spine is visible in the first screenful: a course rail, a "Carried in / Today you ship / Unlocks next" card with the cafe/ module strip, index session cards and an outline for long pages.

Concern: (a) tokens + template + build, (b) spine/rail/outline, (c) diagram plate. Kept together because the handoff delivered them as one template.html + build.py. The marimo theme, concern (d), is stacked on top in its own PR.

Author: Carlos Crespo Macaya. Design from the Claude Design course UI handoff (design_handoff_course_ui).

What changed

File Change
tools/template.html Light/dark tokens (prefers-color-scheme), rail, spine card, module strip, arc section styles, outline, dark diagram plate. No <script>.
tools/build.py Presentation layer (enhance(), page_chrome()) inside render(). render_body() and build_nav() are byte-identical to main. render() keeps its 4-argument form; chrome is optional.
sessions/**/*.html Regenerated: sessions/index.html, sessions/study-plan.html, sessions/s*/lesson.html.
tests/test_course_ui.py New: index cards, module strip order against test_arc.SHIPS, optional-protocol rail.
CHANGELOG.md Unreleased entry.

Fixes on top of the delivered files

  • Index cards never rendered. enhance() inserted the inline outline right after </h1>, so the index-card pattern (</h1>\s*<p>) never matched. The index card grid now goes in first. test_course_ui failed on the delivered output and passes now.
  • Predict-first steps lost their number. list-style: none showed "Predict first…" followed by "2.". The marker is kept and colored --predict (6.5:1 light, 9.8:1 dark on bg).
  • Top nav is laid out as prev / Index / next, as in the approved mockup. The long H1 labels had wrapped "Next" onto its own left-aligned line. The markup is unchanged.

Invariants

  • No lesson wording or section-order change. A script compares the old and new <main> of all 16 pages and finds no lost word.
  • <details> blocks are identical apart from `x` → <code>x</code>. lesson-nav, static-diagram-scroll/<img> markup and every <title> are unchanged.
  • No <script>. SVGs, receipt.json and toy.py are untouched.
  • Handoff risk points: S13/S14 fall back to the plain header paragraph plus the outline. shipped_module() matches SHIPS for S01–S12. check_links.py accepts the rail and card hrefs.

Evidence

Definition of Done (committed tree, Python 3.12, COURSE_MODE=stub, socket guard on PYTHONPATH):

$ uv sync --frozen
$ uv run python tools/build.py && git diff --exit-code -- '*.html'
sessions/study-plan.md -> sessions/study-plan.html (1 mermaid block(s))
(no HTML drift)
$ uv run python -m unittest discover -s tests -v
Ran 154 tests in 1.154s
OK
$ uv run python tools/check_links.py
check_links.py: 16 pages, 406 relative refs ok
$ uv run python tools/check_sota_urls.py
check_sota_urls.py: 99 tagged rows, all have a URL
$ uv run python -m unittest labs/test_contracts.py
Ran 29 tests in 0.005s
OK
$ uv run python labs/run.py --all --replay
naïve 2/9 vs engine 9/9
exit=0
# verify.yml extras
12 notebooks executed offline
marimo check --strict ok
marimo canonical form: no drift

A second rebuild after the commit produced no HTML drift. The replay's naïve FAIL lines are the deliberate baselines.

Contrast (WCAG 2.2). Recomputed from the tokens; it matches the handoff's table.

Pair Light Dark AA
text / bg 16.1 14.8 4.5
muted / bg 6.7 7.7 4.5
muted / surface-2 6.1 6.3 4.5
accent / bg (links, focus) 5.9 8.9 4.5
accent / accent-soft 5.2 7.1 4.5
on-accent / accent 6.2 8.9 4.5
predict / predict-soft 5.8 8.2 4.5
check / check-soft 5.5 8.4 4.5
warn / surface 6.4 10.2 4.5
line-strong / bg (rail, outlines) 3.7 3.8 3 (non-text)
diagram text #ccc / plate 10.2 10.2 4.5

Screenshots. Before/after sheets for the index, S05 and the S05 toy, at 375 and 1280, light and dark, were taken with Playwright and reviewed locally. The page never scrolls sideways at 375. They are not embedded here because there was no approved image host; they can be attached to this PR by hand.

Deferred (needs a maintainer decision, per the handoff): JS conveniences (theme toggle, scroll-spy, progress marks) and light-theme diagram renders.

Checklist

  • uv run python -m unittest discover -s tests -v
  • uv run python tools/build.py produces no generated HTML drift
  • uv run python tools/check_links.py
  • uv run python tools/check_sota_urls.py
  • If lesson/SOTA URLs changed: uv run python tools/check_links.py --http (not applicable: no URL changes)
  • If notebooks changed: not changed; all 12 still execute offline
  • Lab contract tests and uv run python labs/run.py --all --replay pass
  • Generated diagrams: unchanged (CSS plate only)
  • Public text contains no learner data, credentials, raw logs or private machine paths
  • Toys remain a different domain (not a paste-ready production harness)

Apply the Claude Design course UI handoff to tools/template.html and
tools/build.py, then rebuild every generated page. Adds light and dark
tokens that follow prefers-color-scheme, the course rail, the "Carried in
/ Today you ship / Unlocks next" spine card with the cafe/ module strip,
index session cards, arc-aware section styling and an outline. Lesson
wording, section order, nav, <details>, diagram markup and titles are
unchanged; pages stay script-free.

Fixes on top of the delivered files:
- build.py: insert the index cards before the inline outline, which
  otherwise stopped the index pattern from matching (no cards rendered).
- template: keep the list number on predict-first steps and lay the top
  nav out as prev / index / next, as in the approved mockup.
- tests/test_course_ui.py pins the index cards, the module strip order
  against test_arc.SHIPS, and the optional protocols' rail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@macayaven
macayaven merged commit 71c0009 into main Sep 25, 2026
2 checks passed
@macayaven
macayaven deleted the design/course-ui branch September 25, 2026 10:06
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