# Add the "Utility Rates" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/utility-rates) to this Pantheon Content Publisher (P1) Next.js project. Water, sewer and trash rate tables by tier, with the effective date, a pay-your-bill link and bill assistance.

## Steps

1. Create `components/puck/utility-rates-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 { utilityRatesBlock } from "./components/puck/utility-rates-block";`
3. Register it under `components` as `UtilityRatesBlock: utilityRatesBlock`.
4. Add `"UtilityRatesBlock"` 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/utility-rates-block.tsx`

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

/**
 * Utility Rates — water, sewer and trash rates as real tables (one per service, tiered by
 * usage), with the effective date, a pay-your-bill link and a bill assistance panel.
 * Register: `UtilityRatesBlock: utilityRatesBlock` in puck.config.tsx.
 */

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

export type UtilityRatesProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  effectiveDate: string;
  services: {
    name: string;
    baseCharge: string;
    tiers: { tier: string; usage: string; rate: string }[];
    note: string;
  }[];
  tierHeader: string;
  usageHeader: string;
  rateHeader: string;
  source: string;
  payHeading: string;
  payText: string;
  payLabel: string;
  payHref: string;
  assistanceHeading: string;
  assistanceText: string;
  assistanceLabel: string;
  assistanceHref: string;
  assistancePhone: 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 utilityRatesBlock: ComponentConfig<UtilityRatesProps> = {
  label: "Utility Rates",
  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." } },
    effectiveDate: { type: "text", label: "Effective date", metadata: { help: "Like Rates effective July 1, 2026. Leave blank to hide it." } },
    services: {
      type: "array",
      label: "Services",
      min: 1,
      max: 6,
      getItemSummary: (item) => item?.name || "Service",
      defaultItemProps: { name: "New service", baseCharge: "", tiers: [{ tier: "All usage", usage: "", rate: "" }], note: "" },
      arrayFields: {
        name: { type: "text", label: "Service", metadata: { help: "Like Water, Sewer, or Trash & recycling." } },
        baseCharge: { type: "text", label: "Base charge", metadata: { help: "The fixed monthly charge, like $12.40 per month. Leave blank to hide it." } },
        tiers: {
          type: "array",
          label: "Rate rows",
          min: 1,
          max: 8,
          getItemSummary: (item) => (item?.tier ? `${item.tier}${item.rate ? ` · ${item.rate}` : ""}` : "Row"),
          defaultItemProps: { tier: "New tier", usage: "", rate: "" },
          arrayFields: {
            tier: { type: "text", label: "Tier", metadata: { help: "Like Tier 1, or 64-gallon cart." } },
            usage: { type: "text", label: "Usage", metadata: { help: "Like 0–4,000 gallons per month." } },
            rate: { type: "text", label: "Rate", metadata: { help: "Like $4.12 per 1,000 gallons." } },
          },
        },
        note: { type: "textarea", label: "Note", metadata: { help: "One short line under the table, like how usage is measured. Leave blank to hide it." } },
      },
    },
    tierHeader: { type: "text", label: "Tier column heading", metadata: { help: "Shown at the top of the first column in every table." } },
    usageHeader: { type: "text", label: "Usage column heading" },
    rateHeader: { type: "text", label: "Rate column heading" },
    source: { type: "text", label: "Source line", metadata: { help: "Where these rates come from, like the ordinance number. Leave blank to hide it." } },
    payHeading: { type: "text", label: "Pay panel heading", metadata: { help: "Leave the pay link text blank to hide the whole panel." } },
    payText: { type: "textarea", label: "Pay panel text" },
    payLabel: { type: "text", label: "Pay link text" },
    payHref: { type: "text", label: "Pay link" },
    assistanceHeading: { type: "text", label: "Assistance heading", metadata: { help: "Leave blank to hide the assistance panel." } },
    assistanceText: { type: "textarea", label: "Assistance text", metadata: { help: "Who qualifies and what they get, in one or two sentences." } },
    assistanceLabel: { type: "text", label: "Assistance link text" },
    assistanceHref: { type: "text", label: "Assistance link" },
    assistancePhone: { type: "text", label: "Assistance phone", metadata: { help: "Shown as a tap-to-call link. Leave blank to hide it." } },
  },
  defaultProps: {
    heading: "Water, sewer and trash rates",
    headingLevel: "h2",
    intro: "Your monthly utility bill has a fixed base charge plus a charge for what you use. Water and sewer are billed by the gallon in tiers, so the first gallons cost the least.",
    effectiveDate: "Rates effective July 1, 2026",
    services: [
      {
        name: "Water",
        baseCharge: "$12.40 per month",
        tiers: [
          { tier: "Tier 1", usage: "0–4,000 gallons", rate: "$4.12 per 1,000 gal." },
          { tier: "Tier 2", usage: "4,001–10,000 gallons", rate: "$5.38 per 1,000 gal." },
          { tier: "Tier 3", usage: "Over 10,000 gallons", rate: "$7.05 per 1,000 gal." },
        ],
        note: "Usage is read from your meter each month. The average Millbrook household uses about 5,000 gallons.",
      },
      {
        name: "Sewer",
        baseCharge: "$15.75 per month",
        tiers: [
          { tier: "Tier 1", usage: "0–4,000 gallons", rate: "$5.60 per 1,000 gal." },
          { tier: "Tier 2", usage: "Over 4,000 gallons", rate: "$6.90 per 1,000 gal." },
        ],
        note: "Sewer is based on your winter water use (December to February), so summer lawn watering doesn't raise it.",
      },
      {
        name: "Trash & recycling",
        baseCharge: "",
        tiers: [
          { tier: "Small cart", usage: "35 gallons, weekly", rate: "$18.00 per month" },
          { tier: "Standard cart", usage: "64 gallons, weekly", rate: "$22.50 per month" },
          { tier: "Large cart", usage: "96 gallons, weekly", rate: "$27.00 per month" },
        ],
        note: "Recycling and yard waste pickup are included with every cart size.",
      },
    ],
    tierHeader: "Tier",
    usageHeader: "Monthly usage",
    rateHeader: "Rate",
    source: "Sample rates. Source: Millbrook City Council Ordinance 2026-14.",
    payHeading: "Pay your bill",
    payText: "Pay online, set up autopay, or see your usage history. No fee for bank account payments.",
    payLabel: "Pay my utility bill",
    payHref: "/utilities/pay",
    assistanceHeading: "Help paying your bill",
    assistanceText: "Households at or below 200% of the federal poverty level can get up to 30% off water and sewer charges. Seniors 65 and older can also apply for a fixed-income discount.",
    assistanceLabel: "See if you qualify",
    assistanceHref: "/utilities/assistance",
    assistancePhone: "(555) 555-0124",
  },
  render: ({
    id,
    heading,
    headingLevel,
    intro,
    effectiveDate,
    services,
    tierHeader,
    usageHeader,
    rateHeader,
    source,
    payHeading,
    payText,
    payLabel,
    payHref,
    assistanceHeading,
    assistanceText,
    assistanceLabel,
    assistanceHref,
    assistancePhone,
  }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[headingLevel] || "h3";
    const baseId = id || "utility-rates";
    const list = (services ?? []).filter((s) => s?.name);
    const tel = assistancePhone ? assistancePhone.replace(/[^\d+]/g, "") : "";
    const hasPay = Boolean(payLabel);
    const hasAssist = Boolean(assistanceHeading);
    const cols = list.length >= 3 ? "lg:grid-cols-3" : list.length === 2 ? "lg:grid-cols-2" : "";
    return (
      <section aria-labelledby={heading ? `${baseId}-heading` : undefined} 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">
          {heading || intro || effectiveDate ? (
            <div className="flex flex-col gap-6 lg:flex-row lg:items-end lg:justify-between lg:gap-16">
              <div className="max-w-2xl">
                {heading ? (
                  <H id={`${baseId}-heading`} 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>
              {effectiveDate ? (
                <p className="inline-flex items-center gap-2 self-start rounded-full bg-white px-4 py-2 text-sm font-semibold text-neutral-900 ring-1 ring-neutral-200 lg:self-auto">
                  <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>
                  {effectiveDate}
                </p>
              ) : null}
            </div>
          ) : null}

          {list.length ? (
            <div className={`grid grid-cols-1 gap-6 ${cols} ${heading || intro || effectiveDate ? "mt-10 sm:mt-12" : ""}`}>
              {list.map((service, i) => {
                const rows = (service.tiers ?? []).filter((t) => t?.tier || t?.rate);
                const capId = `${baseId}-cap-${i}`;
                return (
                  <article key={`${service.name}-${i}`} className="flex min-w-0 flex-col rounded-2xl bg-white shadow-sm ring-1 ring-neutral-200">
                    <header className="flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1 border-b border-neutral-200 px-5 py-5 sm:px-6">
                      <Sub className="text-lg font-semibold tracking-tight text-neutral-950">{service.name}</Sub>
                      {service.baseCharge ? (
                        <p className="text-sm text-neutral-600">
                          Base charge <span className="font-semibold text-neutral-950 tabular-nums">{service.baseCharge}</span>
                        </p>
                      ) : null}
                    </header>
                    {rows.length ? (
                      <div role="region" aria-labelledby={capId} tabIndex={0} className={`relative overflow-x-auto ${focusRing} focus-visible:-outline-offset-2`}>
                        <table className="w-full min-w-72 text-left text-sm">
                          <caption id={capId} className="sr-only">
                            {service.name} rates{effectiveDate ? `, ${effectiveDate.toLowerCase()}` : ""}
                          </caption>
                          <thead>
                            <tr className="text-xs tracking-wide text-neutral-600 uppercase">
                              <th scope="col" className="px-5 pt-4 pb-2 font-semibold sm:px-6">{tierHeader || "Tier"}</th>
                              <th scope="col" className="px-3 pt-4 pb-2 font-semibold">{usageHeader || "Usage"}</th>
                              <th scope="col" className="px-5 pt-4 pb-2 text-right font-semibold sm:px-6">{rateHeader || "Rate"}</th>
                            </tr>
                          </thead>
                          <tbody className="divide-y divide-neutral-100">
                            {rows.map((row, j) => (
                              <tr key={j}>
                                <th scope="row" className="px-5 py-3 align-top font-semibold text-neutral-950 sm:px-6">{row.tier}</th>
                                <td className="px-3 py-3 align-top text-neutral-700 tabular-nums">{row.usage}</td>
                                <td className="px-5 py-3 text-right align-top font-semibold text-neutral-950 tabular-nums sm:px-6">{row.rate}</td>
                              </tr>
                            ))}
                          </tbody>
                        </table>
                      </div>
                    ) : null}
                    {service.note ? <p className="mt-auto border-t border-neutral-100 px-5 py-4 text-sm leading-6 text-pretty text-neutral-600 sm:px-6">{service.note}</p> : null}
                  </article>
                );
              })}
            </div>
          ) : null}

          {source ? <p className="mt-4 text-xs leading-5 text-neutral-600">{source}</p> : null}

          {hasPay || hasAssist ? (
            <div className={`mt-10 grid grid-cols-1 gap-6 ${hasPay && hasAssist ? "lg:grid-cols-5" : ""}`}>
              {hasPay ? (
                <div className={`flex flex-col justify-between gap-6 rounded-2xl bg-indigo-700 p-6 text-white sm:p-8 ${hasAssist ? "lg:col-span-2" : ""}`}>
                  <div>
                    {payHeading ? <p className="text-xl font-semibold tracking-tight">{payHeading}</p> : null}
                    {payText ? <p className="mt-2 text-sm leading-6 text-pretty text-indigo-100">{payText}</p> : null}
                  </div>
                  <a
                    href={payHref || "#"}
                    className="inline-flex min-h-12 items-center justify-center gap-2 self-start rounded-lg bg-white px-5 text-base font-semibold text-indigo-800 shadow-sm transition hover:bg-indigo-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
                  >
                    {payLabel}
                    <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-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>
                </div>
              ) : null}
              {hasAssist ? (
                <aside aria-label={assistanceHeading} className={`flex flex-col gap-4 rounded-2xl bg-white p-6 ring-1 ring-neutral-200 sm:flex-row sm:gap-5 sm:p-8 ${hasPay ? "lg:col-span-3" : ""}`}>
                  <span aria-hidden="true" className="grid size-11 shrink-0 place-items-center rounded-full bg-indigo-50 text-indigo-700 ring-1 ring-indigo-600/15">
                    <svg viewBox="0 0 20 20" fill="currentColor" className="size-5">
                      <path d="m9.653 16.915-.005-.003-.019-.01a20.759 20.759 0 0 1-1.162-.682 22.045 22.045 0 0 1-2.582-1.9C4.045 12.733 2 10.352 2 7.5a4.5 4.5 0 0 1 8-2.828A4.5 4.5 0 0 1 18 7.5c0 2.852-2.044 5.233-3.885 6.82a22.049 22.049 0 0 1-3.744 2.582l-.019.01-.005.003h-.002a.739.739 0 0 1-.69.001l-.002-.001Z" />
                    </svg>
                  </span>
                  <div className="min-w-0">
                    <p className="text-lg font-semibold text-neutral-950">{assistanceHeading}</p>
                    {assistanceText ? <p className="mt-2 text-sm leading-6 text-pretty text-neutral-700">{assistanceText}</p> : null}
                    {assistanceLabel || tel ? (
                      <p className="mt-3 flex flex-col gap-x-6 text-sm font-semibold sm:flex-row sm:flex-wrap">
                        {assistanceLabel ? (
                          <a href={assistanceHref || "#"} className={`inline-flex min-h-11 items-center rounded text-indigo-700 underline decoration-indigo-300 underline-offset-4 hover:decoration-indigo-700 ${focusRing}`}>
                            {assistanceLabel}
                          </a>
                        ) : 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}`}>
                            <span className="sr-only">Call&nbsp;</span>
                            {assistancePhone}
                          </a>
                        ) : null}
                      </p>
                    ) : null}
                  </div>
                </aside>
              ) : null}
            </div>
          ) : null}
        </div>
      </section>
    );
  },
};
```
