Add cross-site improvements across three phases

Phase 1 — Quick wins:
- Image lazy-loading on series/resource cards
- Newsletter signup added to Episodes page (before highlights)
- Per-route meta tags via usePageMeta hook (title, og:title, og:description)
- Breadcrumbs on study index, section, and notes pages
- SVG completion checkmark badges on study section list
- Analytics time-range filter (7d / 30d / 90d) in admin panel

Phase 2 — Medium features:
- Related episodes on archived series detail pages
- Resource library two-tier filter (type + tag chips)
- Global search (Fuse.js) moved below sticky header as full-width bar
- Q&A anonymous upvoting with localStorage dedup + admin pin/unpin
- Study enrollment funnel tracking (firstVisitAt, firstCompletionAt) with funnel chart in analytics

Phase 3 — Larger features:
- Study section comments (auto-approve for enrolled users, admin moderation panel)
- Study completion certificate (canvas render, PNG download, shareable public URL)
- Episode script full-text search (mammoth docx extraction, server-side search, admin upload UI)
- Reflection questions renamed from Discussion Questions; quiz answers can be shared to section discussion
- Public certificate route at /certificate/:token with og meta tags
- Comment moderation panel added to admin under Manage > Study Comments

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
nmemmert
2026-06-09 09:10:29 -04:00
parent 9ad24df626
commit c4645e3475
24 changed files with 2991 additions and 76 deletions
+73
View File
@@ -17,6 +17,9 @@ import {
STUDY_NOTES_FILE,
STUDY_PROGRESS_DIR,
STUDY_REMINDERS_FILE,
STUDY_COMMENTS_FILE,
STUDY_CERTIFICATES_FILE,
EPISODE_SCRIPTS_FILE,
REPLY_TEMPLATES_FILE,
REPLY_HISTORY_FILE,
PODCAST_CHECKLIST_FILE,
@@ -35,6 +38,7 @@ import {
MAX_STUDY_ENROLLMENTS_PER_USER,
MAX_STUDY_NOTES_PER_USER,
MAX_STUDY_NOTE_LENGTH,
MAX_STUDY_COMMENTS,
DEFAULT_PODCAST_CHECKLIST_TASKS,
buildDefaultPodcastChecklist,
} from './config.js'
@@ -572,6 +576,75 @@ export async function loadStudyRemindersFromDisk() {
}
}
// ── Study section comments ─────────────────────────────────────────────────
export function queueStudyCommentsWrite() {
state.studyCommentsWritePromise = state.studyCommentsWritePromise
.then(async () => {
await mkdir(DATA_DIR, { recursive: true })
await writeFile(STUDY_COMMENTS_FILE, JSON.stringify(state.studyComments, null, 2), 'utf8')
})
.catch(err => {
console.error('[study-comments] failed to write:', err)
})
}
export async function loadStudyCommentsFromDisk() {
try {
const raw = await readFile(STUDY_COMMENTS_FILE, 'utf8')
const parsed = JSON.parse(raw)
state.studyComments = Array.isArray(parsed) ? parsed.slice(0, MAX_STUDY_COMMENTS) : []
} catch {
state.studyComments = []
}
}
// ── Study certificates ─────────────────────────────────────────────────────
export function queueStudyCertificatesWrite() {
state.studyCertificatesWritePromise = state.studyCertificatesWritePromise
.then(async () => {
await mkdir(DATA_DIR, { recursive: true })
await writeFile(STUDY_CERTIFICATES_FILE, JSON.stringify(state.studyCertificates, null, 2), 'utf8')
})
.catch(err => {
console.error('[study-certificates] failed to write:', err)
})
}
export async function loadStudyCertificatesFromDisk() {
try {
const raw = await readFile(STUDY_CERTIFICATES_FILE, 'utf8')
const parsed = JSON.parse(raw)
state.studyCertificates = Array.isArray(parsed) ? parsed : []
} catch {
state.studyCertificates = []
}
}
// ── Episode scripts ───────────────────────────────────────────────────────
export function queueEpisodeScriptsWrite() {
state.episodeScriptsWritePromise = state.episodeScriptsWritePromise
.then(async () => {
await mkdir(DATA_DIR, { recursive: true })
await writeFile(EPISODE_SCRIPTS_FILE, JSON.stringify(state.episodeScripts, null, 2), 'utf8')
})
.catch(err => {
console.error('[episode-scripts] failed to write:', err)
})
}
export async function loadEpisodeScriptsFromDisk() {
try {
const raw = await readFile(EPISODE_SCRIPTS_FILE, 'utf8')
const parsed = JSON.parse(raw)
state.episodeScripts = (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) ? parsed : {}
} catch {
state.episodeScripts = {}
}
}
// ── Download counts ────────────────────────────────────────────────────────
export function queueDownloadCountsWrite() {