import { useState, useEffect, useRef, useCallback } from "react"; /* ─── ALL QUESTIONS ──────────────────────────────────────────────────────── */ const QUESTIONS = [ // Welcome screen { id: "welcome", type: "welcome", heading: "Performance Intake Application", sub: "This isn't a generic contact form. It's a comprehensive coaching application that lets us build a precision protocol around your specific goals, history, and life.\n\nTake your time. Be honest. The more detail you give us, the better your program will be.", tag: "Confidential · ~15 Minutes · 9 Sections", btnLabel: "Begin Application →" }, // ── 01 Personal { id: "s01", type: "section", label: "01", title: "Personal Profile", sub: "Tell us who you are" }, { id: "firstName", type: "text", section: "01", q: "What's your first name?", placeholder: "First name", required: true }, { id: "lastName", type: "text", section: "01", q: "And your last name?", placeholder: "Last name", required: true }, { id: "email", type: "email", section: "01", q: "Best email address to reach you?", placeholder: "you@email.com", required: true }, { id: "phone", type: "tel", section: "01", q: "Your phone number?", placeholder: "(555) 000-0000", required: true }, { id: "dob", type: "date", section: "01", q: "Date of birth?", required: true }, { id: "location", type: "text", section: "01", q: "What city and state are you in?", placeholder: "e.g. Birmingham, AL", required: true }, { id: "occupation", type: "text", section: "01", q: "What do you do professionally?", placeholder: "Job title or industry", required: true }, { id: "hearAbout", type: "choice", section: "01", q: "How did you hear about us?", required: true, options: ["Instagram", "Referral from a friend", "Existing client referral", "Google / Web Search", "TikTok", "Podcast", "Other"] }, { id: "hearAboutOther", type: "text", section: "01", q: "Tell us how — where did you come across us?", placeholder: "Give us the specifics...", conditional: { field: "hearAbout", value: "Other" } }, // ── 02 Goals { id: "s02", type: "section", label: "02", title: "Goals & Vision", sub: "Define your target outcome" }, { id: "primaryGoal", type: "choice", section: "02", q: "What is your #1 primary goal?", required: true, options: ["Body recomposition (lose fat, build muscle)", "Fat loss / weight loss", "Muscle building / hypertrophy", "Athletic performance", "Hormonal optimization", "Fertility support", "General health & longevity", "Post-injury comeback", "Other"] }, { id: "primaryGoalDetail", type: "long", section: "02", required: true, q: "Describe your primary goal in your own words.", hint: "What does success look like to you at the end of 90 days? Be as specific as possible." }, { id: "targetPhysique", type: "text", section: "02", q: "Do you have a target bodyweight or physique goal?", placeholder: "e.g. 185 lbs, lose 15 lbs of fat, visible abs..." }, { id: "timeline", type: "choice", section: "02", q: "What is your desired timeline for results?", required: true, options: ["30 days", "60 days", "90 days (recommended)", "6 months", "12 months", "Building for life — no set deadline"] }, { id: "motivation", type: "long", section: "02", required: true, q: "What is driving you to make this change RIGHT NOW?", hint: "What happened — or is about to happen — that made you take action today? Be honest." }, // ── 03 Training { id: "s03", type: "section", label: "03", title: "Training Background", sub: "Your history in the gym" }, { id: "trainingAge", type: "choice", section: "03", q: "How many years have you been training consistently?", required: true, options: ["Less than 1 year", "1–2 years", "2–4 years", "4–7 years", "7–10 years", "10–15 years", "15+ years"] }, { id: "trainingLevel", type: "choice", section: "03", q: "How would you honestly rate your current training level?", required: true, options: ["Beginner — new to structured training", "Novice — less than 1 year consistent", "Intermediate — some programming experience", "Advanced — multiple years with structured programs", "Elite — competitive or professional level"] }, { id: "trainingStyle", type: "multi", section: "03", q: "What training styles have you done? Select all that apply.", required: true, options: ["Bodybuilding / hypertrophy", "Powerlifting", "CrossFit / functional fitness", "HIIT", "Endurance / cardio", "Sports-specific", "Calisthenics", "Yoga / mobility", "No prior training"] }, { id: "equipment", type: "multi", section: "03", q: "What equipment do you have access to?", required: true, options: ["Full commercial gym", "Home gym with squat rack", "Dumbbells + barbells", "Kettlebells", "Cardio machines (rower, bike, treadmill)", "Sauna", "YMCA / community gym", "Resistance bands only", "Bodyweight only"] }, { id: "trainingDays", type: "choice", section: "03", q: "How many days per week can you realistically commit to training?", required: true, options: ["2 days", "3 days", "4 days", "5 days", "6 days"] }, { id: "sessionLength", type: "choice", section: "03", q: "How long can each training session realistically be?", required: true, options: ["30 minutes", "45 minutes", "60 minutes", "75 minutes", "90+ minutes", "It varies"] }, { id: "bestResults", type: "long", section: "03", q: "What type of training has produced your best results historically?", hint: "Tell us what worked and what didn't. Any style you respond especially well to?" }, { id: "burnout", type: "choice", section: "03", q: "Have you ever experienced training burnout or overtraining?", options: ["No", "Yes — briefly", "Yes — significantly, took extended time off", "Yes — currently experiencing it"] }, // ── 04 Body & Health { id: "s04", type: "section", label: "04", title: "Body Composition & Health", sub: "Where you are right now" }, { id: "currentWeight", type: "number", section: "04", q: "Current bodyweight in pounds?", placeholder: "e.g. 220", required: true }, { id: "height", type: "text", section: "04", q: "Your height?", placeholder: "e.g. 5'11\"", required: true }, { id: "currentPhysique", type: "choice", section: "04", q: "How would you honestly describe your current physique?", options: ["Very lean (under 12% BF)", "Lean (12–16% BF)", "Average (16–22% BF)", "Above average (22–28% BF)", "Significantly above goal (28%+ BF)", "Unsure"] }, { id: "weightHistory", type: "long", section: "04", required: true, q: "Describe your weight history over the past 2–3 years.", hint: "Have you gained, lost, maintained? What caused the changes? Be specific." }, { id: "medicalConditions", type: "long", section: "04", required: true, q: "Do you have any current or past medical conditions relevant to fitness and nutrition?", hint: "Hormonal, metabolic, cardiovascular, autoimmune, mental health — nothing is too minor to mention." }, { id: "injuries", type: "long", section: "04", required: true, q: "Any current or past injuries that affect training?", hint: "List body part, nature of injury, and current status. Include surgeries and movement restrictions." }, { id: "medications", type: "long", section: "04", q: "Current medications or prescribed treatments?", hint: "Include all prescriptions, hormone therapies, and physician-supervised treatments." }, { id: "hormonalHistory", type: "choice", section: "04", q: "Have you used performance-enhancing hormones or TRT?", options: ["No, never", "Yes — TRT / testosterone therapy (current)", "Yes — TRT / testosterone therapy (past)", "Yes — anabolic steroids (past)", "Yes — other hormone therapy", "Prefer not to say"] }, { id: "recentLabs", type: "choice", section: "04", q: "Have you had recent bloodwork / lab panels done?", options: ["Yes — within the last 3 months", "Yes — within the last 6 months", "Yes — over 6 months ago", "No — not recently", "No — never"] }, // ── 05 Nutrition { id: "s05", type: "section", label: "05", title: "Nutrition & Diet", sub: "What and how you eat" }, { id: "currentDiet", type: "choice", section: "05", q: "How would you describe your current diet?", required: true, options: ["Mostly whole foods, well structured", "Generally healthy but inconsistent", "Average — some good, some poor choices", "Poor — mostly processed or untracked", "Very restrictive / history of disordered eating", "Athlete-level tracking and precision"] }, { id: "proteinTracking", type: "choice", section: "05", q: "Are you currently tracking protein intake?", required: true, options: ["Yes — accurately with a food scale", "Yes — loosely estimating", "No — but I'm aware of it", "No — not tracking at all"] }, { id: "estimatedProtein", type: "text", section: "05", q: "Rough daily protein intake estimate?", placeholder: "e.g. ~150g, ~180g, or 'no idea'" }, { id: "nutritionChallenge", type: "multi", section: "05", q: "What are your biggest nutrition challenges right now?", options: ["Hitting protein targets", "Controlling portions", "Emotional / stress eating", "Too much processed food", "Inconsistency on weekends", "Alcohol / social situations", "Meal prep and planning", "Appetite control", "Knowing what to eat", "Budget or time constraints"] }, { id: "alcoholUse", type: "choice", section: "05", q: "Current alcohol consumption?", required: true, options: ["None — I don't drink", "Rarely (1–2 drinks / month)", "Occasionally (1–3 drinks / week)", "Regularly (4–7 drinks / week)", "Daily or near-daily", "Binge pattern on weekends"] }, { id: "tobaccoUse", type: "choice", section: "05", q: "Current tobacco or nicotine use?", required: true, options: ["Never used", "Former user — quit 1+ years ago", "Former user — quit less than 1 year ago", "Current — cigarettes", "Current — vaping / e-cigarettes", "Current — nicotine pouches", "Occasional / social only"] }, { id: "currentSupplements", type: "long", section: "05", q: "What supplements are you currently taking?", hint: "List everything: protein powder, creatine, vitamins, pre-workout, herbs, hormonal support, etc." }, // ── 06 Lifestyle { id: "s06", type: "section", label: "06", title: "Lifestyle & Recovery", sub: "Sleep, stress, and daily habits" }, { id: "avgSleep", type: "choice", section: "06", q: "Average nightly sleep duration?", required: true, options: ["Less than 5 hours", "5–6 hours", "6–7 hours", "7–8 hours", "8–9 hours", "9+ hours"] }, { id: "sleepQuality", type: "choice", section: "06", q: "How would you rate your sleep quality?", required: true, options: ["Excellent — wake up refreshed consistently", "Good — mostly restful", "Fair — inconsistent", "Poor — rarely feel rested", "Very poor — chronic sleep issues"] }, { id: "stressLevel", type: "choice", section: "06", q: "Current daily stress level?", required: true, options: ["1–2 (very low)", "3–4 (low)", "5–6 (moderate)", "7–8 (high)", "9–10 (extreme / unsustainable)"] }, { id: "stressSources", type: "multi", section: "06", q: "Primary sources of stress in your life right now?", options: ["Work / career demands", "Business ownership", "Financial pressure", "Relationship / marriage", "Family responsibilities", "Parenthood (current or upcoming)", "Health concerns", "Life transition", "Low stress currently"] }, { id: "wearable", type: "choice", section: "06", q: "Do you use a fitness or recovery wearable?", options: ["Yes — WHOOP", "Yes — Oura Ring", "Yes — Garmin", "Yes — Apple Watch", "Yes — Fitbit / other", "No — but I'm open to it", "No — not interested"] }, { id: "dailySchedule", type: "long", section: "06", required: true, q: "Walk us through your typical weekday schedule.", hint: "Wake time, work hours, training window, family time, bedtime. We design around your real life." }, // ── 07 Mindset { id: "s07", type: "section", label: "07", title: "Mindset & Commitment", sub: "The foundation everything is built on" }, { id: "pastFailures", type: "long", section: "07", required: true, q: "What has stopped you from achieving your goals in the past?", hint: "Be brutally honest. Consistency? Knowledge? Accountability? Identify the real pattern, not the surface reason." }, { id: "accountability", type: "choice", section: "07", q: "How important is external accountability to your success?", required: true, options: ["Critical — I need someone checking on me", "Very important — significantly improves consistency", "Moderately helpful — I can self-direct but benefit from it", "Minimal — I'm highly self-directed", "I prefer complete independence"] }, { id: "coachingStyle", type: "choice", section: "07", q: "What coaching style do you respond best to?", options: ["Direct and no-nonsense — tell me exactly what to do", "Collaborative — I want to understand the why", "Supportive / encouraging", "Challenge-oriented — push me harder than I push myself", "Data-driven — show me the numbers", "Flexible — adapt week by week"] }, { id: "willingnessToChange", type: "choice", section: "07", q: "How willing are you to change your current habits completely if necessary?", required: true, options: ["1–2 — I want results but minimal disruption", "3–4 — I'll change some things", "5–6 — Open to moderate changes", "7–8 — I'll do what it takes", "9–10 — I'm all in. Tell me exactly what to do."] }, { id: "programType", type: "choice", section: "07", q: "What type of coaching are you looking for?", required: true, options: ["Full 1-on-1 coaching (weekly check-ins, custom programming, nutrition, accountability)", "Online programming only (custom plan, self-directed)", "Nutrition coaching only", "Training programming only", "One-time strategy session / consultation", "Not sure yet — let's discuss"] }, { id: "investmentLevel", type: "choice", section: "07", q: "Realistic monthly investment range for coaching?", required: true, options: ["Under $150 / month", "$150–$300 / month", "$300–$500 / month", "$500–$750 / month", "$750–$1,000 / month", "$1,000+ / month", "Budget is not the primary concern — I want the best outcome"] }, // ── 08 Specialized (Optional) { id: "s08", type: "section", label: "08", title: "Specialized Health Goals", sub: "Hormonal, fertility & advanced health — optional but valuable", optional: true }, { id: "fertilityGoal", type: "choice", section: "08", q: "Is fertility optimization a current goal?", options: ["Not applicable", "Yes — actively trying to conceive", "Yes — preparing for IUI / IVF", "Yes — general reproductive health", "Yes — post-TRT fertility recovery", "Not currently but planning ahead"] }, { id: "hormonalFocus", type: "choice", section: "08", q: "Is hormonal optimization a primary focus?", options: ["Not a primary focus", "Yes — natural testosterone optimization", "Yes — post-TRT / HPTA recovery", "Yes — thyroid or adrenal support", "Yes — under physician supervision", "Yes — working with a fertility clinic"] }, { id: "hormonalSymptoms", type: "multi", section: "08", q: "Are you experiencing any hormonal symptoms? Select all that apply.", options: ["Low energy / fatigue", "Low libido", "Mood changes / depression / anxiety", "Poor sleep quality", "Weight gain (midsection)", "Brain fog", "Poor recovery from training", "Low motivation", "Night sweats", "None currently"] }, { id: "specialNotes", type: "long", section: "08", q: "Anything else about your health or specialized goals we should know?", hint: "This is a confidential space. Share anything that helps us build the most accurate protocol for your situation." }, // ── 09 Final { id: "s09", type: "section", label: "09", title: "Final Questions", sub: "Last things before we review your application" }, { id: "startReadiness", type: "choice", section: "09", q: "How ready are you to start — right now?", required: true, options: ["100% ready — I'm starting today", "Ready — this week", "Ready — this month", "Almost ready — just need to sort a few things", "Exploring options — not committed yet"] }, { id: "whyNow", type: "long", section: "09", required: true, q: "What made you reach out specifically at this time?", hint: "Was it a post you saw? Something someone said? A moment you had? A deadline approaching? Tell us the real story." }, { id: "anythingElse", type: "long", section: "09", q: "Is there anything else you want us to know?", hint: "This is your space. Anything that doesn't fit above — say it here." }, { id: "referralName", type: "text", section: "09", q: "Were you referred by a current client?", placeholder: "Their name, or leave blank" }, { id: "consent", type: "agree", section: "09", required: true, q: "One last thing — please confirm the following:", statement: "I confirm the information in this application is honest and accurate to the best of my knowledge. I understand this is a coaching service and not a medical practice, and that health-related decisions will be made in consultation with my licensed healthcare providers." }, // Thank you { id: "thankyou", type: "thankyou", heading: "Application Received.", sub: "We review every application personally and will be in touch within 24–48 hours. Check your email for a confirmation.", steps: [ { n: "01", label: "Coach reviews your application within 24 hrs" }, { n: "02", label: "Strategy call scheduled to discuss your protocol" }, { n: "03", label: "Custom program delivered within 5 business days" }, ] } ]; const KEYBOARD_HINT = "Press Enter ↵"; const MULTI_HINT = "Choose all that apply · Press Enter to continue"; export default function TypeformIntake() { const [idx, setIdx] = useState(0); const [answers, setAnswers] = useState({}); const [inputVal, setInputVal] = useState(""); const [error, setError] = useState(""); const [animDir, setAnimDir] = useState("up"); // "up" | "down" const [visible, setVisible] = useState(true); const inputRef = useRef(null); const q = QUESTIONS[idx]; const total = QUESTIONS.filter(q => q.type !== "welcome" && q.type !== "thankyou" && q.type !== "section").length; const answered = QUESTIONS.filter((q, i) => i < idx && q.type !== "welcome" && q.type !== "thankyou" && q.type !== "section").length; const pct = Math.round((answered / total) * 100); // focus input on question change useEffect(() => { if (inputRef.current) setTimeout(() => inputRef.current?.focus(), 320); }, [idx]); // sync inputVal with existing answer when navigating back useEffect(() => { if (q && answers[q.id] !== undefined) { const v = answers[q.id]; if (typeof v === "string") setInputVal(v); else setInputVal(""); } else { setInputVal(""); } }, [idx]); const transition = useCallback((nextIdx, dir = "up") => { setAnimDir(dir); setVisible(false); setError(""); setTimeout(() => { setIdx(nextIdx); setVisible(true); }, 240); }, []); const shouldSkip = useCallback((question) => { if (!question.conditional) return false; return answers[question.conditional.field] !== question.conditional.value; }, [answers]); const nextQuestion = useCallback((overrideIdx) => { let next = (overrideIdx ?? idx) + 1; while (next < QUESTIONS.length && shouldSkip(QUESTIONS[next])) next++; return next; }, [idx, shouldSkip]); const prevQuestion = useCallback(() => { let prev = idx - 1; while (prev > 0 && shouldSkip(QUESTIONS[prev])) prev--; transition(prev, "down"); }, [idx, transition, shouldSkip]); const advance = useCallback((val) => { const cur = q; // Validate required if (cur.required) { const v = val ?? answers[cur.id]; const empty = !v || (Array.isArray(v) && v.length === 0) || v === ""; if (empty) { setError("This field is required — please fill it in before continuing."); return; } } if (val !== undefined) setAnswers(prev => ({ ...prev, [cur.id]: val })); transition(nextQuestion()); }, [q, answers, transition, nextQuestion]); const handleTextNext = () => { const val = inputVal.trim(); if (q.required && !val) { setError("This field is required."); return; } setAnswers(prev => ({ ...prev, [q.id]: val })); transition(nextQuestion()); }; const handleKeyDown = (e) => { if (e.key === "Enter" && !e.shiftKey && q.type !== "long") { e.preventDefault(); handleTextNext(); } }; const handleChoice = (opt) => { setAnswers(prev => ({ ...prev, [q.id]: opt })); setTimeout(() => transition(nextQuestion()), 220); }; const toggleMulti = (opt) => { const cur = answers[q.id] || []; const next = cur.includes(opt) ? cur.filter(o => o !== opt) : [...cur, opt]; setAnswers(prev => ({ ...prev, [q.id]: next })); setError(""); }; const handleAgree = (agreed) => { if (!agreed) { setError("You must agree to proceed."); return; } setAnswers(prev => ({ ...prev, [q.id]: true })); transition(nextQuestion()); }; // ── RENDER ───────────────────────────────────────────────────────────────── const slideStyle = { opacity: visible ? 1 : 0, transform: visible ? "translateY(0)" : animDir === "up" ? "translateY(28px)" : "translateY(-28px)", transition: "opacity 0.24s ease, transform 0.24s ease", }; const isMultiSelected = (opt) => (answers[q.id] || []).includes(opt); const multiCount = (answers[q.id] || []).length; return (
{/* Progress */}
{/* Top bar */} {q.type !== "welcome" && q.type !== "thankyou" && (
High Performance Coaching {answered} / {total} questions
)} {/* Main content */}
{/* ── WELCOME ── */} {q.type === "welcome" && (
{q.tag}

{q.heading}

{q.sub}

Your responses are strictly confidential

)} {/* ── SECTION HEADER ── */} {q.type === "section" && (
{q.label}
{q.optional &&
Optional Section
}

{q.title}

{q.sub}

{q.optional && ( )}
)} {/* ── TEXT / EMAIL / TEL / NUMBER / DATE ── */} {(q.type === "text" || q.type === "email" || q.type === "tel" || q.type === "number" || q.type === "date") && (
{q.section &&
Section {q.section}
}

{q.q} {q.required && *}

{q.hint &&

{q.hint}

} { setInputVal(e.target.value); setError(""); }} onKeyDown={handleKeyDown} /> {error &&

{error}

}
{KEYBOARD_HINT}
)} {/* ── LONG TEXT ── */} {q.type === "long" && (
{q.section &&
Section {q.section}
}

{q.q} {q.required && *}

{q.hint &&

{q.hint}

}