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

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/collection-schedule) to this Pantheon Content Publisher (P1) Next.js project. Trash, recycling and yard waste days by zone in a table that stacks on phones, with holiday changes.

## Steps

1. Create `components/puck/collection-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 { collectionScheduleBlock } from "./components/puck/collection-schedule-block";`
3. Register it under `components` as `CollectionScheduleBlock: collectionScheduleBlock`.
4. Add `"CollectionScheduleBlock"` 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/collection-schedule-block.tsx`

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

/**
 * Collection Schedule — trash, recycling and yard waste days by zone, as a real data table
 * that stacks into labelled cards on phones, plus holiday changes and helpful links.
 * Register: `CollectionScheduleBlock: collectionScheduleBlock` in puck.config.tsx.
 */

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

export type CollectionScheduleProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  zones: {
    zone: string;
    trashDay: string;
    recycling: string;
    yardWaste: string;
  }[];
  holidayHeading: string;
  holidays: string;
  zoneLabel: string;
  zoneHref: string;
  binNote: string;
  binLabel: string;
  binHref: string;
};

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

const columns = ["Trash", "Recycling", "Yard waste"] as const;

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

const arrow = (
  <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>
);

export const collectionScheduleBlock: ComponentConfig<CollectionScheduleProps> = {
  label: "Collection Schedule",
  fields: {
    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." } },
    zones: {
      type: "array",
      label: "Zones",
      min: 1,
      max: 20,
      getItemSummary: (item) => (item?.zone ? `${item.zone}${item.trashDay ? ` · ${item.trashDay}` : ""}` : "Zone"),
      defaultItemProps: { zone: "New zone", trashDay: "", recycling: "", yardWaste: "" },
      arrayFields: {
        zone: { type: "text", label: "Zone", metadata: { help: "Like \"Zone A, North\". Use the name residents see on their bill or map." } },
        trashDay: { type: "text", label: "Trash day", metadata: { help: "Like \"Monday\"." } },
        recycling: { type: "text", label: "Recycling", metadata: { help: "Day and week, like \"Monday, every other week (A weeks)\"." } },
        yardWaste: { type: "text", label: "Yard waste", metadata: { help: "Like \"Mondays, April to November\". Leave blank if not offered." } },
      },
    },
    holidayHeading: { type: "text", label: "Holiday heading", metadata: { help: "Leave blank to use \"Holiday schedule\"." } },
    holidays: {
      type: "textarea",
      label: "Holiday changes",
      metadata: { help: "One holiday per line, written as Date | What changes. Example: Nov 26 | Thanksgiving: collection shifts one day later. Leave blank to hide the list." },
    },
    zoneLabel: { type: "text", label: "Find-my-zone link text", metadata: { help: "Leave blank to hide the link." } },
    zoneHref: { type: "text", label: "Find-my-zone link", metadata: { help: "Your address lookup or zone map." } },
    binNote: { type: "textarea", label: "Sorting guide note", metadata: { help: "One sentence shown above the sorting guide link. Leave blank to hide it." } },
    binLabel: { type: "text", label: "Sorting guide link text", metadata: { help: "Leave blank to hide the link." } },
    binHref: { type: "text", label: "Sorting guide link", metadata: { help: "Your page explaining what goes in each cart." } },
  },
  defaultProps: {
    heading: "Trash and recycling schedule",
    headingLevel: "h2",
    intro: "Set carts at the curb by 6 a.m. on your collection day, with lids closed and handles facing your house. Recycling is picked up every other week.",
    zones: [
      { zone: "Zone A (North)", trashDay: "Monday", recycling: "Monday, A weeks", yardWaste: "Mondays, April to November" },
      { zone: "Zone B (East)", trashDay: "Tuesday", recycling: "Tuesday, B weeks", yardWaste: "Tuesdays, April to November" },
      { zone: "Zone C (Downtown)", trashDay: "Wednesday", recycling: "Wednesday, A weeks", yardWaste: "Not offered; use the drop-off site" },
      { zone: "Zone D (South)", trashDay: "Thursday", recycling: "Thursday, B weeks", yardWaste: "Thursdays, April to November" },
      { zone: "Zone E (West)", trashDay: "Friday", recycling: "Friday, A weeks", yardWaste: "Fridays, April to November" },
    ],
    holidayHeading: "Holiday schedule",
    holidays:
      "Nov 26 | Thanksgiving: Thursday and Friday collection shifts one day later.\nDec 25 | Christmas Day: Friday collection moves to Saturday, Dec 26.\nJan 1 | New Year's Day: Friday collection moves to Saturday, Jan 2.\nJan 18 | Martin Luther King Jr. Day: no change to collection.",
    zoneLabel: "Find my zone",
    zoneHref: "/sanitation/find-my-zone",
    binNote: "Not sure if something can be recycled? Check the guide before it goes in the cart.",
    binLabel: "What goes in each cart",
    binHref: "/sanitation/sorting-guide",
  },
  render: ({ id, heading, headingLevel, intro, zones, holidayHeading, holidays, zoneLabel, zoneHref, binNote, binLabel, binHref }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[headingLevel] || "h3";
    const rows = (zones ?? []).filter((z) => z?.zone);
    const holidayList = parseHolidays(holidays);
    const holidayId = `${id || "collection-schedule"}-holidays`;
    const hasHeader = Boolean(heading || intro || zoneLabel);
    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-6 md:flex-row md:items-end md:justify-between">
              {heading || intro ? (
                <div className="max-w-2xl">
                  {heading ? <H className="text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl">{heading}</H> : null}
                  {intro ? <p className="mt-4 text-lg leading-8 text-pretty text-neutral-600">{intro}</p> : null}
                </div>
              ) : null}
              {zoneLabel ? (
                <a
                  href={zoneHref || "#"}
                  className="group inline-flex min-h-11 shrink-0 items-center justify-center gap-2 self-start rounded-lg bg-indigo-700 px-5 text-base font-semibold text-white shadow-sm transition hover:bg-indigo-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-700 md:self-auto"
                >
                  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 shrink-0">
                    <path fillRule="evenodd" d="M9 3.5a5.5 5.5 0 1 0 0 11 5.5 5.5 0 0 0 0-11ZM2 9a7 7 0 1 1 12.452 4.391l3.328 3.329a.75.75 0 1 1-1.06 1.06l-3.329-3.328A7 7 0 0 1 2 9Z" clipRule="evenodd" />
                  </svg>
                  {zoneLabel}
                </a>
              ) : null}
            </div>
          ) : null}

          {rows.length ? (
            <table role="table" className={`w-full text-left text-sm leading-6 md:text-base ${hasHeader ? "mt-10 sm:mt-12" : ""}`}>
              <caption className="sr-only">{heading ? `${heading}: collection days by zone` : "Collection days by zone"}</caption>
              <thead role="rowgroup" className="sr-only md:not-sr-only md:table-header-group">
                <tr role="row" className="border-b-2 border-neutral-900">
                  <th role="columnheader" scope="col" className="py-3 pr-6 font-semibold text-neutral-950">
                    Zone
                  </th>
                  {columns.map((c) => (
                    <th key={c} role="columnheader" scope="col" className="py-3 pr-6 font-semibold text-neutral-950 last:pr-0">
                      {c}
                    </th>
                  ))}
                </tr>
              </thead>
              <tbody role="rowgroup" className="flex flex-col gap-3 md:table-row-group">
                {rows.map((z, i) => {
                  const cells = [z.trashDay, z.recycling, z.yardWaste];
                  return (
                    <tr
                      key={`${z.zone}-${i}`}
                      role="row"
                      className="flex flex-col rounded-2xl bg-neutral-50 p-5 ring-1 ring-neutral-200 md:table-row md:rounded-none md:bg-transparent md:p-0 md:ring-0 md:border-b md:border-neutral-200 md:even:bg-neutral-50"
                    >
                      <th role="rowheader" scope="row" className="pb-3 text-base font-semibold text-neutral-950 md:py-4 md:pr-6 md:pl-3 md:align-top">
                        {z.zone}
                      </th>
                      {cells.map((value, j) => (
                        <td
                          key={columns[j]}
                          role="cell"
                          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:pb-4 md:last:pr-3"
                        >
                          <span aria-hidden="true" className="text-xs font-semibold tracking-wide text-neutral-600 uppercase sm:w-28 sm:shrink-0 sm:pt-0.5 md:hidden">
                            {columns[j]}
                          </span>
                          <span className={j === 0 && value ? "font-semibold text-neutral-950" : undefined}>
                            {value || (
                              <>
                                <span aria-hidden="true">—</span>
                                <span className="sr-only">None</span>
                              </>
                            )}
                          </span>
                        </td>
                      ))}
                    </tr>
                  );
                })}
              </tbody>
            </table>
          ) : null}

          {holidayList.length || binLabel ? (
            <div className={`grid gap-8 lg:grid-cols-3 lg:gap-12 ${hasHeader || rows.length ? "mt-12 sm:mt-16" : ""}`}>
              {holidayList.length ? (
                <div className={binLabel ? "lg:col-span-2" : "lg:col-span-3"}>
                  <Sub id={holidayId} className="text-xl font-semibold tracking-tight text-neutral-950">
                    {holidayHeading || "Holiday schedule"}
                  </Sub>
                  <ul role="list" aria-labelledby={holidayId} className="mt-4 divide-y divide-neutral-200 border-y border-neutral-200">
                    {holidayList.map((h, i) => (
                      <li key={`${h.date}-${i}`} className="flex flex-col gap-1 py-4 sm:flex-row sm:gap-6">
                        {h.date ? <span className="shrink-0 text-sm leading-6 font-semibold text-indigo-700 tabular-nums sm:w-20">{h.date}</span> : null}
                        <span className="text-sm leading-6 text-pretty text-neutral-700">{h.note}</span>
                      </li>
                    ))}
                  </ul>
                </div>
              ) : null}
              {binLabel ? (
                <div className="self-start rounded-2xl bg-indigo-50 p-6 ring-1 ring-indigo-100 sm:p-8">
                  <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round" className="size-8 text-indigo-700">
                    <path d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99" />
                  </svg>
                  {binNote ? <p className="mt-4 text-base leading-7 text-pretty text-neutral-800">{binNote}</p> : null}
                  <a
                    href={binHref || "#"}
                    className="group mt-3 inline-flex min-h-11 items-center gap-1.5 rounded-lg text-base font-semibold text-indigo-800 hover:text-indigo-950 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-700"
                  >
                    {binLabel}
                    {arrow}
                  </a>
                </div>
              ) : null}
            </div>
          ) : null}
        </div>
      </section>
    );
  },
};
```
