c4645e3475
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>
80 lines
2.4 KiB
JavaScript
80 lines
2.4 KiB
JavaScript
import {
|
|
EMPTY_HIT_STATS,
|
|
EMPTY_VISITOR_STATS,
|
|
DEFAULT_PUBLISH_STATE,
|
|
DEFAULT_REPLY_TEMPLATES,
|
|
buildDefaultPodcastChecklist,
|
|
} from './config.js'
|
|
|
|
export const state = {
|
|
cachedSiteContent: null,
|
|
cachedDraftSiteContent: null,
|
|
publishState: { ...DEFAULT_PUBLISH_STATE },
|
|
|
|
hitStats: { ...EMPTY_HIT_STATS },
|
|
hitStatsWritePromise: Promise.resolve(),
|
|
lastHitStatsWrite: { ok: true, at: null, error: null },
|
|
|
|
visitorStats: { ...EMPTY_VISITOR_STATS },
|
|
visitorStatsWritePromise: Promise.resolve(),
|
|
lastVisitorStatsWrite: { ok: true, at: null, error: null },
|
|
|
|
contactSubmissions: [],
|
|
contactSubmissionsWritePromise: Promise.resolve(),
|
|
|
|
questions: [],
|
|
questionsWritePromise: Promise.resolve(),
|
|
|
|
draftQuestions: null,
|
|
draftQuestionsWritePromise: Promise.resolve(),
|
|
|
|
replyTemplates: [...DEFAULT_REPLY_TEMPLATES],
|
|
replyTemplatesWritePromise: Promise.resolve(),
|
|
|
|
replyHistory: [],
|
|
replyHistoryWritePromise: Promise.resolve(),
|
|
|
|
podcastChecklist: buildDefaultPodcastChecklist(),
|
|
podcastChecklistWritePromise: Promise.resolve(),
|
|
|
|
studyUsers: [],
|
|
studyUsersWritePromise: Promise.resolve(),
|
|
|
|
studyCommunityPosts: [],
|
|
studyCommunityWritePromise: Promise.resolve(),
|
|
|
|
studyReminders: { users: {}, updatedAt: new Date().toISOString() },
|
|
studyRemindersWritePromise: Promise.resolve(),
|
|
|
|
studyComments: [],
|
|
studyCommentsWritePromise: Promise.resolve(),
|
|
|
|
studyCertificates: [],
|
|
studyCertificatesWritePromise: Promise.resolve(),
|
|
|
|
// episodeScripts: { [episodeNumber]: { text, title, filename, uploadedAt } }
|
|
episodeScripts: {},
|
|
episodeScriptsWritePromise: Promise.resolve(),
|
|
|
|
downloadCounts: {},
|
|
downloadCountsWritePromise: Promise.resolve(),
|
|
|
|
lastBackupStatus: { ok: true, at: null, error: null, file: null },
|
|
lastCachePurgeStatus: { ok: true, at: null, error: null },
|
|
lastDeployHookStatus: { ok: true, at: null, error: null },
|
|
|
|
// In-memory caches (not persisted between restarts)
|
|
studyNotesCache: new Map(), // userId -> { [sectionId]: string }
|
|
studyNotesWriteQueues: new Map(), // userId -> Promise
|
|
studyProgressCache: new Map(), // userId -> { byStudy: ... }
|
|
studyProgressWriteQueues: new Map(), // userId -> Promise
|
|
|
|
studySessions: new Map(),
|
|
studyTotpPendingTokens: new Map(),
|
|
emailOtpStore: new Map(),
|
|
|
|
titusDownloadTokens: new Map(),
|
|
contactSubmitCooldownByEmail: new Map(),
|
|
resendEmailSubmissionIndex: new Map(),
|
|
}
|