From 01143d3ec9df977c0174161194e84631c8c730ba Mon Sep 17 00:00:00 2001 From: nmemmert Date: Thu, 21 May 2026 14:39:30 -0400 Subject: [PATCH] Add community question message type with pre-fill from study community --- src/colossiansStudy.tsx | 4 ++-- src/components/ContactForm.tsx | 21 ++++++++++++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/colossiansStudy.tsx b/src/colossiansStudy.tsx index 217665e..58a4b2f 100644 --- a/src/colossiansStudy.tsx +++ b/src/colossiansStudy.tsx @@ -1151,7 +1151,7 @@ export function ColossiansStudySectionPage({ content }: Props) {
Go to Community - Ask Nate + Ask Nate
@@ -1879,7 +1879,7 @@ export function StudyCommunityPage({ content }: Props) {

Talk with other enrolled students. Keep it gracious and on topic.

Back to Study - Ask Nate + Ask Nate
diff --git a/src/components/ContactForm.tsx b/src/components/ContactForm.tsx index eedc9d7..09ae72f 100644 --- a/src/components/ContactForm.tsx +++ b/src/components/ContactForm.tsx @@ -1,6 +1,6 @@ -import { useState } from 'react' +import { useState, useEffect } from 'react' import type { ChangeEvent } from 'react' -import { useNavigate } from 'react-router-dom' +import { useNavigate, useSearchParams } from 'react-router-dom' interface ContactFields { firstName: string @@ -12,13 +12,27 @@ interface ContactFields { export default function ContactForm() { const navigate = useNavigate() + const [searchParams] = useSearchParams() + const source = searchParams.get('source') + const studyName = searchParams.get('study') + const [fields, setFields] = useState({ firstName: '', lastName: '', email: '', message: '', - messageType: 'question', + messageType: source === 'community' ? 'community' : 'question', }) + + useEffect(() => { + if (source === 'community' && studyName) { + setFields(f => ({ + ...f, + messageType: 'community', + message: f.message.startsWith('[From ') ? f.message : `[From ${decodeURIComponent(studyName)} community]\n\n${f.message}`, + })) + } + }, [source, studyName]) const [subscribe, setSubscribe] = useState(true) const [honey, setHoney] = useState('') const [status, setStatus] = useState<'idle' | 'submitting' | 'error'>('idle') @@ -85,6 +99,7 @@ export default function ContactForm() { Message Type