docs(02-02): complete contact form plan — SUMMARY, STATE, plans tracked
- Create 02-02-SUMMARY.md: contact form outcomes, decisions, deviations - Update STATE.md: position, decisions (nodemailer v7 pin, useActionState React 19, honeypot pattern) - Add 02-01-PLAN.md, 02-02-PLAN.md, 02-03-PLAN.md to version control - Mark MKTG-03 requirement complete Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -88,5 +88,5 @@ None yet.
|
||||
## Session Continuity
|
||||
|
||||
Last session: 2026-03-19
|
||||
Stopped at: Completed 02-01-PLAN.md — Marketing site shell: sticky nav, hero section with next/image, testimonials carousel, listings placeholder, site footer
|
||||
Stopped at: Completed 02-02-PLAN.md — Contact form: Nodemailer SMTP mailer, Server Action with Zod+honeypot, ContactSection client component
|
||||
Resume file: None
|
||||
|
||||
172
.planning/phases/02-marketing-site/02-01-PLAN.md
Normal file
172
.planning/phases/02-marketing-site/02-01-PLAN.md
Normal file
@@ -0,0 +1,172 @@
|
||||
---
|
||||
phase: 02-marketing-site
|
||||
plan: 01
|
||||
type: execute
|
||||
wave: 1
|
||||
depends_on: []
|
||||
files_modified:
|
||||
- teressa-copeland-homes/app/page.tsx
|
||||
- teressa-copeland-homes/app/_components/SiteNav.tsx
|
||||
- teressa-copeland-homes/app/_components/HeroSection.tsx
|
||||
- teressa-copeland-homes/app/_components/TestimonialsSection.tsx
|
||||
- teressa-copeland-homes/app/_components/ListingsPlaceholder.tsx
|
||||
- teressa-copeland-homes/app/_components/SiteFooter.tsx
|
||||
- teressa-copeland-homes/app/globals.css
|
||||
autonomous: true
|
||||
requirements:
|
||||
- MKTG-01
|
||||
- MKTG-02
|
||||
- MKTG-04
|
||||
|
||||
must_haves:
|
||||
truths:
|
||||
- "Visitor sees a split-panel hero with Teressa's photo on the left and bio copy on the right"
|
||||
- "Visitor sees an auto-scrolling testimonials carousel that rotates every 5 seconds and pauses on hover"
|
||||
- "Visitor sees a 'Listings Coming Soon' placeholder section with brand styling"
|
||||
- "Sticky nav stays visible on scroll and anchor links smooth-scroll to each section"
|
||||
- "Footer shows Teressa's name, license number (with verify comment), and copyright year"
|
||||
artifacts:
|
||||
- path: "teressa-copeland-homes/app/page.tsx"
|
||||
provides: "Homepage route — composes all section components in correct order"
|
||||
- path: "teressa-copeland-homes/app/_components/SiteNav.tsx"
|
||||
provides: "Sticky nav with wordmark, desktop links, mobile hamburger"
|
||||
- path: "teressa-copeland-homes/app/_components/HeroSection.tsx"
|
||||
provides: "Split-panel hero with next/image + placeholder copy"
|
||||
- path: "teressa-copeland-homes/app/_components/TestimonialsSection.tsx"
|
||||
provides: "Auto-scrolling carousel — useState/useEffect, arrows, dots"
|
||||
- path: "teressa-copeland-homes/app/_components/ListingsPlaceholder.tsx"
|
||||
provides: "Listings coming soon section with brand colors"
|
||||
- path: "teressa-copeland-homes/app/_components/SiteFooter.tsx"
|
||||
provides: "Footer with name, license number, copyright, nav links"
|
||||
key_links:
|
||||
- from: "teressa-copeland-homes/app/page.tsx"
|
||||
to: "app/_components/*.tsx"
|
||||
via: "named imports, composed in section order"
|
||||
pattern: "import.*from.*_components"
|
||||
- from: "teressa-copeland-homes/app/_components/SiteNav.tsx"
|
||||
to: "section ids (hero, about, listings, contact)"
|
||||
via: "href anchor links + CSS scroll-behavior: smooth"
|
||||
pattern: "href=\"#"
|
||||
- from: "teressa-copeland-homes/app/_components/TestimonialsSection.tsx"
|
||||
to: "interval cleanup"
|
||||
via: "useEffect return clearInterval"
|
||||
pattern: "clearInterval"
|
||||
---
|
||||
|
||||
<objective>
|
||||
Build the static visual shell of the public homepage: sticky nav, hero section, testimonials carousel, listings placeholder, and footer. No external services — pure React/Next.js components styled with brand colors.
|
||||
|
||||
Purpose: Establishes the public face of teressacopelandhomes.com with Teressa's professional brand presence.
|
||||
Output: Six component files + updated page.tsx and globals.css.
|
||||
</objective>
|
||||
|
||||
<execution_context>
|
||||
@/Users/ccopeland/.claude/get-shit-done/workflows/execute-plan.md
|
||||
@/Users/ccopeland/.claude/get-shit-done/templates/summary.md
|
||||
</execution_context>
|
||||
|
||||
<context>
|
||||
@/Users/ccopeland/temp/red/.planning/PROJECT.md
|
||||
@/Users/ccopeland/temp/red/.planning/ROADMAP.md
|
||||
@/Users/ccopeland/temp/red/.planning/phases/02-marketing-site/02-CONTEXT.md
|
||||
@/Users/ccopeland/temp/red/.planning/phases/02-marketing-site/02-RESEARCH.md
|
||||
|
||||
Brand colors: navy #1B2B4B, gold #C9A84C, cream #FAF9F7
|
||||
Hero photo: public/red.jpg (already in project)
|
||||
</context>
|
||||
|
||||
<tasks>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 1: Scaffold page route and section components (nav, hero, listings, footer)</name>
|
||||
<files>
|
||||
teressa-copeland-homes/app/page.tsx
|
||||
teressa-copeland-homes/app/_components/SiteNav.tsx
|
||||
teressa-copeland-homes/app/_components/HeroSection.tsx
|
||||
teressa-copeland-homes/app/_components/ListingsPlaceholder.tsx
|
||||
teressa-copeland-homes/app/_components/SiteFooter.tsx
|
||||
teressa-copeland-homes/app/globals.css
|
||||
</files>
|
||||
<action>
|
||||
1. Add `html { scroll-behavior: smooth; }` and `section[id] { scroll-margin-top: 72px; }` to globals.css.
|
||||
|
||||
2. Create `app/_components/SiteNav.tsx` — 'use client'. Sticky nav (position: sticky, top: 0, z-index: 50, background #1B2B4B, color #FAF9F7). Left: wordmark "Teressa Copeland" bold. Right: desktop anchor links (Home→#hero, About→#about, Listings→#listings, Contact→#contact) hidden on mobile. Mobile: hamburger Menu/X icon from lucide-react toggles a dropdown drawer with the same links. On mobile link click, close the drawer. Check if lucide-react is installed (`grep lucide teressa-copeland-homes/package.json`); if absent, run `npm install lucide-react` first from the teressa-copeland-homes directory.
|
||||
|
||||
3. Create `app/_components/HeroSection.tsx` — server component. Section id="hero". Split-panel layout: left half = `<div style={{ position: 'relative', minHeight: '500px' }}>` with `<Image src="/red.jpg" alt="Teressa Copeland" fill style={{ objectFit: 'cover', objectPosition: 'center top' }} priority />`. Right half = flex column: headline, subheading, bio paragraph, and "Get in Touch" button (href="#contact", background #C9A84C, color #1B2B4B). ALL copy must be wrapped in clearly labelled comments:
|
||||
```
|
||||
{/* PLACEHOLDER HEADLINE — replace before launch */}
|
||||
{/* PLACEHOLDER BIO — replace before launch */}
|
||||
```
|
||||
Sample copy: headline "Your Trusted Utah Real Estate Partner", subheading "Helping Utah families find the home they deserve", bio paragraph (~3 sentences about Teressa's experience, Utah market expertise, commitment to clients). Use next/image for the photo.
|
||||
|
||||
4. Create `app/_components/ListingsPlaceholder.tsx` — server component. Section id="listings", background #1B2B4B, color #FAF9F7. Center-aligned: Home icon (lucide-react) at ~48px, heading "Listings Coming Soon", brief description ("Teressa is actively curating listings in your area. Check back soon or reach out directly."). A "Contact Teressa" link button (href="#contact", border #C9A84C, color #C9A84C).
|
||||
|
||||
5. Create `app/_components/SiteFooter.tsx` — server component. Background #1B2B4B, color #FAF9F7, padding 2rem. Three rows: (1) "Teressa Copeland Homes" bold, (2) license line with comment `{/* TODO: Verify license number before launch — last two chars may be "00" (zeros) or "OO" (letters O) */}` then text "Utah Real Estate License: 14196185-SA00", (3) copyright `© {new Date().getFullYear()} Teressa Copeland Homes. All rights reserved.` Repeated nav links row (same four anchors).
|
||||
|
||||
6. Update `app/page.tsx` to import and render components in order: `<SiteNav />` → `<HeroSection />` → (TestimonialsSection placeholder) → `<ListingsPlaceholder />` → (ContactSection placeholder — just a `<section id="contact" />` stub) → `<SiteFooter />`. Page is a server component; client islands are the individual components. Remove any existing placeholder content from the Phase 1 dashboard stub if it is in page.tsx (it likely is not — check first).
|
||||
</action>
|
||||
<verify>
|
||||
<automated>cd /Users/ccopeland/temp/red/teressa-copeland-homes && npm run build 2>&1 | tail -20</automated>
|
||||
</verify>
|
||||
<done>Build succeeds with no TypeScript errors. All six files exist. `npm run dev` serves a page at localhost:3000 that shows the navy nav, hero split panel with photo, listings placeholder section, and footer.</done>
|
||||
</task>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 2: Build testimonials carousel component</name>
|
||||
<files>
|
||||
teressa-copeland-homes/app/_components/TestimonialsSection.tsx
|
||||
teressa-copeland-homes/app/page.tsx
|
||||
</files>
|
||||
<action>
|
||||
Create `app/_components/TestimonialsSection.tsx` — 'use client'.
|
||||
|
||||
State: `useState(0)` for activeIndex, `useState(false)` for paused. `useRef` for interval ID.
|
||||
|
||||
useEffect: When not paused, set a 5000ms interval that advances activeIndex via `setActive(i => (i + 1) % TESTIMONIALS.length)`. Cleanup MUST return `clearInterval(intervalRef.current)` — prevents memory leak on re-render.
|
||||
|
||||
Handlers: `prev()` decrements index with wraparound. `next()` increments. Dot buttons call `setActive(i)` directly.
|
||||
|
||||
Mouse events: `onMouseEnter` sets paused=true, `onMouseLeave` sets paused=false on the outer section.
|
||||
|
||||
TESTIMONIALS array — 5 entries, clearly commented as placeholders:
|
||||
```
|
||||
// PLACEHOLDER TESTIMONIALS — replace with real client reviews before launch
|
||||
{ quote: "Working with Teressa made buying our first home in Salt Lake County feel effortless. She guided us through every step with patience and expertise.", name: "Sarah Mitchell" },
|
||||
{ quote: "Teressa sold our Provo home in under a week — above asking price. Her knowledge of the Utah market is exceptional.", name: "James & Karen Olsen" },
|
||||
{ quote: "As first-time buyers, we had so many questions. Teressa answered every one and found us the perfect home in our budget.", name: "Tyler Reeves" },
|
||||
{ quote: "Relocating from out of state is stressful, but Teressa made our transition to Utah smooth and seamless.", name: "Michelle Torres" },
|
||||
{ quote: "Teressa's negotiating skills saved us thousands. We couldn't be happier with our new home in Herriman.", name: "David & Pam Christensen" },
|
||||
```
|
||||
|
||||
Layout: Section id="about", background #FAF9F7, padding generous (4rem 2rem). Center-aligned. Gold quote mark decorative. Blockquote with quote text, em dash + name attribution. Below: left ChevronLeft arrow button + right ChevronRight arrow button (from lucide-react). Below arrows: dot row — one small circle per testimonial, full opacity for active, 0.3 opacity for inactive.
|
||||
|
||||
Wire into page.tsx: replace the TestimonialsSection placeholder with `<TestimonialsSection />`.
|
||||
</action>
|
||||
<verify>
|
||||
<automated>cd /Users/ccopeland/temp/red/teressa-copeland-homes && npm run build 2>&1 | tail -20</automated>
|
||||
</verify>
|
||||
<done>Build succeeds. TestimonialsSection renders in correct position between hero and listings on the homepage. Five placeholder testimonials cycle every 5 seconds. Arrow and dot controls are present.</done>
|
||||
</task>
|
||||
|
||||
</tasks>
|
||||
|
||||
<verification>
|
||||
- `npm run build` exits 0 with no TypeScript errors
|
||||
- `app/page.tsx` renders sections in correct order: SiteNav → HeroSection → TestimonialsSection → ListingsPlaceholder → ContactSection stub → SiteFooter
|
||||
- All placeholder copy has clear `// PLACEHOLDER` comments
|
||||
- Footer license number has `// TODO: Verify` comment
|
||||
- No link to `/agent/login` anywhere on the public page
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
- Hero section shows split panel with photo on left, bio copy + "Get in Touch" CTA on right
|
||||
- Testimonials rotate automatically; arrow and dot controls work; hover pauses rotation
|
||||
- Listings placeholder section is visible with brand navy background
|
||||
- Sticky nav stays fixed on scroll; anchor links reference correct section IDs
|
||||
- Footer shows license number with verification comment
|
||||
- Build passes with zero errors
|
||||
</success_criteria>
|
||||
|
||||
<output>
|
||||
After completion, create `/Users/ccopeland/temp/red/.planning/phases/02-marketing-site/02-01-SUMMARY.md`
|
||||
</output>
|
||||
307
.planning/phases/02-marketing-site/02-02-PLAN.md
Normal file
307
.planning/phases/02-marketing-site/02-02-PLAN.md
Normal file
@@ -0,0 +1,307 @@
|
||||
---
|
||||
phase: 02-marketing-site
|
||||
plan: 02
|
||||
type: execute
|
||||
wave: 1
|
||||
depends_on: []
|
||||
files_modified:
|
||||
- teressa-copeland-homes/lib/contact-mailer.ts
|
||||
- teressa-copeland-homes/lib/contact-action.ts
|
||||
- teressa-copeland-homes/app/_components/ContactSection.tsx
|
||||
- teressa-copeland-homes/app/page.tsx
|
||||
- teressa-copeland-homes/.env.local
|
||||
autonomous: true
|
||||
requirements:
|
||||
- MKTG-03
|
||||
|
||||
user_setup:
|
||||
- service: nodemailer_smtp
|
||||
why: "Contact form email delivery to Teressa's inbox"
|
||||
env_vars:
|
||||
- name: CONTACT_EMAIL_USER
|
||||
source: "Teressa's email address (e.g. teressa@teressacopelandhomes.com or Gmail address)"
|
||||
- name: CONTACT_EMAIL_PASS
|
||||
source: "Gmail: Google Account → Security → App Passwords (requires 2FA enabled). Other providers: SMTP password from hosting control panel."
|
||||
- name: CONTACT_SMTP_HOST
|
||||
source: "Gmail: smtp.gmail.com | Namecheap: mail.privateemail.com | Other: check hosting provider docs"
|
||||
- name: CONTACT_SMTP_PORT
|
||||
source: "587 for STARTTLS (recommended) or 465 for SSL"
|
||||
|
||||
must_haves:
|
||||
truths:
|
||||
- "Visitor can fill in name, email, phone, and message and submit the contact form"
|
||||
- "On success, the form is replaced with 'Thanks! Teressa will be in touch soon.'"
|
||||
- "Submissions with the honeypot field filled are silently discarded (no email sent)"
|
||||
- "Server-side Zod validation rejects missing required fields"
|
||||
- "SMTP credentials are read from env vars — never hardcoded"
|
||||
artifacts:
|
||||
- path: "teressa-copeland-homes/lib/contact-mailer.ts"
|
||||
provides: "Nodemailer transporter + sendContactEmail() function"
|
||||
exports: ["sendContactEmail"]
|
||||
- path: "teressa-copeland-homes/lib/contact-action.ts"
|
||||
provides: "Server Action — validates with Zod, checks honeypot, calls mailer"
|
||||
exports: ["submitContact", "ContactState"]
|
||||
- path: "teressa-copeland-homes/app/_components/ContactSection.tsx"
|
||||
provides: "Client component — useActionState form with honeypot, success swap"
|
||||
key_links:
|
||||
- from: "teressa-copeland-homes/app/_components/ContactSection.tsx"
|
||||
to: "teressa-copeland-homes/lib/contact-action.ts"
|
||||
via: "useActionState(submitContact, initialState)"
|
||||
pattern: "useActionState"
|
||||
- from: "teressa-copeland-homes/lib/contact-action.ts"
|
||||
to: "teressa-copeland-homes/lib/contact-mailer.ts"
|
||||
via: "await sendContactEmail(parsed.data)"
|
||||
pattern: "sendContactEmail"
|
||||
- from: "teressa-copeland-homes/lib/contact-mailer.ts"
|
||||
to: "process.env.CONTACT_EMAIL_USER / CONTACT_EMAIL_PASS"
|
||||
via: "nodemailer.createTransport auth object"
|
||||
pattern: "process\\.env\\.CONTACT"
|
||||
---
|
||||
|
||||
<objective>
|
||||
Build the contact form: Nodemailer SMTP mailer utility, Server Action with Zod validation and honeypot check, and the client-side form component with success-state swap.
|
||||
|
||||
Purpose: Visitors can reach Teressa directly from the homepage without any third-party form service.
|
||||
Output: lib/contact-mailer.ts, lib/contact-action.ts, app/_components/ContactSection.tsx wired into page.tsx.
|
||||
</objective>
|
||||
|
||||
<execution_context>
|
||||
@/Users/ccopeland/.claude/get-shit-done/workflows/execute-plan.md
|
||||
@/Users/ccopeland/.claude/get-shit-done/templates/summary.md
|
||||
</execution_context>
|
||||
|
||||
<context>
|
||||
@/Users/ccopeland/temp/red/.planning/phases/02-marketing-site/02-CONTEXT.md
|
||||
@/Users/ccopeland/temp/red/.planning/phases/02-marketing-site/02-RESEARCH.md
|
||||
|
||||
Key patterns from research:
|
||||
- Use `useActionState` from 'react' (NOT useFormState from react-dom — removed in React 19)
|
||||
- Nodemailer `from` must match CONTACT_EMAIL_USER; use `replyTo` for visitor's email
|
||||
- Honeypot field name="website" with display:none, tabIndex={-1}, autoComplete="off"
|
||||
- Server Action file must have 'use server' directive at top
|
||||
</context>
|
||||
|
||||
<tasks>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 1: Install nodemailer and create mailer + server action</name>
|
||||
<files>
|
||||
teressa-copeland-homes/lib/contact-mailer.ts
|
||||
teressa-copeland-homes/lib/contact-action.ts
|
||||
</files>
|
||||
<action>
|
||||
1. Install dependencies from the teressa-copeland-homes directory:
|
||||
```bash
|
||||
cd /Users/ccopeland/temp/red/teressa-copeland-homes
|
||||
npm install nodemailer
|
||||
npm install --save-dev @types/nodemailer
|
||||
```
|
||||
|
||||
2. Create `lib/contact-mailer.ts`:
|
||||
```typescript
|
||||
import nodemailer from 'nodemailer'
|
||||
|
||||
const transporter = nodemailer.createTransport({
|
||||
host: process.env.CONTACT_SMTP_HOST,
|
||||
port: Number(process.env.CONTACT_SMTP_PORT ?? 587),
|
||||
secure: false, // STARTTLS on port 587
|
||||
auth: {
|
||||
user: process.env.CONTACT_EMAIL_USER,
|
||||
pass: process.env.CONTACT_EMAIL_PASS,
|
||||
},
|
||||
})
|
||||
|
||||
export async function sendContactEmail(data: {
|
||||
name: string
|
||||
email: string
|
||||
phone: string
|
||||
message: string
|
||||
}) {
|
||||
await transporter.sendMail({
|
||||
from: `"Teressa Copeland Homes Website" <${process.env.CONTACT_EMAIL_USER}>`,
|
||||
replyTo: data.email,
|
||||
to: process.env.CONTACT_EMAIL_USER,
|
||||
subject: `New contact from ${data.name} — Teressa Copeland Homes`,
|
||||
text: `Name: ${data.name}\nEmail: ${data.email}\nPhone: ${data.phone}\n\nMessage:\n${data.message}`,
|
||||
html: `<p><strong>Name:</strong> ${data.name}</p>
|
||||
<p><strong>Email:</strong> <a href="mailto:${data.email}">${data.email}</a></p>
|
||||
<p><strong>Phone:</strong> ${data.phone}</p>
|
||||
<p><strong>Message:</strong></p>
|
||||
<p>${data.message.replace(/\n/g, '<br/>')}</p>`,
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
3. Create `lib/contact-action.ts`:
|
||||
```typescript
|
||||
'use server'
|
||||
|
||||
import { z } from 'zod'
|
||||
import { sendContactEmail } from './contact-mailer'
|
||||
|
||||
const ContactSchema = z.object({
|
||||
name: z.string().min(1, 'Name is required'),
|
||||
email: z.string().email('Valid email address required'),
|
||||
phone: z.string().min(7, 'Phone number is required'),
|
||||
message: z.string().min(10, 'Message must be at least 10 characters'),
|
||||
website: z.string(), // honeypot — must remain empty
|
||||
})
|
||||
|
||||
export type ContactState = {
|
||||
status: 'idle' | 'success' | 'error'
|
||||
message?: string
|
||||
}
|
||||
|
||||
export async function submitContact(
|
||||
_prev: ContactState,
|
||||
formData: FormData,
|
||||
): Promise<ContactState> {
|
||||
const raw = {
|
||||
name: formData.get('name'),
|
||||
email: formData.get('email'),
|
||||
phone: formData.get('phone'),
|
||||
message: formData.get('message'),
|
||||
website: formData.get('website') ?? '',
|
||||
}
|
||||
|
||||
const parsed = ContactSchema.safeParse(raw)
|
||||
if (!parsed.success) {
|
||||
return { status: 'error', message: 'Please fill in all required fields correctly.' }
|
||||
}
|
||||
|
||||
// Honeypot check — if filled, silently succeed (don't reveal rejection to bots)
|
||||
if (parsed.data.website !== '') {
|
||||
return { status: 'success' }
|
||||
}
|
||||
|
||||
try {
|
||||
await sendContactEmail(parsed.data)
|
||||
return { status: 'success' }
|
||||
} catch (err) {
|
||||
console.error('Contact form email error:', err)
|
||||
return { status: 'error', message: 'Something went wrong. Please try again or call directly.' }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
4. Add SMTP placeholder vars to `.env.local` (append — do not overwrite existing vars):
|
||||
```
|
||||
# Contact form SMTP — fill in before testing email delivery
|
||||
CONTACT_EMAIL_USER=your_email@example.com
|
||||
CONTACT_EMAIL_PASS=your_app_password
|
||||
CONTACT_SMTP_HOST=smtp.gmail.com
|
||||
CONTACT_SMTP_PORT=587
|
||||
```
|
||||
</action>
|
||||
<verify>
|
||||
<automated>cd /Users/ccopeland/temp/red/teressa-copeland-homes && npm run build 2>&1 | tail -20</automated>
|
||||
</verify>
|
||||
<done>Build succeeds. lib/contact-mailer.ts and lib/contact-action.ts exist with no TypeScript errors. nodemailer appears in package.json dependencies.</done>
|
||||
</task>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 2: Build ContactSection client component and wire into page</name>
|
||||
<files>
|
||||
teressa-copeland-homes/app/_components/ContactSection.tsx
|
||||
teressa-copeland-homes/app/page.tsx
|
||||
</files>
|
||||
<action>
|
||||
Create `app/_components/ContactSection.tsx` — 'use client':
|
||||
|
||||
```typescript
|
||||
'use client'
|
||||
import { useActionState } from 'react'
|
||||
import { submitContact, type ContactState } from '@/lib/contact-action'
|
||||
|
||||
const initialState: ContactState = { status: 'idle' }
|
||||
|
||||
export function ContactSection() {
|
||||
const [state, action, pending] = useActionState(submitContact, initialState)
|
||||
|
||||
return (
|
||||
<section id="contact" style={{ backgroundColor: '#FAF9F7', padding: '4rem 2rem' }}>
|
||||
<div style={{ maxWidth: '600px', margin: '0 auto' }}>
|
||||
<h2 style={{ color: '#1B2B4B', marginBottom: '0.5rem' }}>Get in Touch</h2>
|
||||
<p style={{ color: '#555', marginBottom: '2rem' }}>
|
||||
Ready to find your Utah home? Teressa is here to help.
|
||||
</p>
|
||||
|
||||
{state.status === 'success' ? (
|
||||
<div role="status" style={{ padding: '2rem', backgroundColor: '#e8f5e9', borderRadius: '8px', color: '#2e7d32', textAlign: 'center' }}>
|
||||
<p style={{ fontSize: '1.1rem', fontWeight: 600 }}>Thanks! Teressa will be in touch soon.</p>
|
||||
</div>
|
||||
) : (
|
||||
<form action={action} style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
|
||||
{/* Honeypot — hidden from humans, bots fill it in */}
|
||||
<input
|
||||
name="website"
|
||||
type="text"
|
||||
style={{ display: 'none' }}
|
||||
tabIndex={-1}
|
||||
autoComplete="off"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
|
||||
<input name="name" type="text" required placeholder="Your full name" />
|
||||
<input name="email" type="email" required placeholder="Email address" />
|
||||
<input name="phone" type="tel" required placeholder="Phone number" />
|
||||
<textarea name="message" required placeholder="How can Teressa help you?" rows={5} />
|
||||
|
||||
{state.status === 'error' && (
|
||||
<p role="alert" style={{ color: '#c62828' }}>{state.message}</p>
|
||||
)}
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
disabled={pending}
|
||||
style={{
|
||||
backgroundColor: '#C9A84C',
|
||||
color: '#1B2B4B',
|
||||
padding: '0.75rem 2rem',
|
||||
border: 'none',
|
||||
borderRadius: '4px',
|
||||
fontWeight: 700,
|
||||
cursor: pending ? 'not-allowed' : 'pointer',
|
||||
opacity: pending ? 0.7 : 1,
|
||||
}}
|
||||
>
|
||||
{pending ? 'Sending...' : 'Send Message'}
|
||||
</button>
|
||||
</form>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
Update `app/page.tsx`: replace the `<section id="contact" />` stub with `<ContactSection />`. Import ContactSection at the top. Ensure all section imports are present and in correct order: SiteNav, HeroSection, TestimonialsSection (from plan 01), ListingsPlaceholder, ContactSection, SiteFooter.
|
||||
</action>
|
||||
<verify>
|
||||
<automated>cd /Users/ccopeland/temp/red/teressa-copeland-homes && npm run build 2>&1 | tail -20</automated>
|
||||
</verify>
|
||||
<done>Build succeeds. ContactSection renders a form with name, email, phone, message fields and a gold "Send Message" button. Form wires to submitContact server action via useActionState.</done>
|
||||
</task>
|
||||
|
||||
</tasks>
|
||||
|
||||
<verification>
|
||||
- `npm run build` exits 0
|
||||
- `lib/contact-action.ts` has 'use server' at top
|
||||
- `useActionState` imported from 'react' (not react-dom)
|
||||
- Honeypot field has display:none, tabIndex={-1}, autoComplete="off"
|
||||
- No SMTP credentials hardcoded — all from process.env.*
|
||||
- `.env.local` has CONTACT_* placeholder vars with instructions
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
- Contact form renders with all four required fields
|
||||
- Submitting with the honeypot filled returns success without sending email
|
||||
- Missing required fields return an error message
|
||||
- On real success, form is replaced by thank-you message
|
||||
- Build passes with zero TypeScript errors
|
||||
</success_criteria>
|
||||
|
||||
<output>
|
||||
After completion, create `/Users/ccopeland/temp/red/.planning/phases/02-marketing-site/02-02-SUMMARY.md`
|
||||
</output>
|
||||
137
.planning/phases/02-marketing-site/02-02-SUMMARY.md
Normal file
137
.planning/phases/02-marketing-site/02-02-SUMMARY.md
Normal file
@@ -0,0 +1,137 @@
|
||||
---
|
||||
phase: 02-marketing-site
|
||||
plan: 02
|
||||
subsystem: ui
|
||||
tags: [nodemailer, smtp, react, server-actions, zod, honeypot, forms]
|
||||
|
||||
# Dependency graph
|
||||
requires:
|
||||
- phase: 02-marketing-site-01
|
||||
provides: ContactSection stub in page.tsx (_components directory, page structure)
|
||||
provides:
|
||||
- Nodemailer SMTP transporter + sendContactEmail() in src/lib/contact-mailer.ts
|
||||
- Server Action with Zod validation and honeypot check in src/lib/contact-action.ts
|
||||
- ContactSection client component with useActionState form in src/app/_components/ContactSection.tsx
|
||||
- CONTACT_* env var placeholders in .env.local for SMTP configuration
|
||||
affects: [02-marketing-site-03, phase-6-signing-flow]
|
||||
|
||||
# Tech tracking
|
||||
tech-stack:
|
||||
added: [nodemailer@^7.0.7, @types/nodemailer]
|
||||
patterns: [Server Action with useActionState, honeypot spam protection, Zod server-side validation, env var SMTP credentials]
|
||||
|
||||
key-files:
|
||||
created:
|
||||
- teressa-copeland-homes/src/lib/contact-mailer.ts
|
||||
- teressa-copeland-homes/src/lib/contact-action.ts
|
||||
- teressa-copeland-homes/src/app/_components/ContactSection.tsx
|
||||
modified:
|
||||
- teressa-copeland-homes/src/app/page.tsx
|
||||
- teressa-copeland-homes/package.json
|
||||
- teressa-copeland-homes/package-lock.json
|
||||
|
||||
key-decisions:
|
||||
- "nodemailer pinned to ^7.0.7 — v8 was initially installed but conflicts with next-auth@5.0.0-beta.30 peerOptional dep requiring ^7.0.7"
|
||||
- "useActionState imported from 'react' not 'react-dom' — correct API for React 19 / Next.js 16"
|
||||
- "Honeypot field silent success pattern: bots get status=success without email sent, preventing bot discovery of rejection"
|
||||
- "SMTP credentials exclusively via process.env.CONTACT_* — zero hardcoded values"
|
||||
|
||||
patterns-established:
|
||||
- "Server Actions: 'use server' at top of file, exported typed action function signature (_prev: State, formData: FormData)"
|
||||
- "Client forms: useActionState(serverAction, initialState) — React 19 pattern"
|
||||
- "Honeypot: name=website, display:none, tabIndex=-1, autoComplete=off, aria-hidden=true"
|
||||
|
||||
requirements-completed: [MKTG-03]
|
||||
|
||||
# Metrics
|
||||
duration: 4min
|
||||
completed: 2026-03-19
|
||||
---
|
||||
|
||||
# Phase 2 Plan 02: Contact Form Summary
|
||||
|
||||
**Nodemailer SMTP contact form with Zod server-side validation, honeypot spam protection, and useActionState success-swap UI**
|
||||
|
||||
## Performance
|
||||
|
||||
- **Duration:** ~4 min
|
||||
- **Started:** 2026-03-19T20:57:00Z
|
||||
- **Completed:** 2026-03-19T21:02:07Z
|
||||
- **Tasks:** 2
|
||||
- **Files modified:** 5 (3 created, 2 modified)
|
||||
|
||||
## Accomplishments
|
||||
- Nodemailer transporter wired to SMTP via env vars — `sendContactEmail()` sends HTML + plain text emails
|
||||
- Server Action with Zod schema validates all required fields server-side and silently discards honeypot-filled submissions
|
||||
- ContactSection client component renders 4-field form, shows inline error alerts, and replaces itself with thank-you message on success
|
||||
|
||||
## Task Commits
|
||||
|
||||
Each task was committed atomically:
|
||||
|
||||
1. **Task 1: Install nodemailer and create mailer + server action** - `39f233d` (feat)
|
||||
2. **Task 2: Build ContactSection client component and wire into page** - `47c6dd9` (feat)
|
||||
|
||||
## Files Created/Modified
|
||||
- `src/lib/contact-mailer.ts` - Nodemailer transporter + `sendContactEmail()` with HTML/text body
|
||||
- `src/lib/contact-action.ts` - `'use server'` action: Zod validation, honeypot check, mailer call
|
||||
- `src/app/_components/ContactSection.tsx` - Client component with useActionState, success swap, error alert
|
||||
- `src/app/page.tsx` - Replaced `<section id="contact" />` stub with `<ContactSection />`
|
||||
- `package.json / package-lock.json` - nodemailer@^7.0.7 and @types/nodemailer added
|
||||
|
||||
## Decisions Made
|
||||
- **nodemailer v7 not v8:** next-auth@5.0.0-beta.30 declares `peerOptional nodemailer@"^7.0.7"` which conflicts with v8. Installed `^7.0.7` explicitly.
|
||||
- **useActionState from 'react':** Per plan research notes, `useFormState` from react-dom was removed in React 19. Using the React 19 canonical API.
|
||||
- **Honeypot silent success:** Bots that fill the hidden field receive `{ status: 'success' }` — they never learn submissions were discarded.
|
||||
|
||||
## Deviations from Plan
|
||||
|
||||
### Auto-fixed Issues
|
||||
|
||||
**1. [Rule 3 - Blocking] Pinned nodemailer to v7 to satisfy next-auth peer dep**
|
||||
- **Found during:** Task 1 (npm install)
|
||||
- **Issue:** `npm install nodemailer` installed v8.0.3; npm ERESOLVE error because next-auth@5.0.0-beta.30 requires `peerOptional nodemailer@"^7.0.7"`
|
||||
- **Fix:** Installed `nodemailer@^7.0.7` explicitly instead
|
||||
- **Files modified:** package.json, package-lock.json
|
||||
- **Verification:** `npm install` completed without ERESOLVE; build passes
|
||||
- **Committed in:** `39f233d` (Task 1 commit)
|
||||
|
||||
---
|
||||
|
||||
**Total deviations:** 1 auto-fixed (1 blocking dependency conflict)
|
||||
**Impact on plan:** Version pin was necessary to avoid peer dependency conflict with next-auth. Nodemailer v7 API is identical for this use case.
|
||||
|
||||
## Issues Encountered
|
||||
- nodemailer v8 conflicts with next-auth@5.0.0-beta.30 peer dep — resolved by using v7 (same API surface for SMTP transport)
|
||||
|
||||
## User Setup Required
|
||||
|
||||
Before contact form email delivery works, Teressa must configure SMTP credentials in `.env.local`:
|
||||
|
||||
```
|
||||
CONTACT_EMAIL_USER=teressa@teressacopelandhomes.com # or Gmail address
|
||||
CONTACT_EMAIL_PASS=your_app_password # Gmail: App Password (requires 2FA)
|
||||
CONTACT_SMTP_HOST=smtp.gmail.com # or mail.privateemail.com for Namecheap
|
||||
CONTACT_SMTP_PORT=587 # 587 STARTTLS recommended
|
||||
```
|
||||
|
||||
For Gmail: Google Account → Security → 2-Step Verification → App passwords → generate one for "Mail".
|
||||
|
||||
## Next Phase Readiness
|
||||
- Contact form fully wired and builds cleanly — ready for Plan 03 (remaining homepage sections if any)
|
||||
- SMTP credentials must be provided before live email delivery works in production
|
||||
- DNS (SPF/DKIM/DMARC) for teressacopelandhomes.com must be configured before emails reach real clients reliably (existing blocker from Phase 1)
|
||||
|
||||
## Self-Check: PASSED
|
||||
|
||||
- FOUND: teressa-copeland-homes/src/lib/contact-mailer.ts
|
||||
- FOUND: teressa-copeland-homes/src/lib/contact-action.ts
|
||||
- FOUND: teressa-copeland-homes/src/app/_components/ContactSection.tsx
|
||||
- FOUND: .planning/phases/02-marketing-site/02-02-SUMMARY.md
|
||||
- FOUND: commit 39f233d (Task 1 — nodemailer + mailer + server action)
|
||||
- FOUND: commit 47c6dd9 (Task 2 — ContactSection component + page.tsx wiring)
|
||||
- Build: passes with zero TypeScript errors
|
||||
|
||||
---
|
||||
*Phase: 02-marketing-site*
|
||||
*Completed: 2026-03-19*
|
||||
130
.planning/phases/02-marketing-site/02-03-PLAN.md
Normal file
130
.planning/phases/02-marketing-site/02-03-PLAN.md
Normal file
@@ -0,0 +1,130 @@
|
||||
---
|
||||
phase: 02-marketing-site
|
||||
plan: 03
|
||||
type: execute
|
||||
wave: 2
|
||||
depends_on:
|
||||
- "02-01"
|
||||
- "02-02"
|
||||
files_modified: []
|
||||
autonomous: false
|
||||
requirements:
|
||||
- MKTG-01
|
||||
- MKTG-02
|
||||
- MKTG-03
|
||||
- MKTG-04
|
||||
|
||||
must_haves:
|
||||
truths:
|
||||
- "Visitor sees Teressa's photo and professional bio in the hero section"
|
||||
- "Visitor sees the testimonials carousel rotating automatically"
|
||||
- "Visitor sees the listings coming soon section"
|
||||
- "Visitor can submit the contact form and see the thank-you message"
|
||||
- "Sticky nav scrolls to correct sections"
|
||||
artifacts:
|
||||
- path: "teressa-copeland-homes/app/page.tsx"
|
||||
provides: "Assembled homepage at localhost:3000"
|
||||
- path: "teressa-copeland-homes/lib/contact-action.ts"
|
||||
provides: "Working server action"
|
||||
key_links:
|
||||
- from: "Contact form"
|
||||
to: "submitContact server action"
|
||||
via: "form submission in browser"
|
||||
pattern: "network request to server action"
|
||||
---
|
||||
|
||||
<objective>
|
||||
Human verification of the complete Phase 2 marketing site before marking the phase complete.
|
||||
|
||||
Purpose: Confirm all four MKTG requirements are visually correct and the contact form works end-to-end in a real browser.
|
||||
Output: Phase 2 marked complete (or issues fed back for gap closure).
|
||||
</objective>
|
||||
|
||||
<execution_context>
|
||||
@/Users/ccopeland/.claude/get-shit-done/workflows/execute-plan.md
|
||||
@/Users/ccopeland/.claude/get-shit-done/templates/summary.md
|
||||
</execution_context>
|
||||
|
||||
<context>
|
||||
@/Users/ccopeland/temp/red/.planning/phases/02-marketing-site/02-01-SUMMARY.md
|
||||
@/Users/ccopeland/temp/red/.planning/phases/02-marketing-site/02-02-SUMMARY.md
|
||||
</context>
|
||||
|
||||
<tasks>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 1: Start dev server and run smoke check</name>
|
||||
<files></files>
|
||||
<action>
|
||||
Run the dev server and verify the page renders without runtime errors:
|
||||
|
||||
```bash
|
||||
cd /Users/ccopeland/temp/red/teressa-copeland-homes
|
||||
npm run build && echo "BUILD OK"
|
||||
```
|
||||
|
||||
Then start dev server (background) and confirm the page loads:
|
||||
```bash
|
||||
npm run dev &
|
||||
sleep 3
|
||||
curl -s -o /dev/null -w "%{http_code}" http://localhost:3000
|
||||
```
|
||||
|
||||
Expected: HTTP 200. If not 200, read the dev server output for errors and fix before proceeding to the checkpoint.
|
||||
</action>
|
||||
<verify>
|
||||
<automated>cd /Users/ccopeland/temp/red/teressa-copeland-homes && npm run build 2>&1 | grep -E "(error|Error|BUILD)" | tail -10</automated>
|
||||
</verify>
|
||||
<done>Build succeeds and localhost:3000 returns HTTP 200.</done>
|
||||
</task>
|
||||
|
||||
<task type="checkpoint:human-verify" gate="blocking">
|
||||
<what-built>
|
||||
Complete Phase 2 marketing homepage at http://localhost:3000 including:
|
||||
- Sticky nav with wordmark and anchor links
|
||||
- Split-panel hero with Teressa's photo and placeholder bio copy
|
||||
- Auto-scrolling testimonials carousel (5 sections, arrows, dots)
|
||||
- Listings Coming Soon placeholder section
|
||||
- Contact form with name/email/phone/message fields
|
||||
- Footer with license number and copyright
|
||||
</what-built>
|
||||
<how-to-verify>
|
||||
Visit http://localhost:3000 and check each item:
|
||||
|
||||
1. STICKY NAV: Scroll down — does the nav stay fixed at the top? Do the anchor links (Home, About, Listings, Contact) scroll smoothly to the correct sections?
|
||||
|
||||
2. HERO: Does the left panel show Teressa's photo? Does the right panel show a headline, bio paragraph, and gold "Get in Touch" button? Does the button scroll to the contact form?
|
||||
|
||||
3. TESTIMONIALS: Does the carousel auto-advance after ~5 seconds? Does hovering pause it? Do the left/right arrows work? Do the dots work?
|
||||
|
||||
4. LISTINGS PLACEHOLDER: Is there a navy-background section with "Listings Coming Soon" text?
|
||||
|
||||
5. CONTACT FORM: Fill in all four fields (name, email, phone, message) and submit. Does the form show "Thanks! Teressa will be in touch soon." after submission? (Note: actual email delivery requires SMTP env vars configured — the swap to the thank-you message proves the server action ran.)
|
||||
|
||||
6. FOOTER: Is the license number present with a comment visible in the page source (`<!-- TODO: Verify license number`)? Is the copyright year correct (2026)?
|
||||
|
||||
7. MOBILE: Resize browser to ~375px wide. Does a hamburger menu appear? Does tapping it open the nav links?
|
||||
</how-to-verify>
|
||||
<resume-signal>Type "approved" if all items pass. Describe any issues (e.g., "carousel arrows not showing", "nav not sticky") and Claude will fix them.</resume-signal>
|
||||
</task>
|
||||
|
||||
</tasks>
|
||||
|
||||
<verification>
|
||||
All four MKTG requirements satisfied:
|
||||
- MKTG-01: Hero section with photo and bio visible
|
||||
- MKTG-02: Listings coming soon placeholder visible
|
||||
- MKTG-03: Contact form submits and shows success state
|
||||
- MKTG-04: Testimonials carousel visible and rotating
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
- Human approves all 7 checklist items
|
||||
- No runtime errors in browser console
|
||||
- Mobile nav works on narrow viewport
|
||||
- Phase 2 complete: public homepage is live at localhost:3000
|
||||
</success_criteria>
|
||||
|
||||
<output>
|
||||
After completion, create `/Users/ccopeland/temp/red/.planning/phases/02-marketing-site/02-03-SUMMARY.md`
|
||||
</output>
|
||||
Reference in New Issue
Block a user