Skip to content

Quick check widget: instrument-label palette + clean rationale citations - #16

Merged
Bissbert merged 2 commits into
mainfrom
fix/quick-check-palette
May 5, 2026
Merged

Bissbert merged 2 commits into
mainfrom
fix/quick-check-palette

Conversation

@Bissbert

@Bissbert Bissbert commented May 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Two scoped polish changes to the LearnQuizWidget (the Quick check pretest above each /learn/[slug] article):

  1. Palette refinement to a scientifically clean, intriguing instrument-label aesthetic. The widget was reading as an anonymous beige-on-white card with nearly-invisible A/B/C indices and a broken dark mode (dark header on a forced-white card body).
  2. Inline scholarly citation markers ([ref:read-gemmology-3e] etc., 520 occurrences across 4 keys) stripped from rationale prose at render time and surfaced as a single deduped Sources footer line. They were never wired to a resolver, so they snagged the eye mid-sentence in every "Not quite — here is why" panel.

Bonus: introduces .impeccable.md capturing the project's design context (precise, considered, alive) so future design decisions have grounding.

Changes

Palette (commit 2836358):

  • Header strip → filled slate-900 instrument-label with mono 01 of 03 counter and small-caps Pretest annotation tag
  • A/B/C indices → 6×6 mono plate references that fill crystal / emerald / red on selected / correct / wrong-chosen states
  • Card silhouette switched from accent crystal-200 to neutral slate so the accent lives only in the header
  • Helper line dropped italic, gained a leading crystal-500 em-dash; question stem promoted to text-base font-medium
  • Dark mode now a true mirror — card body slate-900, header slate-950, all states have dark variants
  • Completion card recoloured to emerald so finish state reads distinct from idle

Citations (commit 33bfc3c):

  • New src/lib/quiz/citations.ts with stripCitations / extractCitations / collectCitations / citationLabel and a 4-entry CITATION_LABELS map (Read, Anderson, Gübelin & Koivula vols 1 + 3)
  • RationalePanel strips refs from all rationale strings before render and emits one small-caps Sources · · line at the foot of the body, deduped across the panel
  • Unknown slugs fall back to raw text (so adding a fifth source later won't silently drop attribution)
  • YAML question content untouched — provenance lives in source where curators wrote it

Test plan

  • All 226 vitest tests pass (210 existing + 16 new across citations.test.ts and the new RationalePanel citation cases)
  • LearnQuizWidget test queries migrated from fragile getByText(/1 of 3/) to semantic getByRole('complementary', { name: /question 1 of 3/ }) since the counter now splits across spans by design
  • Verified visually in dev server, light + dark modes
  • Verified interaction states: idle / hover / selected / submitted-correct / submitted-wrong-chosen / completed
  • Verified live page rationale prose reads cleanly with no [ref: snags; Sources footer renders once at the foot
  • No structural HTML changes; no new dependencies

Out of scope

  • Site-wide dark mode propagation on /learn pages (separate concern; widget at least respects dark: classes when present)
  • Building a popover/footnote system for citations (option 3 in our discussion; we picked option 2 — clean strip + Sources footer)
  • Updating YAML content to remove inline [ref:…] markers (intentionally kept; provenance is curator-side, render is reader-side)

Bissbert added 2 commits May 5, 2026 15:14
…esthetic

The pretest widget was reading as an anonymous beige-on-white card on
/learn pages — flat, low presence, with letter-index plates that were
nearly invisible and a dark mode that mixed a dark header with a
forced-white card body.

Refinement (palette + typography only, no structural HTML changes):
- Header strip → filled slate-900 instrument-label with mono "01 of 03"
  counter and crystal-300 separator; small caps "Pretest" annotation tag
- A/B/C indices → 6×6 mono plate references that fill with crystal/
  emerald/red on selected/correct/wrong-chosen states
- Card silhouette switched from crystal-200 border to neutral slate so
  the accent lives in the header only
- Helper line dropped italic and gained a leading crystal em-dash
- Question stem promoted to text-base/medium for hierarchy
- Dark mode now a true mirror: card body bg-slate-900, header
  bg-slate-950, all states have dark variants
- Completion card recoloured to emerald (was crystal) so finish state
  reads distinct from idle

Plate refs and high-contrast header give the widget one strong visual
moment per the project's "scientifically clean and intriguing" direction
captured in the new .impeccable.md design context.

Tests updated to query by aria-label/role rather than fragile text
matching ("01 of 03" splits across spans by design).
…rces footer

Curated question rationales were authored with inline scholarly citation
markers like `[ref:read-gemmology-3e]` (520 occurrences across the bank,
4 distinct keys: Read, Anderson, Gübelin & Koivula vols 1 and 3). They
were never wired to a resolver, so every "Not quite — here is why" panel
got sprinkled with bracketed slug noise that snagged the eye mid-sentence.

Fix: small render-time helper (`src/lib/quiz/citations.ts`) that

- strips `[ref:...]` markers from rationale strings, tidying any double
  spaces or pre-punctuation gaps a removed marker would have left behind,
- collects the unique slugs in first-seen order across the main rationale
  and all per-option rationales,
- maps each slug to a short human label (falls back to the raw slug if
  unknown, so adding a fifth source tomorrow does not silently drop the
  citation).

`RationalePanel` runs the strip on every rationale string before render
and emits a single small-caps "Sources" line at the foot of the body,
deduped across the whole panel. When no citations exist, the footer is
omitted entirely.

The YAML question content is untouched — provenance lives in source
where curators write it; readers get clean prose plus a single sourced
attribution line.

Tests: 16 new (10 utility, 6 panel render). Full suite: 226/226 pass.
@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown

🚀 Preview deployed to: https://09f5090c.gemmology-dev.pages.dev

@Bissbert
Bissbert merged commit 780c92e into main May 5, 2026
3 of 4 checks passed
Bissbert added a commit that referenced this pull request May 11, 2026
…ons (#16)

* style(learn-widget): refine Quick check palette to instrument-label aesthetic

The pretest widget was reading as an anonymous beige-on-white card on
/learn pages — flat, low presence, with letter-index plates that were
nearly invisible and a dark mode that mixed a dark header with a
forced-white card body.

Refinement (palette + typography only, no structural HTML changes):
- Header strip → filled slate-900 instrument-label with mono "01 of 03"
  counter and crystal-300 separator; small caps "Pretest" annotation tag
- A/B/C indices → 6×6 mono plate references that fill with crystal/
  emerald/red on selected/correct/wrong-chosen states
- Card silhouette switched from crystal-200 border to neutral slate so
  the accent lives in the header only
- Helper line dropped italic and gained a leading crystal em-dash
- Question stem promoted to text-base/medium for hierarchy
- Dark mode now a true mirror: card body bg-slate-900, header
  bg-slate-950, all states have dark variants
- Completion card recoloured to emerald (was crystal) so finish state
  reads distinct from idle

Plate refs and high-contrast header give the widget one strong visual
moment per the project's "scientifically clean and intriguing" direction
captured in the new .impeccable.md design context.

Tests updated to query by aria-label/role rather than fragile text
matching ("01 of 03" splits across spans by design).

* feat(rationale): strip inline [ref:slug] markers, surface unified Sources footer

Curated question rationales were authored with inline scholarly citation
markers like `[ref:read-gemmology-3e]` (520 occurrences across the bank,
4 distinct keys: Read, Anderson, Gübelin & Koivula vols 1 and 3). They
were never wired to a resolver, so every "Not quite — here is why" panel
got sprinkled with bracketed slug noise that snagged the eye mid-sentence.

Fix: small render-time helper (`src/lib/quiz/citations.ts`) that

- strips `[ref:...]` markers from rationale strings, tidying any double
  spaces or pre-punctuation gaps a removed marker would have left behind,
- collects the unique slugs in first-seen order across the main rationale
  and all per-option rationales,
- maps each slug to a short human label (falls back to the raw slug if
  unknown, so adding a fifth source tomorrow does not silently drop the
  citation).

`RationalePanel` runs the strip on every rationale string before render
and emits a single small-caps "Sources" line at the foot of the body,
deduped across the whole panel. When no citations exist, the footer is
omitted entirely.

The YAML question content is untouched — provenance lives in source
where curators write it; readers get clean prose plus a single sourced
attribution line.

Tests: 16 new (10 utility, 6 panel render). Full suite: 226/226 pass.

This branch was successfully deployed

1 active deployment
gemmology-dev (Preview) — 33bfc3c9 Deployed May 5, 2026 by github-actions[bot]
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