# Add the "Waitlist Signup" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/waitlist-signup) to this Pantheon Content Publisher (P1) Next.js project. Full-program waitlist form with participant, grade and guardian fields beside a people-waiting count and how offers work.

## Steps

1. Create `components/puck/waitlist-signup-block.tsx` with the exact file contents below. If `components/puck/` doesn't exist, find the folder where this project keeps its Puck components (look at the imports in `puck.config.tsx`) and put it there.
2. In `puck.config.tsx`, import it: `import { waitlistSignupBlock } from "./components/puck/waitlist-signup-block";`
3. Register it under `components` as `WaitlistSignupBlock: waitlistSignupBlock`.
4. Add `"WaitlistSignupBlock"` to the best-fitting entry in `categories` (this block's library category is "Enrollment"). Create a category only if none fits.
5. Run the project's type check (usually `pnpm typecheck`) and resolve anything project-specific.
6. If `package.json` has a `sync:registry` script, tell the user it must run (or that CI will run it) before the new component appears in the P1 editor.

## Rules

- Do not add dependencies. The block is self-contained by design: one type-only import from `@puckeditor/core`, Tailwind v4 classes, no client JavaScript.
- Keep the files as-is unless the user asks for changes. The accent color is `indigo-*`; if the project has brand colors, offer to swap them with a find-and-replace on `indigo-`.
- Images are plain `imageUrl` + `imageAlt` text fields. If this project defines a P1 media-library field (search for `"p1-media"`), offer to switch to it.
- Don't change prop names in `defaultProps`. Content editors' saved pages depend on them.

## File: `components/puck/waitlist-signup-block.tsx`

```tsx
import type { ComponentConfig } from "@puckeditor/core";

/**
 * Waitlist Signup — when a class, camp or program is full: what the waitlist means, how offers
 * work, and a short form (program, participant, grade, contact, flexibility) that posts anywhere.
 * Register: `WaitlistSignupBlock: waitlistSignupBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";

export type WaitlistSignupProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  waitlistCount: string;
  waitlistCountLabel: string;
  formAction: string;
  programs: { name: string }[];
  grades: { label: string }[];
  howItWorks: { title: string; detail: string }[];
  offerWindow: string;
  submitLabel: string;
  privacyNote: string;
};

const childHeading: Record<Heading, "h2" | "h3" | "h4" | "h5"> = { h1: "h2", h2: "h3", h3: "h4", h4: "h5" };

const inputClass =
  "block min-h-11 w-full rounded-lg border-0 bg-white px-3.5 py-2.5 text-base text-neutral-950 shadow-xs ring-1 ring-neutral-300 ring-inset placeholder:text-neutral-500 focus:ring-2 focus:ring-indigo-600 focus:outline-none";
const labelClass = "block text-sm leading-6 font-medium text-neutral-900";
const legendClass = "text-sm leading-6 font-semibold text-neutral-950";

const Chevron = () => (
  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="pointer-events-none absolute top-1/2 right-3 size-5 -translate-y-1/2 text-neutral-500">
    <path fillRule="evenodd" d="M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z" clipRule="evenodd" />
  </svg>
);

export const waitlistSignupBlock: ComponentConfig<WaitlistSignupProps> = {
  label: "Waitlist Signup",
  fields: {
    eyebrow: { type: "text", label: "Eyebrow", metadata: { help: "Small line above the heading, such as the program status. Leave blank to hide it." } },
    heading: { type: "text", label: "Heading" },
    headingLevel: {
      type: "select",
      label: "Heading level",
      options: [
        { label: "H1", value: "h1" },
        { label: "H2", value: "h2" },
        { label: "H3", value: "h3" },
        { label: "H4", value: "h4" },
      ],
      metadata: { help: "Sets the page outline for screen readers and search. The look doesn't change." },
    },
    intro: { type: "textarea", label: "Intro" },
    waitlistCount: {
      type: "text",
      label: "People waiting",
      metadata: { help: "Shown large beside the intro, such as 38. Bind it to a data source to keep it current, or leave blank to hide it." },
    },
    waitlistCountLabel: { type: "text", label: "People waiting label", metadata: { help: "Words under the number, such as \"families on the list today\"." } },
    formAction: {
      type: "text",
      label: "Form action URL",
      metadata: { help: "Where the form is sent with POST. Field names: program, participant_first, participant_last, grade, guardian_name, email, phone, flexible, accommodations." },
    },
    programs: {
      type: "array",
      label: "Programs",
      min: 1,
      max: 20,
      getItemSummary: (item) => item?.name || "Program",
      defaultItemProps: { name: "New program" },
      arrayFields: { name: { type: "text", label: "Program or session" } },
      metadata: { help: "Choices in the \"Which program?\" menu. With only one, it's shown as text instead of a menu." },
    },
    grades: {
      type: "array",
      label: "Age or grade options",
      min: 0,
      max: 16,
      getItemSummary: (item) => item?.label || "Option",
      defaultItemProps: { label: "Grade 6" },
      arrayFields: { label: { type: "text", label: "Option" } },
      metadata: { help: "Leave empty to hide the age or grade question." },
    },
    howItWorks: {
      type: "array",
      label: "How the waitlist works",
      min: 0,
      max: 5,
      getItemSummary: (item) => item?.title || "Step",
      defaultItemProps: { title: "New step", detail: "" },
      arrayFields: {
        title: { type: "text", label: "Step" },
        detail: { type: "textarea", label: "Detail" },
      },
    },
    offerWindow: {
      type: "text",
      label: "Offer note",
      metadata: { help: "One sentence about how long families have to accept a spot. Leave blank to hide it." },
    },
    submitLabel: { type: "text", label: "Button text" },
    privacyNote: { type: "textarea", label: "Privacy note", metadata: { help: "Shown under the button. Leave blank to hide it." } },
  },
  defaultProps: {
    eyebrow: "Session full",
    heading: "Join the waitlist for Young Naturalists",
    headingLevel: "h2",
    intro: "Every summer, a few families change plans. When a spot opens we offer it to the next person on the list, in the order they signed up — no lottery, no fee to wait.",
    waitlistCount: "38",
    waitlistCountLabel: "families on the list today (sample figure)",
    formAction: "/programs/waitlist",
    programs: [
      { name: "Young Naturalists — Week 1, June 15–19" },
      { name: "Young Naturalists — Week 2, June 22–26" },
      { name: "Young Naturalists — Week 3, July 6–10" },
      { name: "Any week that opens" },
    ],
    grades: [
      { label: "Rising 2nd grade" },
      { label: "Rising 3rd grade" },
      { label: "Rising 4th grade" },
      { label: "Rising 5th grade" },
      { label: "Rising 6th grade" },
    ],
    howItWorks: [
      { title: "You're added in order", detail: "We'll email a confirmation with your place in line within one business day." },
      { title: "A spot opens", detail: "We email and text the next family with a link to enroll and pay." },
      { title: "You decide", detail: "Accept, pass, or ask to stay on the list for a different week." },
    ],
    offerWindow: "Offers are held for 48 hours, then go to the next family.",
    submitLabel: "Add me to the waitlist",
    privacyNote: "We only use your details to contact you about this program.",
  },
  render: ({ id, eyebrow, heading, headingLevel, intro, waitlistCount, waitlistCountLabel, formAction, programs, grades, howItWorks, offerWindow, submitLabel, privacyNote }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[H] || "h3";
    const uid = `wl-${id || "form"}`;
    const programList = (programs ?? []).map((p) => p?.name?.trim()).filter(Boolean) as string[];
    const gradeList = (grades ?? []).map((g) => g?.label?.trim()).filter(Boolean) as string[];
    const steps = (howItWorks ?? []).filter((s) => s?.title);
    const hasAside = Boolean(waitlistCount || steps.length || offerWindow);

    return (
      <section className="bg-white px-4 py-16 sm:px-6 sm:py-20 lg:px-8 lg:py-24">
        <div className="mx-auto max-w-6xl">
          {eyebrow || heading || intro ? (
            <header className="max-w-3xl">
              {eyebrow ? (
                <p className="inline-flex items-center gap-2 rounded-full bg-neutral-100 px-3 py-1 text-sm font-semibold text-neutral-800 ring-1 ring-neutral-200 ring-inset">
                  <span aria-hidden="true" className="size-1.5 rounded-full bg-indigo-600" />
                  {eyebrow}
                </p>
              ) : null}
              {heading ? <H className={`text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl lg:text-5xl ${eyebrow ? "mt-5" : ""}`}>{heading}</H> : null}
              {intro ? <p className="mt-5 text-lg leading-8 text-pretty text-neutral-600">{intro}</p> : null}
            </header>
          ) : null}

          <div className={`grid grid-cols-1 gap-12 lg:gap-16 ${hasAside ? "lg:grid-cols-12" : ""} ${eyebrow || heading || intro ? "mt-12 sm:mt-16" : ""}`}>
            {hasAside ? (
              <aside aria-label="How the waitlist works" className="lg:order-2 lg:col-span-5">
                <div className="lg:sticky lg:top-8">
                  {waitlistCount ? (
                    <p className="flex flex-col border-b border-neutral-200 pb-8">
                      <span className="text-7xl font-semibold tracking-tighter text-neutral-950 tabular-nums sm:text-8xl">{waitlistCount}</span>
                      {waitlistCountLabel ? <span className="mt-2 text-sm leading-6 text-neutral-600">{waitlistCountLabel}</span> : null}
                    </p>
                  ) : null}
                  {steps.length ? (
                    <ol role="list" className={`space-y-6 ${waitlistCount ? "mt-8" : ""}`}>
                      {steps.map((s, i) => (
                        <li key={`${s.title}-${i}`} className="flex gap-4">
                          <span aria-hidden="true" className="flex size-10 shrink-0 items-center justify-center rounded-full bg-indigo-50 text-sm font-semibold text-indigo-700 tabular-nums ring-1 ring-indigo-600/15 ring-inset">
                            {i + 1}
                          </span>
                          <div className="min-w-0 pt-1.5">
                            <Sub className="text-base leading-7 font-semibold text-neutral-950">{s.title}</Sub>
                            {s.detail ? <p className="mt-1 text-sm leading-6 text-pretty text-neutral-600">{s.detail}</p> : null}
                          </div>
                        </li>
                      ))}
                    </ol>
                  ) : null}
                  {offerWindow ? (
                    <p className="mt-8 rounded-xl bg-neutral-50 p-4 text-sm leading-6 text-pretty text-neutral-700 ring-1 ring-neutral-200">
                      <span className="font-semibold text-neutral-950">Heads up: </span>
                      {offerWindow}
                    </p>
                  ) : null}
                </div>
              </aside>
            ) : null}

            <form action={formAction || undefined} method="post" className={`rounded-2xl bg-neutral-50 p-6 ring-1 ring-neutral-200 sm:p-8 ${hasAside ? "lg:order-1 lg:col-span-7" : "mx-auto w-full max-w-2xl"}`}>
              <p className="text-sm leading-6 text-neutral-600">All fields are required unless marked optional.</p>

              {programList.length > 1 ? (
                <div className="mt-6">
                  <label htmlFor={`${uid}-program`} className={labelClass}>
                    Which program?
                  </label>
                  <div className="relative mt-2">
                    <select id={`${uid}-program`} name="program" required defaultValue="" className={`appearance-none pr-10 ${inputClass}`}>
                      <option value="" disabled>
                        Choose a program
                      </option>
                      {programList.map((p, i) => (
                        <option key={`${p}-${i}`} value={p}>
                          {p}
                        </option>
                      ))}
                    </select>
                    <Chevron />
                  </div>
                </div>
              ) : programList.length === 1 ? (
                <p className="mt-6 text-base leading-7 text-neutral-950">
                  <span className="font-semibold">Program: </span>
                  {programList[0]}
                  <input type="hidden" name="program" value={programList[0]} />
                </p>
              ) : null}

              <fieldset className="mt-8">
                <legend className={legendClass}>Participant</legend>
                <div className="mt-4 grid grid-cols-1 gap-x-6 gap-y-6 sm:grid-cols-2">
                  <div>
                    <label htmlFor={`${uid}-pfirst`} className={labelClass}>
                      First name
                    </label>
                    <input id={`${uid}-pfirst`} name="participant_first" type="text" required autoComplete="off" className={`mt-2 ${inputClass}`} />
                  </div>
                  <div>
                    <label htmlFor={`${uid}-plast`} className={labelClass}>
                      Last name
                    </label>
                    <input id={`${uid}-plast`} name="participant_last" type="text" required autoComplete="off" className={`mt-2 ${inputClass}`} />
                  </div>
                  {gradeList.length ? (
                    <div className="sm:col-span-2">
                      <label htmlFor={`${uid}-grade`} className={labelClass}>
                        Age or grade this fall
                      </label>
                      <div className="relative mt-2">
                        <select id={`${uid}-grade`} name="grade" required defaultValue="" className={`appearance-none pr-10 ${inputClass}`}>
                          <option value="" disabled>
                            Choose one
                          </option>
                          {gradeList.map((g, i) => (
                            <option key={`${g}-${i}`} value={g}>
                              {g}
                            </option>
                          ))}
                        </select>
                        <Chevron />
                      </div>
                    </div>
                  ) : null}
                </div>
              </fieldset>

              <fieldset className="mt-8 border-t border-neutral-200 pt-8">
                <legend className={`${legendClass} float-left w-full`}>Parent or guardian</legend>
                <div className="clear-both grid grid-cols-1 gap-x-6 gap-y-6 pt-4 sm:grid-cols-2">
                  <div className="sm:col-span-2">
                    <label htmlFor={`${uid}-guardian`} className={labelClass}>
                      Full name
                    </label>
                    <input id={`${uid}-guardian`} name="guardian_name" type="text" required autoComplete="name" className={`mt-2 ${inputClass}`} />
                  </div>
                  <div>
                    <label htmlFor={`${uid}-email`} className={labelClass}>
                      Email
                    </label>
                    <input id={`${uid}-email`} name="email" type="email" required autoComplete="email" inputMode="email" className={`mt-2 ${inputClass}`} />
                  </div>
                  <div>
                    <label htmlFor={`${uid}-phone`} className={labelClass}>
                      Mobile phone <span className="font-normal text-neutral-600">(optional)</span>
                    </label>
                    <input id={`${uid}-phone`} name="phone" type="tel" autoComplete="tel" inputMode="tel" aria-describedby={`${uid}-phone-hint`} className={`mt-2 ${inputClass}`} />
                    <p id={`${uid}-phone-hint`} className="mt-2 text-sm leading-6 text-neutral-600">
                      Add it to get offers by text as well as email.
                    </p>
                  </div>
                </div>
              </fieldset>

              <div className="mt-8 flex gap-3 border-t border-neutral-200 pt-8">
                <div className="flex h-11 shrink-0 items-center">
                  <input
                    id={`${uid}-flex`}
                    name="flexible"
                    type="checkbox"
                    value="yes"
                    className="size-5 rounded border-neutral-400 accent-indigo-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
                  />
                </div>
                <label htmlFor={`${uid}-flex`} className="flex min-h-11 cursor-pointer flex-col justify-center text-sm leading-6">
                  <span className="font-medium text-neutral-900">Offer me any session that opens</span>
                  <span className="text-neutral-600">You can still say no to a week that doesn&rsquo;t work.</span>
                </label>
              </div>

              <div className="mt-6">
                <label htmlFor={`${uid}-access`} className={labelClass}>
                  Accessibility or support needs <span className="font-normal text-neutral-600">(optional)</span>
                </label>
                <textarea id={`${uid}-access`} name="accommodations" rows={3} aria-describedby={`${uid}-access-hint`} className={`mt-2 ${inputClass}`} />
                <p id={`${uid}-access-hint`} className="mt-2 text-sm leading-6 text-neutral-600">
                  Tell us now so we&rsquo;re ready when a spot opens. This never affects your place in line.
                </p>
              </div>

              <div className="mt-8 flex flex-col gap-4">
                <button
                  type="submit"
                  className="inline-flex min-h-12 w-full items-center justify-center rounded-lg bg-indigo-600 px-6 py-3 text-base font-semibold text-white shadow-xs transition hover:bg-indigo-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 sm:w-auto sm:self-start"
                >
                  {submitLabel || "Join the waitlist"}
                </button>
                {privacyNote ? <p className="text-sm leading-6 text-pretty text-neutral-600">{privacyNote}</p> : null}
              </div>
            </form>
          </div>
        </div>
      </section>
    );
  },
};
```
