Wire lesson discussion to community, fix search links

- Replace standalone StudySectionComments with CommunityBoard locked to
  section tag on lesson page — lesson discussion now feeds directly into
  the community system
- Quiz "share to discussion" posts to community API (not separate comments)
- "Go to Community" button no longer pre-filters by section (lesson
  discussion is now on-page)
- Add "See all community posts" link from lesson discussion block
- Fix search: download results now use correct custom-- ID format
- Fix search: episodes with a highlight page route to /episodes/:id
  internally instead of opening the external link

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
nmemmert
2026-06-09 10:23:54 -04:00
parent 75d490020b
commit ee9d76ada7
+9 -9
View File
@@ -4,7 +4,6 @@ import type { SiteContent, StudyProgram, StudySection } from './content'
import { DEFAULT_COLOSSIANS_STUDY_SECTIONS } from './colossiansStudyData'
import { usePageMeta } from './hooks/usePageMeta'
import { Breadcrumbs } from './components/Breadcrumbs'
import { StudySectionComments } from './components/StudySectionComments'
import { StudyCertificate } from './components/StudyCertificate'
type Props = { content: SiteContent }
@@ -1729,7 +1728,7 @@ export function ColossiansStudySectionPage({ content }: Props) {
</ol>
<div style={{ marginTop: '1rem', display: 'flex', gap: '0.75rem', flexWrap: 'wrap' }}>
<Link to={`/study/${study.slug}/${section.id}/quiz`} className="btn-secondary">Write My Answers</Link>
<Link to={`/study/${study.slug}/community?sectionId=${encodeURIComponent(section.id)}`} className="btn-primary">Go to Community</Link>
<Link to={`/study/${study.slug}/community`} className="btn-primary">Go to Community</Link>
<Link to={`/contact?source=community&study=${encodeURIComponent(study.title)}`} className="btn-secondary">Ask Nate</Link>
</div>
</article>
@@ -1810,11 +1809,12 @@ export function ColossiansStudySectionPage({ content }: Props) {
})()}
<article className="study-class-block">
<StudySectionComments
studySlug={currentStudySlug}
sectionId={section.id}
isEnrolled={isEnrolled}
/>
<h2>Lesson Discussion</h2>
<p className="study-detail-copy" style={{ fontSize: '0.88rem', color: '#7a7060', margin: '0 0 1rem' }}>
Share a thought or reaction with other students in this lesson.{' '}
<Link to={`/study/${study.slug}/community`} style={{ color: '#e0b840' }}>See all community posts →</Link>
</p>
<CommunityBoard study={study} auth={auth} isEnrolled={isEnrolled} sectionFilter={section.id} />
</article>
</div>
@@ -3079,10 +3079,10 @@ export function StudyQuizPage({ content }: Props) {
const questionText = section.studyQuestions?.[idx] ? `**${section.studyQuestions[idx]}**\n\n` : ''
const text = `${questionText}${answers[idx].trim()}`
try {
const res = await fetch(`/api/study-comments/${encodeURIComponent(studySlug)}/${encodeURIComponent(sectionId)}`, {
const res = await fetch('/api/study-community/posts', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ text: text.slice(0, 2000) }),
body: JSON.stringify({ studySlug, sectionId, message: text.slice(0, 2000) }),
})
if (res.ok) newlyShared.push(idx)
} catch { /* ignore individual share failures */ }