# Add the "Boards & Commissions" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/boards-commissions) to this Pantheon Content Publisher (P1) Next.js project. Resident boards with purpose, meeting schedule, seat count and open vacancies called out with an apply link.

## Steps

1. Create `components/puck/boards-commissions-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 { boardsCommissionsBlock } from "./components/puck/boards-commissions-block";`
3. Register it under `components` as `BoardsCommissionsBlock: boardsCommissionsBlock`.
4. Add `"BoardsCommissionsBlock"` 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/boards-commissions-block.tsx`

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

/**
 * Boards & Commissions — the city's resident advisory boards with their purpose, meeting
 * schedule, size and open seats. Vacancies are called out in words, with an apply link.
 * Register: `BoardsCommissionsBlock: boardsCommissionsBlock` in puck.config.tsx.
 */

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

export type BoardsCommissionsProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  boards: {
    name: string;
    purpose: string;
    schedule: string;
    members: number;
    vacancies: number;
    term: string;
    href: string;
  }[];
  applyLabel: string;
  applyHref: string;
  applyHeading: string;
  applyText: string;
  clerkLabel: string;
  clerkPhone: string;
  clerkEmail: 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";

const count = (n: unknown) => {
  const v = typeof n === "number" ? n : Number.parseInt(String(n ?? ""), 10);
  return Number.isFinite(v) && v > 0 ? Math.floor(v) : 0;
};

export const boardsCommissionsBlock: ComponentConfig<BoardsCommissionsProps> = {
  label: "Boards & Commissions",
  fields: {
    eyebrow: { type: "text", label: "Eyebrow", metadata: { help: "Small line 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." },
    },
    intro: { type: "textarea", label: "Intro", metadata: { help: "Leave blank to hide it." } },
    boards: {
      type: "array",
      label: "Boards",
      min: 1,
      max: 30,
      getItemSummary: (item) => (item?.name ? `${item.name}${count(item.vacancies) ? ` · ${count(item.vacancies)} open` : ""}` : "Board"),
      defaultItemProps: { name: "New board", purpose: "", schedule: "", members: 7, vacancies: 0, term: "", href: "" },
      arrayFields: {
        name: { type: "text", label: "Board name" },
        purpose: { type: "textarea", label: "Purpose", metadata: { help: "One or two sentences on what the board decides or advises on." } },
        schedule: { type: "text", label: "Meets", metadata: { help: "Like 2nd Tuesday of each month, 6 p.m., City Hall." } },
        members: { type: "number", label: "Seats", min: 0, metadata: { help: "Total number of seats on the board." } },
        vacancies: { type: "number", label: "Open seats", min: 0, metadata: { help: "Seats you're recruiting for now. Above zero, the card shows an Apply link." } },
        term: { type: "text", label: "Term", metadata: { help: "Like 3-year terms. Leave blank to hide it." } },
        href: { type: "text", label: "Board page link", metadata: { help: "Agendas, minutes and members. Leave blank for plain text." } },
      },
    },
    applyLabel: { type: "text", label: "Apply link text", metadata: { help: "Leave blank to hide the apply links." } },
    applyHref: { type: "text", label: "Apply link", metadata: { help: "Your board application form. Each open board links here." } },
    applyHeading: { type: "text", label: "How to apply heading", metadata: { help: "Leave blank to hide the panel." } },
    applyText: { type: "textarea", label: "How to apply text", metadata: { help: "Who can serve and how appointments work." } },
    clerkLabel: { type: "text", label: "Contact office", metadata: { help: "Like City Clerk's Office. Shown before the phone and email." } },
    clerkPhone: { type: "text", label: "Clerk phone", metadata: { help: "Shown as a tap-to-call link." } },
    clerkEmail: { type: "text", label: "Clerk email" },
  },
  defaultProps: {
    eyebrow: "Serve your community",
    heading: "Boards and commissions",
    headingLevel: "h2",
    intro: "Resident volunteers advise the City Council on everything from parks to zoning. No special experience needed, just a willingness to listen and show up.",
    boards: [
      {
        name: "Planning Commission",
        purpose: "Reviews zoning changes, subdivisions and the comprehensive plan, and makes recommendations to the City Council.",
        schedule: "1st and 3rd Monday, 6 p.m., City Hall",
        members: 9,
        vacancies: 2,
        term: "4-year terms",
        href: "/boards/planning-commission",
      },
      {
        name: "Parks & Recreation Board",
        purpose: "Advises on park improvements, program fees and the trail master plan.",
        schedule: "2nd Wednesday, 5:30 p.m., Northside Recreation Center",
        members: 7,
        vacancies: 0,
        term: "3-year terms",
        href: "/boards/parks",
      },
      {
        name: "Library Board of Trustees",
        purpose: "Sets library policy, approves the library budget and hires the library director.",
        schedule: "3rd Thursday, 4 p.m., Main Library",
        members: 7,
        vacancies: 1,
        term: "3-year terms",
        href: "/boards/library",
      },
      {
        name: "Human Rights Commission",
        purpose: "Hears discrimination complaints and leads community education on fair housing and equal treatment.",
        schedule: "4th Tuesday, 6 p.m., City Hall",
        members: 11,
        vacancies: 3,
        term: "3-year terms",
        href: "/boards/human-rights",
      },
      {
        name: "Historic Preservation Commission",
        purpose: "Reviews exterior changes to buildings in Millbrook's three historic districts.",
        schedule: "1st Thursday, 5 p.m., City Hall",
        members: 5,
        vacancies: 0,
        term: "3-year terms",
        href: "/boards/historic-preservation",
      },
      {
        name: "Youth Advisory Council",
        purpose: "High school students who bring young residents' priorities to the Mayor and Council.",
        schedule: "Every other Monday during the school year, 4 p.m.",
        members: 15,
        vacancies: 4,
        term: "1-year terms",
        href: "/boards/youth",
      },
    ],
    applyLabel: "Apply to serve",
    applyHref: "/boards/apply",
    applyHeading: "How appointments work",
    applyText: "Any Millbrook resident 18 or older can apply (Youth Advisory Council: ages 14–18). The Mayor reviews applications and the City Council confirms appointments. We keep applications on file for one year.",
    clerkLabel: "City Clerk’s Office",
    clerkPhone: "(555) 555-0105",
    clerkEmail: "clerk@millbrook.example.gov",
  },
  render: ({ eyebrow, heading, headingLevel, intro, boards, applyLabel, applyHref, applyHeading, applyText, clerkLabel, clerkPhone, clerkEmail }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[headingLevel] || "h3";
    const list = (boards ?? []).filter((b) => b?.name);
    const totalOpen = list.reduce((sum, b) => sum + count(b.vacancies), 0);
    const boardsOpen = list.filter((b) => count(b.vacancies) > 0).length;
    const tel = clerkPhone ? clerkPhone.replace(/[^\d+]/g, "") : "";
    const hasHeader = Boolean(eyebrow || heading || intro);
    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-7xl">
          {hasHeader || totalOpen ? (
            <div className="flex flex-col gap-6 lg:flex-row lg:items-end lg:justify-between lg:gap-16">
              {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}
                </div>
              ) : null}
              {totalOpen ? (
                <p className="flex shrink-0 items-baseline gap-3 self-start border-l-4 border-indigo-700 pl-4 lg:self-auto">
                  <span className="text-4xl font-semibold tracking-tight text-neutral-950 tabular-nums">{totalOpen}</span>
                  <span className="text-sm leading-5 font-medium text-neutral-700">
                    open {totalOpen === 1 ? "seat" : "seats"}
                    <br />
                    on {boardsOpen} {boardsOpen === 1 ? "board" : "boards"}
                  </span>
                </p>
              ) : null}
            </div>
          ) : null}

          {list.length ? (
            <ul role="list" className={`grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3 ${hasHeader || totalOpen ? "mt-10 sm:mt-12" : ""}`}>
              {list.map((b, i) => {
                const seats = count(b.members);
                const open = count(b.vacancies);
                return (
                  <li
                    key={`${b.name}-${i}`}
                    className={`flex flex-col rounded-2xl p-6 ring-1 ${open ? "bg-indigo-50/60 ring-indigo-600/25" : "bg-white ring-neutral-200"}`}
                  >
                    <div className="flex flex-wrap items-center gap-2">
                      {open ? (
                        <p className="inline-flex items-center gap-1.5 rounded-full bg-indigo-700 px-2.5 py-1 text-xs font-semibold text-white">
                          <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-3.5">
                            <path d="M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z" />
                          </svg>
                          {open} open {open === 1 ? "seat" : "seats"}
                        </p>
                      ) : (
                        <p className="inline-flex items-center rounded-full bg-neutral-100 px-2.5 py-1 text-xs font-semibold text-neutral-700">No current vacancies</p>
                      )}
                    </div>
                    <Sub className="mt-4 text-lg font-semibold tracking-tight text-neutral-950">
                      {b.href ? (
                        <a href={b.href} className={`rounded hover:text-indigo-800 hover:underline hover:decoration-indigo-300 hover:underline-offset-4 ${focusRing}`}>
                          {b.name}
                        </a>
                      ) : (
                        b.name
                      )}
                    </Sub>
                    {b.purpose ? <p className="mt-2 text-sm leading-6 text-pretty text-neutral-700">{b.purpose}</p> : null}
                    <dl className="mt-5 grid grid-cols-1 gap-2 border-t border-neutral-950/10 pt-4 text-sm leading-6">
                      {b.schedule ? (
                        <div className="flex gap-3">
                          <dt className="w-14 shrink-0 font-semibold text-neutral-950">Meets</dt>
                          <dd className="min-w-0 text-neutral-700">{b.schedule}</dd>
                        </div>
                      ) : null}
                      {seats ? (
                        <div className="flex gap-3">
                          <dt className="w-14 shrink-0 font-semibold text-neutral-950">Seats</dt>
                          <dd className="min-w-0 text-neutral-700 tabular-nums">
                            {seats} {seats === 1 ? "member" : "members"}
                            {b.term ? `, ${b.term}` : ""}
                          </dd>
                        </div>
                      ) : null}
                    </dl>
                    {open && applyLabel ? (
                      <a
                        href={applyHref || "#"}
                        className={`mt-5 inline-flex min-h-11 items-center justify-center gap-1.5 self-start rounded-lg bg-indigo-700 px-4 text-sm font-semibold text-white shadow-sm transition hover:bg-indigo-600 sm:mt-auto ${focusRing}`}
                      >
                        {applyLabel}
                        <span className="sr-only">: {b.name}</span>
                      </a>
                    ) : null}
                  </li>
                );
              })}
            </ul>
          ) : null}

          {applyHeading ? (
            <aside aria-label={applyHeading} className="mt-10 grid grid-cols-1 gap-4 border-t border-neutral-200 pt-8 md:grid-cols-3 md:gap-10">
              <p className="text-base font-semibold text-neutral-950">{applyHeading}</p>
              <div className="min-w-0 md:col-span-2">
                {applyText ? <p className="text-sm leading-6 text-pretty text-neutral-700">{applyText}</p> : null}
                {tel || clerkEmail ? (
                  <p className="mt-2 flex flex-col gap-x-6 text-sm font-semibold sm:flex-row sm:flex-wrap">
                    {clerkLabel ? <span className="inline-flex min-h-11 items-center font-semibold text-neutral-950">{clerkLabel}</span> : null}
                    {tel ? (
                      <a href={`tel:${tel}`} className={`inline-flex min-h-11 items-center rounded text-indigo-700 underline decoration-indigo-300 underline-offset-4 hover:decoration-indigo-700 ${focusRing}`}>
                        {clerkPhone}
                      </a>
                    ) : null}
                    {clerkEmail ? (
                      <a href={`mailto:${clerkEmail}`} className={`inline-flex min-h-11 items-center rounded break-all text-indigo-700 underline decoration-indigo-300 underline-offset-4 hover:decoration-indigo-700 ${focusRing}`}>
                        {clerkEmail}
                      </a>
                    ) : null}
                  </p>
                ) : null}
              </div>
            </aside>
          ) : null}
        </div>
      </section>
    );
  },
};
```
