feat: theme-grouped pickers, theme-session content panel, theme/topic naming
- Admin Topic Quizzes (was Quizzes): topics are now grouped under collapsible theme headers with per-theme counts. Topics without a theme fall into a "No theme" bucket rendered last. - /topic-test picker: eligible topics grouped by theme so learners can scan a curriculum theme and drill its topics on demand. - Fix admin Theme Content panel (was Learning Content): it was empty because content moved to the theme_sessions collection in an earlier refactor while the panel still queried the legacy per-topic content table. Rewrites ContentManager to read db.getAllThemeSessions and render the emit_theme_session schema (title, intro, topic sections, connections, key takeaways). Adds db.getAllThemeSessions and db.deleteThemeSession. - Disambiguate theme vs topic across the app: the weekly curriculum test is now "Theme Test" (nav, page heading, Dashboard card, button, explainer); the on-demand bank test stays "Topic Test". Admin nav also clarified to "Theme Content" / "Topic Quizzes". No schema changes. 85/85 tests still pass, build green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -362,6 +362,24 @@ export async function setThemeSession(curriculumVersionId, weekNumber, theme, co
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return every cached theme session, newest first. Used by the admin
|
||||
* Content panel to surface what's been generated across all weeks.
|
||||
*/
|
||||
export async function getAllThemeSessions() {
|
||||
try {
|
||||
return await pb.collection('theme_sessions').getFullList({ sort: '-updated' });
|
||||
} catch { return []; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a single theme session record by PocketBase id.
|
||||
*/
|
||||
export async function deleteThemeSession(id) {
|
||||
try { return await pb.collection('theme_sessions').delete(id); }
|
||||
catch { return null; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Has the user completed the theme session for a given personal week?
|
||||
* Returns the completion record, or null.
|
||||
|
||||
Reference in New Issue
Block a user