Add frontpage templates and support non-language courses#5
Merged
Conversation
The migration module had a top-level `await fetchCoreBank('de', 'nounbank')`
that ran unconditionally when imported, causing a 404 crash on non-language
courses like naturfag that have no German vocabulary data.
Changes:
- Move nounbank fetch from top-level await into convertKnownWordsToNewFormat()
so it only runs during actual migration and gracefully handles 404
- Make migrateProgressData() async to support the lazy fetch
- Add naturfag-vg1 to the curriculum registry with proper nb language config
so getTargetLanguageCode() doesn't fall back to 'de'
- Add 'nb' case to shell.js enforceLanguageConsistency() so naturfag pages
don't get force-switched to the German curriculum
🤖 Generated with Papertek — Framework for Education
Co-Authored-By: Claude <noreply@anthropic.com>
https://claude.ai/code/session_017rtsVGshceLbjsQaDx7HyA
…-language courses
The framework assumed German ('de') and 'tysk1-vg1' as defaults throughout
the engine, causing crashes and incorrect behavior for non-language courses
like naturfag.
Changes across 13 files:
- Replace all `|| 'de'` fallbacks with `|| 'nb'` (neutral UI locale)
- Replace hardcoded 'tysk1-vg1' defaults in store.js with dynamic
_defaultCurriculum() that reads from the curriculum registry
- Use config.contentPath/config.languageDir for content path resolution
instead of hardcoded language-to-directory mappings
- Make getCurriculumConfig() fallback to first registered curriculum
instead of assuming tysk1-vg1
- Wrap top-level vocab fetches in try/catch (test.js, gender-trainer,
verb-trainer) so non-language courses don't crash on missing banks
- Make content-loader.js skip vocabulary bank loading entirely when
target language equals native language (non-language courses)
- Fix AppShell constructor to use neutral defaults for title and theme
🤖 Generated with Papertek — Framework for Education
Co-Authored-By: Claude <noreply@anthropic.com>
https://claude.ai/code/session_017rtsVGshceLbjsQaDx7HyA
The framework now supports multiple frontpage layouts that teachers can
choose when creating a new educational app, making it suitable for both
language courses and subject-based courses like science/math/history.
Templates:
- classic — Language course style (curriculum selector, vocab trainer link)
- subject — Subject course style (chapter card grid, hero section)
- minimal — Simple compact list layout (clean rows)
Changes:
- templates/frontpage/{classic,subject,minimal}.html — Three HTML templates
- ui.js — Added renderSubjectLayout() and renderMinimalLayout() renderers
that dispatch based on data-frontpage-template attribute on <body>
- shell.js — Skip shell header/tools rendering for subject/minimal templates
(they handle their own layout)
- papertek.css — Added 4 named color themes (science/green,
humanities/indigo, math/pink, social/orange) via data-theme attribute
- create-edu-app.js — Added frontpage template and color theme prompts,
generates index.html from selected template, auto-suggests 'subject'
for same-language courses
- papertek.config.template.js — Added frontpageTemplate option
🤖 Generated with Papertek — Framework for Education
Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR introduces a flexible frontpage template system and extends Papertek to support non-language courses (like science, math, and social studies). Key changes:
Three frontpage templates (
classic,subject,minimal) — allowing different course types to have appropriate layoutsclassic: Language courses with curriculum selector and vocab trainersubject: Subject courses with chapter card grid and hero sectionminimal: Compact lesson list for small coursesColor theme system — Named themes (science/green, humanities/indigo, math/pink, social/orange) applied via
data-themeattributeNon-language course support — Added
naturfag-vg1(Norwegian science) curriculum and refactored language detection to usenb(Norwegian) as default instead of hardcodedde(German)Template-aware rendering —
renderLessonList()now dispatches to template-specific renderers (renderSubjectLayout,renderMinimalLayout)Improved content loading — Graceful fallbacks for missing vocabulary banks and content modules, allowing courses without external API dependencies
CLI enhancements —
create-edu-app.jsnow prompts for frontpage template and color theme during project generationType of change
Checklist
language-utils.js, defaults tonbinstead ofde)Test Plan
npm run validate:schemasandnpm run validate:configpassclassic,subject,minimaldata-themeattributehttps://claude.ai/code/session_017rtsVGshceLbjsQaDx7HyA