# Add the "Pool Schedule" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/pool-schedule) to this Pantheon Content Publisher (P1) Next.js project. Today's pool status, a days-by-sessions swim table, closures, the weather policy and a swim lessons link.

## Steps

1. Create `components/puck/pool-schedule-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 { poolScheduleBlock } from "./components/puck/pool-schedule-block";`
3. Register it under `components` as `PoolScheduleBlock: poolScheduleBlock`.
4. Add `"PoolScheduleBlock"` to the best-fitting entry in `categories` (this block's library category is "Parks & rec"). 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/pool-schedule-block.tsx`

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

/**
 * Pool Schedule — an aquatics schedule: today's status, a days-by-sessions table (lap swim,
 * open swim, lessons, water aerobics) that stacks into cards on phones, lifeguard and
 * closure notes, the weather policy in a disclosure, and a swim lessons link.
 * Register: `PoolScheduleBlock: poolScheduleBlock` in puck.config.tsx.
 */

// spec: status-colors

type Heading = "h1" | "h2" | "h3" | "h4";
type Tone = "open" | "limited" | "closed";

export type PoolScheduleProps = {
  poolName: string;
  heading: string;
  headingLevel: Heading;
  seasonDates: string;
  intro: string;
  statusTone: Tone;
  statusLabel: string;
  statusDetail: string;
  days: { day: string; lap: string; open: string; lessons: string; aerobics: string }[];
  scheduleNote: string;
  closuresHeading: string;
  closures: string;
  weatherHeading: string;
  weatherPolicy: string;
  lessonsHeading: string;
  lessonsText: string;
  lessonsLabel: string;
  lessonsHref: string;
};

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

const sessions = [
  { key: "lap", label: "Lap swim" },
  { key: "open", label: "Open swim" },
  { key: "lessons", label: "Lessons" },
  { key: "aerobics", label: "Water aerobics" },
] as const;

const tones: Record<Tone, { box: string; dot: string; text: string; word: string }> = {
  open: { box: "bg-emerald-50 ring-emerald-200", dot: "bg-emerald-600", text: "text-emerald-900", word: "Open" },
  limited: { box: "bg-amber-50 ring-amber-200", dot: "bg-amber-500", text: "text-amber-950", word: "Limited" },
  closed: { box: "bg-red-50 ring-red-200", dot: "bg-red-600", text: "text-red-900", word: "Closed" },
};

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

const lines = (text?: string) =>
  (text || "")
    .split("\n")
    .map((l) => l.trim())
    .filter(Boolean);

function parseDated(text?: string) {
  return lines(text).map((line) => {
    const [date, ...rest] = line.split("|");
    const note = rest.join("|").trim();
    return note ? { date: date.trim(), note } : { date: "", note: date.trim() };
  });
}

export const poolScheduleBlock: ComponentConfig<PoolScheduleProps> = {
  label: "Pool Schedule",
  fields: {
    poolName: { type: "text", label: "Pool name", metadata: { help: "Shown above the heading. 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." },
    },
    seasonDates: { type: "text", label: "Season dates", metadata: { help: "Like May 29 to Sep 7, 2027. Leave blank to hide it." } },
    intro: { type: "textarea", label: "Intro", metadata: { help: "Leave blank to hide it." } },
    statusTone: {
      type: "select",
      label: "Today's status",
      options: [
        { label: "Open", value: "open" },
        { label: "Limited (some areas closed)", value: "limited" },
        { label: "Closed", value: "closed" },
      ],
      metadata: { help: "Sets the color and the word shown with today's status line." },
    },
    statusLabel: { type: "text", label: "Status line", metadata: { help: "Like Open today until 8 p.m. Update it daily, or bind it to a data source. Leave blank to hide the status." } },
    statusDetail: { type: "text", label: "Status detail", metadata: { help: "Like Diving well closed for maintenance. Leave blank to hide it." } },
    days: {
      type: "array",
      label: "Days",
      min: 1,
      max: 14,
      getItemSummary: (item) => item?.day || "Day",
      defaultItemProps: { day: "New day", lap: "", open: "", lessons: "", aerobics: "" },
      arrayFields: {
        day: { type: "text", label: "Day", metadata: { help: "Like Monday, or Mon–Fri." } },
        lap: { type: "textarea", label: "Lap swim", metadata: { help: "One time range per line, like 6 to 9 a.m. Leave blank if none." } },
        open: { type: "textarea", label: "Open swim", metadata: { help: "One time range per line. Leave blank if none." } },
        lessons: { type: "textarea", label: "Lessons", metadata: { help: "One time range per line. Leave blank if none." } },
        aerobics: { type: "textarea", label: "Water aerobics", metadata: { help: "One time range per line. Leave blank if none." } },
      },
    },
    scheduleNote: { type: "textarea", label: "Lifeguard note", metadata: { help: "Lifeguard, age or swim-test rules shown under the table. Leave blank to hide it." } },
    closuresHeading: { type: "text", label: "Closures heading", metadata: { help: "Leave blank to use Closures and changes." } },
    closures: {
      type: "textarea",
      label: "Closures",
      metadata: { help: "One per line, written as Date | What's closed. Example: Jul 4 | Closed for the holiday. Leave blank to hide the list." },
    },
    weatherHeading: { type: "text", label: "Weather policy heading", metadata: { help: "Leave blank to use Weather policy." } },
    weatherPolicy: { type: "textarea", label: "Weather policy", metadata: { help: "One rule per line. Shown in an expandable section. Leave blank to hide it." } },
    lessonsHeading: { type: "text", label: "Lessons heading", metadata: { help: "Leave blank to hide the lessons panel." } },
    lessonsText: { type: "textarea", label: "Lessons text" },
    lessonsLabel: { type: "text", label: "Lessons link text" },
    lessonsHref: { type: "text", label: "Lessons link" },
  },
  defaultProps: {
    poolName: "Riverside Family Aquatic Center",
    heading: "Pool hours and schedule",
    headingLevel: "h2",
    seasonDates: "May 29 to Sep 7, 2027",
    intro: "Lanes, slides and the splash pad are included with a daily or season pass. Children under 8 must be within arm's reach of an adult in the water.",
    statusTone: "limited",
    statusLabel: "Open today, 6 a.m. to 8 p.m.",
    statusDetail: "The diving well is closed for repairs. Everything else is open.",
    days: [
      { day: "Monday", lap: "6 to 9 a.m.\n5 to 7 p.m.", open: "1 to 5 p.m.", lessons: "9 a.m. to noon", aerobics: "10 to 11 a.m." },
      { day: "Tuesday", lap: "6 to 9 a.m.\n5 to 7 p.m.", open: "1 to 5 p.m.", lessons: "9 a.m. to noon\n5:30 to 7 p.m.", aerobics: "" },
      { day: "Wednesday", lap: "6 to 9 a.m.\n5 to 7 p.m.", open: "1 to 5 p.m.", lessons: "9 a.m. to noon", aerobics: "10 to 11 a.m." },
      { day: "Thursday", lap: "6 to 9 a.m.\n5 to 7 p.m.", open: "1 to 5 p.m.", lessons: "9 a.m. to noon\n5:30 to 7 p.m.", aerobics: "" },
      { day: "Friday", lap: "6 to 9 a.m.", open: "1 to 7 p.m.", lessons: "9 a.m. to noon", aerobics: "10 to 11 a.m." },
      { day: "Saturday", lap: "7 to 10 a.m.", open: "11 a.m. to 7 p.m.", lessons: "8 to 11 a.m.", aerobics: "" },
      { day: "Sunday", lap: "7 to 10 a.m.", open: "11 a.m. to 6 p.m.", lessons: "", aerobics: "9 to 10 a.m." },
    ],
    scheduleNote: "Lifeguards are on duty during every session. Swimmers must pass a short swim test to use the deep end and slides; tests run on the hour at the lifeguard stand.",
    closuresHeading: "Closures and changes",
    closures: "Jun 19 | Closes at 3 p.m. for the Juneteenth community swim\nJul 4 | Closed for the holiday\nAug 14 | Opens at 1 p.m. for lifeguard training",
    weatherHeading: "Weather policy",
    weatherPolicy:
      "If thunder is heard or lightning is seen, everyone leaves the water for 30 minutes after the last strike.\nThe pool closes for the day if the air temperature is below 65°F at 11 a.m.\nWe post weather closings here and on the park district's social media within 15 minutes.\nPasses are not refunded for weather closings, but daily admissions get a rain check at the front desk.",
    lessonsHeading: "Swim lessons",
    lessonsText: "Two-week sessions for ages 6 months to adult, with small classes and certified instructors.",
    lessonsLabel: "See lesson levels and register",
    lessonsHref: "/aquatics/swim-lessons",
  },
  render: ({
    id,
    poolName,
    heading,
    headingLevel,
    seasonDates,
    intro,
    statusTone,
    statusLabel,
    statusDetail,
    days,
    scheduleNote,
    closuresHeading,
    closures,
    weatherHeading,
    weatherPolicy,
    lessonsHeading,
    lessonsText,
    lessonsLabel,
    lessonsHref,
  }) => {
    const H = headingLevel || "h2";
    const Sub = down[H] || "h3";
    const base = id || "pool-schedule";
    const rows = (days ?? []).filter((d) => d?.day);
    const closureList = parseDated(closures);
    const weather = lines(weatherPolicy);
    const tone = tones[statusTone] || tones.open;
    const hasHeader = Boolean(poolName || heading || seasonDates || intro || statusLabel);
    const hasAside = Boolean(closureList.length || weather.length || lessonsHeading);

    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">
          {hasHeader ? (
            <div className="flex flex-col gap-8 lg:flex-row lg:items-end lg:justify-between">
              <div className="max-w-2xl">
                {poolName ? <p className="text-sm font-semibold tracking-wide text-indigo-700">{poolName}</p> : null}
                {heading ? <H className={`text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl ${poolName ? "mt-2" : ""}`}>{heading}</H> : null}
                {seasonDates ? (
                  <p className="mt-3 inline-flex items-center gap-2 text-base font-semibold text-neutral-800">
                    <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 shrink-0 text-indigo-700">
                      <path fillRule="evenodd" d="M5.75 2a.75.75 0 0 1 .75.75V4h7V2.75a.75.75 0 0 1 1.5 0V4h.25A2.75 2.75 0 0 1 18 6.75v8.5A2.75 2.75 0 0 1 15.25 18H4.75A2.75 2.75 0 0 1 2 15.25v-8.5A2.75 2.75 0 0 1 4.75 4H5V2.75A.75.75 0 0 1 5.75 2Zm-1 5.5c-.69 0-1.25.56-1.25 1.25v6.5c0 .69.56 1.25 1.25 1.25h10.5c.69 0 1.25-.56 1.25-1.25v-6.5c0-.69-.56-1.25-1.25-1.25H4.75Z" clipRule="evenodd" />
                    </svg>
                    <span>
                      <span className="sr-only">Season: </span>
                      {seasonDates}
                    </span>
                  </p>
                ) : null}
                {intro ? <p className="mt-4 text-lg leading-8 text-pretty text-neutral-600">{intro}</p> : null}
              </div>
              {statusLabel ? (
                <div className={`w-full rounded-2xl p-5 ring-1 lg:max-w-sm ${tone.box}`}>
                  <p className={`flex items-center gap-2.5 text-xs font-semibold tracking-wide uppercase ${tone.text}`}>
                    <span aria-hidden="true" className={`size-2.5 shrink-0 rounded-full ${tone.dot}`} />
                    Today: {tone.word}
                  </p>
                  <p className="mt-2 text-lg font-semibold text-pretty text-neutral-950">{statusLabel}</p>
                  {statusDetail ? <p className="mt-1 text-sm leading-6 text-pretty text-neutral-800">{statusDetail}</p> : null}
                </div>
              ) : null}
            </div>
          ) : null}

          {rows.length ? (
            <table className={`w-full text-left text-sm leading-6 md:text-base ${hasHeader ? "mt-10 sm:mt-12" : ""}`}>
              <caption className="sr-only">{poolName ? `${poolName}: ` : ""}swim sessions by day</caption>
              <thead className="sr-only md:not-sr-only md:table-header-group">
                <tr className="border-b-2 border-neutral-900">
                  <th scope="col" className="py-3 pr-6 pl-3 font-semibold text-neutral-950">
                    Day
                  </th>
                  {sessions.map((s) => (
                    <th key={s.key} scope="col" className="py-3 pr-6 font-semibold text-neutral-950 last:pr-3">
                      {s.label}
                    </th>
                  ))}
                </tr>
              </thead>
              <tbody className="flex flex-col gap-3 md:table-row-group">
                {rows.map((d, i) => (
                  <tr
                    key={`${d.day}-${i}`}
                    className="flex flex-col rounded-2xl bg-neutral-50 p-5 ring-1 ring-neutral-200 md:table-row md:rounded-none md:border-b md:border-neutral-200 md:bg-transparent md:p-0 md:ring-0 md:even:bg-neutral-50"
                  >
                    <th scope="row" className="pb-3 text-base font-semibold text-neutral-950 md:py-4 md:pr-6 md:pl-3 md:align-top">
                      {d.day}
                    </th>
                    {sessions.map((s) => {
                      const times = lines(d[s.key]);
                      return (
                        <td
                          key={s.key}
                          className="flex flex-col gap-0.5 border-t border-neutral-200 py-2.5 text-neutral-700 last:pb-0 sm:flex-row sm:gap-4 md:table-cell md:border-t-0 md:py-4 md:pr-6 md:align-top md:last:pr-3 md:last:pb-4"
                        >
                          <span aria-hidden="true" className="text-xs font-semibold tracking-wide text-neutral-600 uppercase sm:w-32 sm:shrink-0 sm:pt-0.5 md:hidden">
                            {s.label}
                          </span>
                          {times.length ? (
                            <span className="flex flex-col tabular-nums">
                              {times.map((t, ti) => (
                                <span key={`${t}-${ti}`}>{t}</span>
                              ))}
                            </span>
                          ) : (
                            <span>
                              <span aria-hidden="true" className="text-neutral-400">—</span>
                              <span className="sr-only">None</span>
                            </span>
                          )}
                        </td>
                      );
                    })}
                  </tr>
                ))}
              </tbody>
            </table>
          ) : null}

          {scheduleNote ? (
            <p className="mt-5 flex max-w-3xl gap-2.5 text-sm leading-6 text-pretty text-neutral-700">
              <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-5 shrink-0 text-indigo-700">
                <path fillRule="evenodd" d="M9.661 2.237a.531.531 0 0 1 .678 0 11.947 11.947 0 0 0 7.078 2.749.5.5 0 0 1 .479.425c.069.52.104 1.05.104 1.59 0 5.162-3.26 9.563-7.834 11.256a.48.48 0 0 1-.332 0C5.26 16.564 2 12.163 2 7c0-.538.035-1.069.104-1.589a.5.5 0 0 1 .48-.425 11.947 11.947 0 0 0 7.077-2.75Zm4.196 5.954a.75.75 0 0 0-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z" clipRule="evenodd" />
              </svg>
              {scheduleNote}
            </p>
          ) : null}

          {hasAside ? (
            <div className={`grid grid-cols-1 gap-8 lg:grid-cols-2 lg:gap-12 ${hasHeader || rows.length ? "mt-12 sm:mt-16" : ""}`}>
              {closureList.length || weather.length ? (
                <div className={lessonsHeading ? "" : "lg:col-span-2"}>
                  {closureList.length ? (
                    <>
                      <Sub id={`${base}-closures`} className="text-xl font-semibold tracking-tight text-neutral-950">
                        {closuresHeading || "Closures and changes"}
                      </Sub>
                      <ul role="list" aria-labelledby={`${base}-closures`} className="mt-4 divide-y divide-neutral-200 border-y border-neutral-200">
                        {closureList.map((c, i) => (
                          <li key={`${c.date}-${i}`} className="flex flex-col gap-1 py-3.5 sm:flex-row sm:gap-6">
                            {c.date ? <span className="shrink-0 text-sm leading-6 font-semibold text-indigo-700 tabular-nums sm:w-16">{c.date}</span> : null}
                            <span className="text-sm leading-6 text-pretty text-neutral-700">{c.note}</span>
                          </li>
                        ))}
                      </ul>
                    </>
                  ) : null}
                  {weather.length ? (
                    <details className={`group rounded-2xl bg-neutral-50 ring-1 ring-neutral-200 ${closureList.length ? "mt-6" : ""}`}>
                      <summary
                        className={`flex min-h-12 cursor-pointer list-none items-center justify-between gap-4 rounded-2xl px-5 py-3 text-base font-semibold text-neutral-950 hover:bg-neutral-100 [&::-webkit-details-marker]:hidden ${focusRing}`}
                      >
                        <span className="flex items-center gap-2.5">
                          <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 shrink-0 text-indigo-700">
                            <path d="M11.983 1.907a.75.75 0 0 0-1.292-.657l-8.5 9.5A.75.75 0 0 0 2.75 12h6.572l-1.305 6.093a.75.75 0 0 0 1.292.657l8.5-9.5A.75.75 0 0 0 17.25 8h-6.572l1.305-6.093Z" />
                          </svg>
                          {weatherHeading || "Weather policy"}
                        </span>
                        <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 shrink-0 text-neutral-500 transition group-open:rotate-180">
                          <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>
                      </summary>
                      <ul role="list" className="space-y-3 border-t border-neutral-200 px-5 py-4 text-sm leading-6 text-neutral-700">
                        {weather.map((w, i) => (
                          <li key={`${w}-${i}`} className="flex gap-3">
                            <span aria-hidden="true" className="mt-2.5 size-1.5 shrink-0 rounded-full bg-indigo-600" />
                            <span className="text-pretty">{w}</span>
                          </li>
                        ))}
                      </ul>
                    </details>
                  ) : null}
                </div>
              ) : null}

              {lessonsHeading ? (
                <div className={`relative self-start overflow-hidden rounded-3xl bg-indigo-950 p-6 text-white sm:p-8 ${closureList.length || weather.length ? "" : "lg:col-span-2"}`}>
                  <svg aria-hidden="true" viewBox="0 0 400 60" preserveAspectRatio="none" fill="none" stroke="currentColor" strokeWidth={2} className="absolute inset-x-0 bottom-0 h-16 w-full text-indigo-800">
                    <path d="M0 20 Q 25 5 50 20 T 100 20 T 150 20 T 200 20 T 250 20 T 300 20 T 350 20 T 400 20" />
                    <path d="M0 40 Q 25 25 50 40 T 100 40 T 150 40 T 200 40 T 250 40 T 300 40 T 350 40 T 400 40" />
                  </svg>
                  <div className="relative pb-8">
                    <Sub className="text-2xl font-semibold tracking-tight text-balance">{lessonsHeading}</Sub>
                    {lessonsText ? <p className="mt-3 max-w-md text-base leading-7 text-pretty text-indigo-100">{lessonsText}</p> : null}
                    {lessonsLabel ? (
                      <a
                        href={lessonsHref || "#"}
                        className="group mt-6 inline-flex min-h-11 items-center gap-2 rounded-lg bg-white px-5 text-sm font-semibold text-indigo-950 shadow-sm transition hover:bg-indigo-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
                      >
                        {lessonsLabel}
                        <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 shrink-0 transition motion-safe:group-hover:translate-x-0.5">
                          <path fillRule="evenodd" d="M3 10a.75.75 0 0 1 .75-.75h10.64l-3.22-3.22a.75.75 0 1 1 1.06-1.06l4.5 4.5a.75.75 0 0 1 0 1.06l-4.5 4.5a.75.75 0 1 1-1.06-1.06l3.22-3.22H3.75A.75.75 0 0 1 3 10Z" clipRule="evenodd" />
                        </svg>
                      </a>
                    ) : null}
                  </div>
                </div>
              ) : null}
            </div>
          ) : null}
        </div>
      </section>
    );
  },
};
```
