# Add the "Report an Issue" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/report-an-issue) to this Pantheon Content Publisher (P1) Next.js project. A 311-style guide to reporting a problem, with common issue links, phone and app options, and what happens next.

## Steps

1. Create `components/puck/report-an-issue-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 { reportAnIssueBlock } from "./components/puck/report-an-issue-block";`
3. Register it under `components` as `ReportAnIssueBlock: reportAnIssueBlock`.
4. Add `"ReportAnIssueBlock"` 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/report-an-issue-block.tsx`

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

/**
 * Report an Issue — a 311-style "report a problem" section: how to report in a few steps,
 * shortcuts to common issue types, other ways to reach 311, and what happens after you report.
 * Register: `ReportAnIssueBlock: reportAnIssueBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";
type Icon = "pothole" | "light" | "graffiti" | "trash" | "tree" | "water" | "sign" | "noise" | "other";
type Channel = "phone" | "app" | "web" | "email" | "text";

export type ReportAnIssueProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  emergencyText: string;
  reportLabel: string;
  reportHref: string;
  stepsHeading: string;
  steps: { title: string; text: string }[];
  issuesHeading: string;
  issues: { icon: Icon; label: string; href: string }[];
  channelsHeading: string;
  channels: { kind: Channel; label: string; detail: string; href: string }[];
  nextHeading: string;
  next: { title: string; time: string; text: string }[];
};

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

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

const issueIcons: Record<Icon, { label: string; path: string }> = {
  pothole: { label: "Pothole", path: "M3 17h18M5 17c1-3 3-4 7-4s6 1 7 4M8 13l1-3m7 3-1-3M4 7h16" },
  light: { label: "Streetlight", path: "M9 21h6M12 21V9m0 0a3 3 0 0 0 3-3H9a3 3 0 0 0 3 3Zm-5-6 2 2m8-2-2 2M12 1v2" },
  graffiti: { label: "Graffiti", path: "M9 3h6v4l2 2v12H7V9l2-2V3Zm0 4h6M3 14c2-1 3 1 5 0m8 0c2-1 3 1 5 0" },
  trash: { label: "Missed pickup", path: "m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" },
  tree: { label: "Tree or limb down", path: "M12 21v-6m0 0-3-3m3 3 3-3M12 3a5 5 0 0 0-5 5 4 4 0 0 0 1 7h8a4 4 0 0 0 1-7 5 5 0 0 0-5-5Z" },
  water: { label: "Water leak", path: "M12 2.75c-3.6 4.4-6.75 8.2-6.75 11.75a6.75 6.75 0 0 0 13.5 0C18.75 10.95 15.6 7.15 12 2.75ZM8.75 14.75a3.25 3.25 0 0 0 3.25 3.25" },
  sign: { label: "Damaged sign", path: "M12 21v-8m-6-8h12l2 4-2 4H6V5Z" },
  noise: { label: "Noise", path: "M11 5 6 9H3v6h3l5 4V5Zm4.5 3.5a5 5 0 0 1 0 7m3-10a9 9 0 0 1 0 13" },
  other: { label: "Something else", path: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0-4h.01M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.6v.1" },
};

const channelIcons: Record<Channel, { label: string; path: string }> = {
  phone: { label: "Phone", path: "M2.25 6.75c0 8.284 6.716 15 15 15h2.25a2.25 2.25 0 0 0 2.25-2.25v-1.372c0-.516-.351-.966-.852-1.091l-4.423-1.106c-.44-.11-.902.055-1.173.417l-.97 1.293c-.282.376-.769.542-1.21.38a12.035 12.035 0 0 1-7.143-7.143c-.162-.441.004-.928.38-1.21l1.293-.97c.363-.271.527-.734.417-1.173L6.963 3.102a1.125 1.125 0 0 0-1.091-.852H4.5A2.25 2.25 0 0 0 2.25 4.5v2.25Z" },
  app: { label: "Mobile app", path: "M10.5 1.5H8.25A2.25 2.25 0 0 0 6 3.75v16.5a2.25 2.25 0 0 0 2.25 2.25h7.5A2.25 2.25 0 0 0 18 20.25V3.75a2.25 2.25 0 0 0-2.25-2.25H13.5m-3 0V3h3V1.5m-3 0h3m-3 18.75h3" },
  web: { label: "Online", path: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0 0c2.5-2.5 3.5-5.5 3.5-9S14.5 5.5 12 3m0 18c-2.5-2.5-3.5-5.5-3.5-9S9.5 5.5 12 3M3.5 9h17m-17 6h17" },
  email: { label: "Email", path: "M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0v.243a2.25 2.25 0 0 1-1.07 1.916l-7.5 4.615a2.25 2.25 0 0 1-2.36 0L3.32 8.91a2.25 2.25 0 0 1-1.07-1.916V6.75" },
  text: { label: "Text message", path: "M8.625 9.75h.008M12 9.75h.008m3.367 0h.008M2.25 12.76c0 1.6 1.123 2.994 2.707 3.227 1.087.16 2.185.283 3.293.369V21l4.184-4.183a1.14 1.14 0 0 1 .778-.332 48.294 48.294 0 0 0 5.83-.498c1.585-.233 2.708-1.626 2.708-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z" },
};

const iconOptions = (Object.keys(issueIcons) as Icon[]).map((value) => ({ label: issueIcons[value].label, value }));
const channelOptions = (Object.keys(channelIcons) as Channel[]).map((value) => ({ label: channelIcons[value].label, value }));

export const reportAnIssueBlock: ComponentConfig<ReportAnIssueProps> = {
  label: "Report an Issue",
  fields: {
    eyebrow: { type: "text", label: "Eyebrow", metadata: { help: "Small line above the heading, like Millbrook 311. 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." } },
    emergencyText: { type: "textarea", label: "Emergency notice", metadata: { help: "Tell people when to call 911 instead. Leave blank to hide it, but we don't recommend it." } },
    reportLabel: { type: "text", label: "Report button text", metadata: { help: "Leave blank to hide the button." } },
    reportHref: { type: "text", label: "Report button link", metadata: { help: "Your online 311 request form." } },
    stepsHeading: { type: "text", label: "Steps heading" },
    steps: {
      type: "array",
      label: "Steps",
      max: 5,
      getItemSummary: (item) => item?.title || "Step",
      defaultItemProps: { title: "New step", text: "" },
      arrayFields: {
        title: { type: "text", label: "Step", metadata: { help: "Start with a verb, like Add a photo." } },
        text: { type: "textarea", label: "Details", metadata: { help: "One sentence. Leave blank to hide it." } },
      },
    },
    issuesHeading: { type: "text", label: "Common issues heading" },
    issues: {
      type: "array",
      label: "Common issues",
      max: 12,
      getItemSummary: (item) => item?.label || "Issue",
      defaultItemProps: { icon: "other", label: "New issue type", href: "" },
      arrayFields: {
        icon: { type: "select", label: "Icon", options: iconOptions },
        label: { type: "text", label: "Issue type" },
        href: { type: "text", label: "Link", metadata: { help: "The request form for this issue type." } },
      },
    },
    channelsHeading: { type: "text", label: "Other ways heading" },
    channels: {
      type: "array",
      label: "Other ways to report",
      max: 5,
      getItemSummary: (item) => item?.label || "Channel",
      defaultItemProps: { kind: "phone", label: "New option", detail: "", href: "" },
      arrayFields: {
        kind: { type: "select", label: "Type", options: channelOptions },
        label: { type: "text", label: "Label", metadata: { help: "Like Call 311, or the app name." } },
        detail: { type: "text", label: "Details", metadata: { help: "Hours or a short note, like 24 hours a day." } },
        href: { type: "text", label: "Link", metadata: { help: "tel:, mailto:, sms: or a URL. Leave blank for plain text." } },
      },
    },
    nextHeading: { type: "text", label: "What happens next heading" },
    next: {
      type: "array",
      label: "What happens next",
      max: 5,
      getItemSummary: (item) => item?.title || "Stage",
      defaultItemProps: { title: "New stage", time: "", text: "" },
      arrayFields: {
        title: { type: "text", label: "Stage" },
        time: { type: "text", label: "Typical time", metadata: { help: "Like Within 2 business days. Leave blank to hide it." } },
        text: { type: "textarea", label: "Details" },
      },
    },
  },
  defaultProps: {
    eyebrow: "Millbrook 311",
    heading: "Report a problem",
    headingLevel: "h2",
    intro: "See something that needs fixing in Millbrook? Tell us and we'll route it to the right crew. You'll get a tracking number so you can follow it to the finish.",
    emergencyText: "For emergencies like a fire, crash, gas smell or downed power line, call 911.",
    reportLabel: "Start a request",
    reportHref: "/311/new",
    stepsHeading: "How to report",
    steps: [
      { title: "Pick the type of problem", text: "Choose from the list, or pick Something else." },
      { title: "Mark the location", text: "Drop a pin on the map or type the nearest address or intersection." },
      { title: "Add a photo and details", text: "A clear photo helps crews bring the right tools the first time." },
      { title: "Get your tracking number", text: "We'll email or text you when the status changes." },
    ],
    issuesHeading: "Common problems",
    issues: [
      { icon: "pothole", label: "Pothole", href: "/311/new?type=pothole" },
      { icon: "light", label: "Streetlight out", href: "/311/new?type=streetlight" },
      { icon: "trash", label: "Missed trash pickup", href: "/311/new?type=missed-pickup" },
      { icon: "graffiti", label: "Graffiti", href: "/311/new?type=graffiti" },
      { icon: "tree", label: "Fallen tree or limb", href: "/311/new?type=tree" },
      { icon: "water", label: "Water leak", href: "/311/new?type=water-leak" },
      { icon: "sign", label: "Damaged street sign", href: "/311/new?type=sign" },
      { icon: "other", label: "Something else", href: "/311/new" },
    ],
    channelsHeading: "Other ways to report",
    channels: [
      { kind: "phone", label: "Call 311 or (555) 555-0131", detail: "Mon–Fri 7 a.m. to 7 p.m.; Sat 8 a.m. to noon", href: "tel:5555550131" },
      { kind: "app", label: "Millbrook Connect app", detail: "Free for iPhone and Android", href: "/311/app" },
      { kind: "email", label: "311@millbrook.example.gov", detail: "We reply within one business day", href: "mailto:311@millbrook.example.gov" },
    ],
    nextHeading: "What happens next",
    next: [
      { title: "Received", time: "Right away", text: "You get a tracking number by email or text." },
      { title: "Assigned", time: "Within 2 business days", text: "A supervisor reviews it and schedules a crew." },
      { title: "Resolved", time: "Most within 10 days", text: "We close the request and tell you what was done." },
    ],
  },
  render: ({
    id,
    eyebrow,
    heading,
    headingLevel,
    intro,
    emergencyText,
    reportLabel,
    reportHref,
    stepsHeading,
    steps,
    issuesHeading,
    issues,
    channelsHeading,
    channels,
    nextHeading,
    next,
  }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[headingLevel] || "h3";
    const Item = grandHeading[headingLevel] || "h4";
    const baseId = id || "report-an-issue";
    const stepList = (steps ?? []).filter((s) => s?.title);
    const issueList = (issues ?? []).filter((s) => s?.label);
    const channelList = (channels ?? []).filter((s) => s?.label);
    const nextList = (next ?? []).filter((s) => s?.title);
    const hasHeader = Boolean(eyebrow || heading || intro);
    return (
      <section aria-labelledby={heading ? `${baseId}-heading` : undefined} 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 || reportLabel ? (
            <div className="flex flex-col gap-6 lg:flex-row lg:items-end lg:justify-between lg:gap-16">
              <div className="max-w-2xl">
                {eyebrow ? <p className="text-sm font-semibold tracking-wide text-indigo-700">{eyebrow}</p> : null}
                {heading ? (
                  <H id={`${baseId}-heading`} 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>
              {reportLabel ? (
                <a
                  href={reportHref || "#"}
                  className={`inline-flex min-h-12 shrink-0 items-center justify-center gap-2 self-start rounded-lg bg-indigo-700 px-6 text-base font-semibold text-white shadow-sm transition hover:bg-indigo-600 lg:self-auto ${focusRing}`}
                >
                  {reportLabel}
                  <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>
              ) : null}
            </div>
          ) : null}

          {emergencyText ? (
            <p className={`flex items-start gap-3 rounded-xl border-l-4 border-neutral-950 bg-neutral-100 px-4 py-3 text-base leading-7 font-medium text-neutral-950 sm:px-5 ${hasHeader || reportLabel ? "mt-8" : ""}`}>
              <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-1 size-5 shrink-0">
                <path fillRule="evenodd" d="M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495ZM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" clipRule="evenodd" />
              </svg>
              <span className="min-w-0">{emergencyText}</span>
            </p>
          ) : null}

          {stepList.length || issueList.length ? (
            <div className="mt-12 grid grid-cols-1 gap-12 lg:grid-cols-12 lg:gap-16">
              {stepList.length ? (
                <div className={issueList.length ? "lg:col-span-5" : "lg:col-span-12"}>
                  {stepsHeading ? <Sub className="text-xl font-semibold tracking-tight text-neutral-950">{stepsHeading}</Sub> : null}
                  <ol role="list" className="mt-6 space-y-6">
                    {stepList.map((s, i) => (
                      <li key={`${s.title}-${i}`} className="flex gap-4">
                        <span aria-hidden="true" className="grid size-10 shrink-0 place-items-center rounded-full bg-indigo-50 text-base font-semibold text-indigo-800 tabular-nums ring-1 ring-indigo-600/20">
                          {i + 1}
                        </span>
                        <div className="min-w-0 pt-1.5">
                          <Item className="text-base font-semibold text-neutral-950">
                            <span className="sr-only">Step {i + 1}: </span>
                            {s.title}
                          </Item>
                          {s.text ? <p className="mt-1 text-sm leading-6 text-pretty text-neutral-600">{s.text}</p> : null}
                        </div>
                      </li>
                    ))}
                  </ol>
                </div>
              ) : null}
              {issueList.length ? (
                <div className={stepList.length ? "lg:col-span-7" : "lg:col-span-12"}>
                  {issuesHeading ? <Sub className="text-xl font-semibold tracking-tight text-neutral-950">{issuesHeading}</Sub> : null}
                  <ul role="list" className="mt-6 grid grid-cols-1 gap-3 sm:grid-cols-2">
                    {issueList.map((issue, i) => {
                      const icon = issueIcons[issue.icon] ?? issueIcons.other;
                      const inner = (
                        <>
                          <span aria-hidden="true" className="grid size-10 shrink-0 place-items-center rounded-lg bg-white text-indigo-700 ring-1 ring-neutral-200">
                            <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round" className="size-6">
                              <path d={icon.path} />
                            </svg>
                          </span>
                          <span className="min-w-0 flex-1 text-base font-semibold text-neutral-950">{issue.label}</span>
                        </>
                      );
                      return (
                        <li key={`${issue.label}-${i}`}>
                          {issue.href ? (
                            <a
                              href={issue.href}
                              className={`group flex min-h-16 items-center gap-4 rounded-xl bg-neutral-50 p-3 pr-4 ring-1 ring-neutral-200 transition hover:bg-white hover:ring-indigo-300 ${focusRing}`}
                            >
                              {inner}
                              <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5 shrink-0 text-neutral-400 transition group-hover:text-indigo-700 motion-safe:group-hover:translate-x-0.5">
                                <path fillRule="evenodd" d="M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z" clipRule="evenodd" />
                              </svg>
                            </a>
                          ) : (
                            <div className="flex min-h-16 items-center gap-4 rounded-xl bg-neutral-50 p-3 pr-4 ring-1 ring-neutral-200">{inner}</div>
                          )}
                        </li>
                      );
                    })}
                  </ul>
                </div>
              ) : null}
            </div>
          ) : null}

          {channelList.length ? (
            <div className="mt-14">
              {channelsHeading ? <Sub className="text-xl font-semibold tracking-tight text-neutral-950">{channelsHeading}</Sub> : null}
              <ul role="list" className="mt-6 grid grid-cols-1 gap-4 md:grid-cols-3">
                {channelList.map((c, i) => {
                  const icon = channelIcons[c.kind] ?? channelIcons.web;
                  return (
                    <li key={`${c.label}-${i}`} className="flex gap-4 rounded-xl border border-neutral-200 p-5">
                      <svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round" className="mt-0.5 size-6 shrink-0 text-indigo-700">
                        <path d={icon.path} />
                      </svg>
                      <div className="min-w-0">
                        <p className="text-xs font-semibold tracking-wide text-neutral-600 uppercase">{icon.label}</p>
                        {c.href ? (
                          <a href={c.href} className={`inline-flex min-h-11 items-center rounded text-base font-semibold break-all text-indigo-700 underline decoration-indigo-300 underline-offset-4 hover:decoration-indigo-700 ${focusRing}`}>
                            {c.label}
                          </a>
                        ) : (
                          <p className="mt-1 text-base font-semibold text-neutral-950">{c.label}</p>
                        )}
                        {c.detail ? <p className="text-sm leading-6 text-neutral-600">{c.detail}</p> : null}
                      </div>
                    </li>
                  );
                })}
              </ul>
            </div>
          ) : null}

          {nextList.length ? (
            <div className="mt-14 rounded-2xl bg-neutral-950 p-6 text-white sm:p-8 lg:p-10">
              {nextHeading ? <Sub className="text-xl font-semibold tracking-tight">{nextHeading}</Sub> : null}
              <ol role="list" className={`grid grid-cols-1 gap-8 md:gap-6 ${nextList.length >= 3 ? "md:grid-cols-3" : nextList.length === 2 ? "md:grid-cols-2" : ""} ${nextHeading ? "mt-8" : ""}`}>
                {nextList.map((n, i) => (
                  <li key={`${n.title}-${i}`} className="relative border-l-2 border-indigo-400 pl-5 md:border-t-2 md:border-l-0 md:pt-5 md:pl-0">
                    <span aria-hidden="true" className="absolute top-0 -left-1.5 size-2.5 rounded-full bg-indigo-400 md:-top-1.5 md:left-0" />
                    {n.time ? <p className="text-sm font-semibold text-indigo-300">{n.time}</p> : null}
                    <Item className="mt-1 text-lg font-semibold">{n.title}</Item>
                    {n.text ? <p className="mt-1 text-sm leading-6 text-pretty text-neutral-300">{n.text}</p> : null}
                  </li>
                ))}
              </ol>
            </div>
          ) : null}
        </div>
      </section>
    );
  },
};
```
