# Add the "Recreation Programs" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/recreation-programs) to this Pantheon Content Publisher (P1) Next.js project. A seasonal program catalog with ages, schedules, resident and non-resident fees, and register or waitlist links.

## Steps

1. Create `components/puck/recreation-programs-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 { recreationProgramsBlock } from "./components/puck/recreation-programs-block";`
3. Register it under `components` as `RecreationProgramsBlock: recreationProgramsBlock`.
4. Add `"RecreationProgramsBlock"` to the best-fitting entry in `categories` (this block's library category is "Municipal"). 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/recreation-programs-block.tsx`

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

/**
 * Recreation Programs — a seasonal program catalog: ages, dates, days and times, location,
 * resident and non-resident fees, and a register link. Full programs say so in words and
 * offer the waitlist instead.
 * Register: `RecreationProgramsBlock: recreationProgramsBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";
type Availability = "open" | "few" | "full";

export type RecreationProgramsProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  registrationNote: string;
  programs: {
    name: string;
    category: string;
    ages: string;
    dates: string;
    schedule: string;
    location: string;
    residentFee: string;
    nonResidentFee: string;
    availability: Availability;
    href: string;
    waitlistHref: string;
  }[];
  residencyNote: string;
  catalogLabel: string;
  catalogHref: string;
};

const childHeading = { h1: "h2", h2: "h3", h3: "h4", h4: "h5" } as const;

const focusRing = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-700";

export const recreationProgramsBlock: ComponentConfig<RecreationProgramsProps> = {
  label: "Recreation Programs",
  fields: {
    eyebrow: { type: "text", label: "Eyebrow", metadata: { help: "Small line above the heading, like the season. 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", metadata: { help: "Leave blank to hide it." } },
    registrationNote: { type: "text", label: "Registration note", metadata: { help: "Like Registration opens Aug 15 for residents. Leave blank to hide it." } },
    programs: {
      type: "array",
      label: "Programs",
      min: 1,
      max: 30,
      getItemSummary: (item) => (item?.name ? `${item.availability === "full" ? "Full · " : ""}${item.name}` : "Program"),
      defaultItemProps: {
        name: "New program",
        category: "",
        ages: "",
        dates: "",
        schedule: "",
        location: "",
        residentFee: "",
        nonResidentFee: "",
        availability: "open",
        href: "",
        waitlistHref: "",
      },
      arrayFields: {
        name: { type: "text", label: "Program name" },
        category: { type: "text", label: "Category", metadata: { help: "Like Youth sports, Aquatics or Arts. Leave blank to hide it." } },
        ages: { type: "text", label: "Ages", metadata: { help: "Like Ages 6–9, or Adults 55+." } },
        dates: { type: "text", label: "Dates", metadata: { help: "Like Sep 14 to Nov 2 (8 weeks)." } },
        schedule: { type: "text", label: "Days and times", metadata: { help: "Like Saturdays, 9 to 10 a.m." } },
        location: { type: "text", label: "Location" },
        residentFee: { type: "text", label: "Resident fee", metadata: { help: "Like $45, or Free." } },
        nonResidentFee: { type: "text", label: "Non-resident fee", metadata: { help: "Leave blank if everyone pays the same." } },
        availability: {
          type: "select",
          label: "Availability",
          options: [
            { label: "Open", value: "open" },
            { label: "A few spots left", value: "few" },
            { label: "Full", value: "full" },
          ],
          metadata: { help: "Full replaces the register button with the waitlist link, or a note if there's no waitlist." },
        },
        href: { type: "text", label: "Register link" },
        waitlistHref: { type: "text", label: "Waitlist link", metadata: { help: "Only used when the program is full." } },
      },
    },
    residencyNote: { type: "textarea", label: "Residency note", metadata: { help: "Who counts as a resident for fees. Leave blank to hide it." } },
    catalogLabel: { type: "text", label: "Catalog link text", metadata: { help: "Like Download the full fall guide (PDF). Leave blank to hide it." } },
    catalogHref: { type: "text", label: "Catalog link" },
  },
  defaultProps: {
    eyebrow: "Fall 2026",
    heading: "Recreation programs",
    headingLevel: "h2",
    intro: "Classes, leagues and lessons for every age, run by Millbrook Parks & Recreation. Scholarships are available for any program.",
    registrationNote: "Registration is open now. Most programs fill within two weeks.",
    programs: [
      {
        name: "Learn to Swim, Level 2",
        category: "Aquatics",
        ages: "Ages 5–7",
        dates: "Sep 14 to Oct 23",
        schedule: "Mon & Wed, 5:30 to 6 p.m.",
        location: "Northside Recreation Center pool",
        residentFee: "$48",
        nonResidentFee: "$64",
        availability: "few",
        href: "/rec/register/swim-2",
        waitlistHref: "",
      },
      {
        name: "Youth Flag Football",
        category: "Youth sports",
        ages: "Ages 8–11",
        dates: "Sep 19 to Nov 7",
        schedule: "Saturdays, 9 to 10:30 a.m.",
        location: "Cedar Run Sports Complex, Field 2",
        residentFee: "$65",
        nonResidentFee: "$85",
        availability: "full",
        href: "/rec/register/flag-football",
        waitlistHref: "/rec/waitlist/flag-football",
      },
      {
        name: "Pottery on the Wheel",
        category: "Arts",
        ages: "Ages 16 and up",
        dates: "Oct 1 to Nov 19",
        schedule: "Thursdays, 6:30 to 8:30 p.m.",
        location: "Millbrook Arts Studio, 22 Mill Road",
        residentFee: "$120",
        nonResidentFee: "$150",
        availability: "open",
        href: "/rec/register/pottery",
        waitlistHref: "",
      },
      {
        name: "Gentle Yoga for Seniors",
        category: "Fitness",
        ages: "Adults 55+",
        dates: "Sep 15 to Dec 15",
        schedule: "Tue & Thu, 10 to 11 a.m.",
        location: "Lakeside Senior Center",
        residentFee: "Free",
        nonResidentFee: "$30",
        availability: "open",
        href: "/rec/register/senior-yoga",
        waitlistHref: "",
      },
    ],
    residencyNote: "Resident fees apply to anyone who lives inside Millbrook city limits. Bring a utility bill or lease the first time you register.",
    catalogLabel: "Download the full fall program guide (PDF)",
    catalogHref: "/rec/fall-2026-guide.pdf",
  },
  render: ({ eyebrow, heading, headingLevel, intro, registrationNote, programs, residencyNote, catalogLabel, catalogHref }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[headingLevel] || "h3";
    const list = (programs ?? []).filter((p) => p?.name);
    const hasHeader = Boolean(eyebrow || heading || intro || registrationNote);
    return (
      <section className="bg-neutral-50 px-4 py-16 sm:px-6 sm:py-20 lg:px-8 lg:py-24">
        <div className="mx-auto max-w-7xl">
          {hasHeader ? (
            <div className="max-w-2xl">
              {eyebrow ? <p className="text-sm font-semibold tracking-wide text-indigo-700">{eyebrow}</p> : null}
              {heading ? <H className={`text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl ${eyebrow ? "mt-2" : ""}`}>{heading}</H> : null}
              {intro ? <p className="mt-4 text-lg leading-8 text-pretty text-neutral-600">{intro}</p> : null}
              {registrationNote ? (
                <p className="mt-5 inline-flex items-start gap-2 rounded-lg bg-white px-3 py-2 text-sm font-semibold text-neutral-900 ring-1 ring-neutral-200">
                  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-4 shrink-0 text-indigo-700">
                    <path fillRule="evenodd" d="M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-7-4a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM9 9a.75.75 0 0 0 0 1.5h.253a.25.25 0 0 1 .244.304l-.459 2.066A1.75 1.75 0 0 0 10.747 15H11a.75.75 0 0 0 0-1.5h-.253a.25.25 0 0 1-.244-.304l.459-2.066A1.75 1.75 0 0 0 9.253 9H9Z" clipRule="evenodd" />
                  </svg>
                  {registrationNote}
                </p>
              ) : null}
            </div>
          ) : null}

          {list.length ? (
            <ul role="list" className={`grid grid-cols-1 gap-5 md:grid-cols-2 ${hasHeader ? "mt-10 sm:mt-12" : ""}`}>
              {list.map((p, i) => {
                const full = p.availability === "full";
                const few = p.availability === "few";
                const meta = [
                  { label: "Dates", value: p.dates },
                  { label: "When", value: p.schedule },
                  { label: "Where", value: p.location },
                ].filter((m) => m.value);
                return (
                  <li key={`${p.name}-${i}`} className={`flex flex-col rounded-2xl ring-1 ${full ? "bg-neutral-100 ring-neutral-200" : "bg-white shadow-sm ring-neutral-200"}`}>
                    <div className="flex-1 p-5 sm:p-6">
                      <div className="flex flex-wrap items-center gap-x-3 gap-y-2">
                        {p.category ? <p className="text-sm font-semibold text-indigo-700">{p.category}</p> : null}
                        {p.ages ? <p className="rounded-full bg-indigo-50 px-2.5 py-0.5 text-xs font-semibold text-indigo-900 ring-1 ring-indigo-600/15">{p.ages}</p> : null}
                        {full ? (
                          <p className="ml-auto inline-flex items-center gap-1.5 rounded-full bg-neutral-900 px-2.5 py-0.5 text-xs font-semibold text-white">
                            <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-3.5">
                              <path fillRule="evenodd" d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM6.75 9.25a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Z" clipRule="evenodd" />
                            </svg>
                            Full
                          </p>
                        ) : few ? (
                          <p className="ml-auto inline-flex items-center gap-1.5 rounded-full bg-white px-2.5 py-0.5 text-xs font-semibold text-indigo-800 ring-1 ring-indigo-600/40">
                            <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-3.5">
                              <path fillRule="evenodd" d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm.75-13a.75.75 0 0 0-1.5 0v5c0 .414.336.75.75.75h4a.75.75 0 0 0 0-1.5h-3.25V5Z" clipRule="evenodd" />
                            </svg>
                            A few spots left
                          </p>
                        ) : null}
                      </div>
                      <Sub className={`mt-3 text-xl font-semibold tracking-tight text-pretty ${full ? "text-neutral-700" : "text-neutral-950"}`}>{p.name}</Sub>
                      {meta.length ? (
                        <dl className="mt-4 space-y-1.5 text-sm leading-6">
                          {meta.map((m) => (
                            <div key={m.label} className="flex gap-3">
                              <dt className="w-14 shrink-0 font-semibold text-neutral-950">{m.label}</dt>
                              <dd className="min-w-0 text-neutral-700">{m.value}</dd>
                            </div>
                          ))}
                        </dl>
                      ) : null}
                    </div>
                    <div className="flex flex-col gap-4 border-t border-neutral-200 p-5 sm:flex-row sm:items-center sm:justify-between sm:px-6">
                      {p.residentFee || p.nonResidentFee ? (
                        <dl className="flex gap-6">
                          {p.residentFee ? (
                            <div>
                              <dt className="text-xs font-semibold tracking-wide text-neutral-600 uppercase">{p.nonResidentFee ? "Resident" : "Fee"}</dt>
                              <dd className="text-lg font-semibold text-neutral-950 tabular-nums">{p.residentFee}</dd>
                            </div>
                          ) : null}
                          {p.nonResidentFee ? (
                            <div>
                              <dt className="text-xs font-semibold tracking-wide text-neutral-600 uppercase">Non-resident</dt>
                              <dd className="text-lg font-semibold text-neutral-700 tabular-nums">{p.nonResidentFee}</dd>
                            </div>
                          ) : null}
                        </dl>
                      ) : (
                        <span />
                      )}
                      {full ? (
                        p.waitlistHref ? (
                          <a
                            href={p.waitlistHref}
                            className={`inline-flex min-h-11 items-center justify-center rounded-lg bg-white px-4 text-sm font-semibold text-neutral-950 ring-1 ring-neutral-300 transition ring-inset hover:bg-neutral-50 ${focusRing}`}
                          >
                            Join the waitlist<span className="sr-only"> for {p.name}</span>
                          </a>
                        ) : (
                          <p className="text-sm font-semibold text-neutral-700">Registration is full</p>
                        )
                      ) : p.href ? (
                        <a
                          href={p.href}
                          className={`inline-flex min-h-11 items-center justify-center rounded-lg bg-indigo-700 px-5 text-sm font-semibold text-white shadow-sm transition hover:bg-indigo-600 ${focusRing}`}
                        >
                          Register<span className="sr-only"> for {p.name}</span>
                        </a>
                      ) : null}
                    </div>
                  </li>
                );
              })}
            </ul>
          ) : null}

          {residencyNote || catalogLabel ? (
            <div className="mt-8 flex flex-col gap-3 md:flex-row md:items-center md:justify-between md:gap-10">
              {residencyNote ? <p className="max-w-2xl text-sm leading-6 text-pretty text-neutral-600">{residencyNote}</p> : null}
              {catalogLabel ? (
                <a
                  href={catalogHref || "#"}
                  className={`inline-flex min-h-11 shrink-0 items-center gap-2 rounded text-sm font-semibold text-indigo-700 underline decoration-indigo-300 underline-offset-4 hover:decoration-indigo-700 ${focusRing}`}
                >
                  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 shrink-0">
                    <path d="M10.75 2.75a.75.75 0 0 0-1.5 0v8.614L6.295 8.235a.75.75 0 1 0-1.09 1.03l4.25 4.5a.75.75 0 0 0 1.09 0l4.25-4.5a.75.75 0 0 0-1.09-1.03l-2.955 3.129V2.75Z" />
                    <path d="M3.5 12.75a.75.75 0 0 0-1.5 0v2.5A2.75 2.75 0 0 0 4.75 18h10.5A2.75 2.75 0 0 0 18 15.25v-2.5a.75.75 0 0 0-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5Z" />
                  </svg>
                  {catalogLabel}
                </a>
              ) : null}
            </div>
          ) : null}
        </div>
      </section>
    );
  },
};
```
