From 5175811579e85b51bef6c8c4eea91eb80f5bd2ee Mon Sep 17 00:00:00 2001 From: Hananoshika Yomaru Date: Wed, 20 May 2026 14:02:29 -0700 Subject: [PATCH] Enhance curriculum catalog functionality: Update CONTRIBUTING.md to reflect changes in curriculum structure, including the introduction of `curriculumCoverage` for frameworks. Modify frontend components to support a new comparison view for Mathematics, allowing users to compare curricula. Update catalog data to include "Common Core" and improve curriculum filtering logic. Enhance styles for better visual representation of curriculum badges and Mermaid diagrams. Adjust TypeScript types to accommodate new features and ensure backward compatibility with legacy curriculum data. --- .agents/skills/ofb/SKILL.md | 2 +- .agents/skills/ofb/curriculum-data.md | 10 +- .agents/skills/zola/SKILL.md | 12 +- .agents/skills/zola/reference.md | 10 + .agents/skills/zola/zola-catalog.md | 96 ++ .agents/skills/zola/zola-solid.md | 17 +- CONTRIBUTING.md | 16 +- data/catalog.json | 2 +- data/catalog.types.ts | 12 +- data/faq.json | 4 +- data/math-curriculum.json | 740 +++++++-- docs/research/copilot.md | 37 + docs/research/gemini.md | 1381 +++++++++++++++++ frontend/src/components/catalog-app.tsx | 136 +- .../src/components/catalog-chapter-card.tsx | 3 +- .../src/components/catalog-compare-doc.tsx | 24 + .../src/components/catalog-filters-menu.tsx | 2 +- .../src/components/catalog-mermaid-view.tsx | 6 +- .../src/components/contributing-demos.tsx | 22 +- frontend/src/lib/catalog-badge.ts | 1 + frontend/src/lib/catalog-coverage.test.ts | 23 + frontend/src/lib/catalog-coverage.ts | 53 + .../catalog-mermaid-strand-headers.test.ts | 9 + .../src/lib/catalog-mermaid-strand-headers.ts | 99 ++ .../src/lib/catalog-mermaid-theme.test.ts | 16 + frontend/src/lib/catalog-mermaid-theme.ts | 69 + frontend/src/lib/catalog-to-mermaid.test.ts | 4 +- frontend/src/lib/catalog-to-mermaid.ts | 13 +- scripts/apply-math-coverage.ts | 461 ++++++ themes/openfreebooks/sass/_catalog.scss | 351 ++++- themes/openfreebooks/sass/main.scss | 2 +- themes/openfreebooks/templates/catalog.html | 4 + .../partials/contributing-content.html | 1 + .../partials/math-curricula-compare.html | 240 +++ 34 files changed, 3702 insertions(+), 176 deletions(-) create mode 100644 .agents/skills/zola/zola-catalog.md create mode 100644 docs/research/copilot.md create mode 100644 docs/research/gemini.md create mode 100644 frontend/src/components/catalog-compare-doc.tsx create mode 100644 frontend/src/lib/catalog-coverage.test.ts create mode 100644 frontend/src/lib/catalog-coverage.ts create mode 100644 frontend/src/lib/catalog-mermaid-strand-headers.test.ts create mode 100644 frontend/src/lib/catalog-mermaid-strand-headers.ts create mode 100644 frontend/src/lib/catalog-mermaid-theme.test.ts create mode 100644 frontend/src/lib/catalog-mermaid-theme.ts create mode 100644 scripts/apply-math-coverage.ts create mode 100644 themes/openfreebooks/templates/partials/math-curricula-compare.html diff --git a/.agents/skills/ofb/SKILL.md b/.agents/skills/ofb/SKILL.md index ac599df..f38a5cb 100644 --- a/.agents/skills/ofb/SKILL.md +++ b/.agents/skills/ofb/SKILL.md @@ -93,7 +93,7 @@ Detailed checklists: [curriculum-data.md](curriculum-data.md). Human-facing guid | Styles | `themes/openfreebooks/sass/_catalog.scss` | - Embedded data: `#catalog-data` in `templates/catalog.html` (merged at build time) -- URL: `/catalog/?subject=math` (list), `&view=tree` (map) +- URL: `/catalog/?subject=math` (list), `&view=tree` (map), `&view=compare` (math curricula doc — HTML partial `partials/math-curricula-compare.html`) **List view:** full-card link for live chapters; number + title row on wide screens. diff --git a/.agents/skills/ofb/curriculum-data.md b/.agents/skills/ofb/curriculum-data.md index adc34ae..fe12d12 100644 --- a/.agents/skills/ofb/curriculum-data.md +++ b/.agents/skills/ofb/curriculum-data.md @@ -8,7 +8,7 @@ Site-wide catalog chrome. { "title": "Curriculum Catalog", "subtitle": "Browse chapters by subject and curriculum", - "curriculums": ["DSE", "IB", "A-Level", "AP", "IGCSE"], + "curriculums": ["Foundation", "DSE", "IB", "A-Level", "AP", "IGCSE", "Common Core"], "subjects": [ { "id": "math", "name": "Mathematics" } ] @@ -28,7 +28,8 @@ Example: `data/math-curriculum.json`. ```json { "title": "Mathematics", - "subtitle": "Short tagline for data (not shown on every page)", + "subtitle": "Optional; deprecated — do not use HKDSE-only framing. Catalog chrome uses data/catalog.json.", + "intro": "Optional subject-level intro (not shown in catalog UI today)", "intro": "Optional; was used by old book page", "graph": { "edges": [ @@ -63,8 +64,9 @@ Example: `data/math-curriculum.json`. | `title` | yes | Catalog list + map node label | | `description` | yes | 1–2 sentences; shown in list and map cards (clamped to 3 lines on map) | | `status` | yes | `live` (link to chapter) or `planned` (no link) | -| `curriculums` | yes | Non-empty array; values must exist in `catalog.json` `curriculums` | -| `tier` | no | `foundation` (default) or `non-foundation` — shows an **Extension** badge on cards | +| `curriculumCoverage` | yes (math) | Object mapping framework label → `core` \| `extension` \| `related` (Compare matrix + filters) | +| `curriculums` | legacy | Deprecated array; use `curriculumCoverage` instead | +| `tier` | no | `foundation` (default) or `non-foundation` — shows an **Extension** badge on cards (DSE M2-style topics) | ### Graph model (map) diff --git a/.agents/skills/zola/SKILL.md b/.agents/skills/zola/SKILL.md index 6e408dc..7590ce7 100644 --- a/.agents/skills/zola/SKILL.md +++ b/.agents/skills/zola/SKILL.md @@ -21,7 +21,7 @@ Static site: **Zola** + custom theme `openfreebooks`. Output goes to `public/` ( | `static/` | Copied to site root (`favicons`, `icons/`, etc.) | | `themes/openfreebooks/templates/` | Tera HTML, partials, macros | | `themes/openfreebooks/sass/` | Source styles → compiled `public/main.css` | -| `themes/openfreebooks/static/js/` | Vite output: `bundle.js` (site chrome) + hashed chunks (`catalog-app-*.js`, `catalog-canvas-view-*.js`, …) | +| `themes/openfreebooks/static/js/` | Vite output: `bundle.js` (site chrome) + lazy chunks (e.g. `catalog-mermaid-view-*.js`) | See [reference.md](reference.md) for Tera pitfalls and build checks. @@ -75,10 +75,12 @@ Client behavior lives in `frontend/` and mounts from `base.html`: | Entry | Mount | Notes | |-------|--------|--------| | `js/bundle.js` | `main.tsx` | Header, theme, homepage, chapter widgets | -| `js/catalog-app-*.js` | `#catalog-app` on `/catalog/` | Lazy-loaded with `catalog-canvas-view-*.js` for Map view | +| `#catalog-app` on `/catalog/` | `catalog-app.tsx` in bundle | List / Map / Compare; Map lazy-loads `catalog-mermaid-view` | **When changing `frontend/` or adding interactivity**, read [zola-solid.md](zola-solid.md) before editing JS. +**When changing the catalog page, map, or compare doc**, read [zola-catalog.md](zola-catalog.md). + ### Search (Pagefind) - Runs after `zola build`; indexes **live chapter pages** only (`data-pagefind-body` on chapter template). @@ -87,8 +89,10 @@ Client behavior lives in `frontend/` and mounts from `base.html`: ### Catalog page - `content/catalog.md` → `template = "catalog.html"` -- `templates/catalog.html` — empty `#catalog-app` + `#catalog-data` JSON embed (merged subject curricula at build time) -- `sass/_catalog.scss` — list + map styles; map card title link underline lives under `.catalog-canvas` +- `templates/catalog.html` — `#catalog-app`, `#catalog-data` JSON, `