# Add the "Project Updates" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/project-updates) to this Pantheon Content Publisher (P1) Next.js project. Capital project cards with a four-step phase tracker, latest update, budget and expected completion.

## Steps

1. Create `components/puck/project-updates-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 { projectUpdatesBlock } from "./components/puck/project-updates-block";`
3. Register it under `components` as `ProjectUpdatesBlock: projectUpdatesBlock`.
4. Add `"ProjectUpdatesBlock"` 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/project-updates-block.tsx`

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

/**
 * Project Updates — capital projects as cards with a four-step phase tracker, the latest
 * update, location, budget and expected completion. Phase is always stated in text.
 * Register: `ProjectUpdatesBlock: projectUpdatesBlock` in puck.config.tsx.
 */

// spec: status-colors

type Heading = "h1" | "h2" | "h3" | "h4";
type Phase = "planning" | "design" | "construction" | "complete";

export type ProjectUpdatesProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  projects: {
    name: string;
    location: string;
    phase: Phase;
    completion: string;
    budget: string;
    update: string;
    imageUrl: string;
    imageAlt: string;
    href: string;
  }[];
  viewAllLabel: string;
  viewAllHref: string;
};

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

const phases: { value: Phase; label: string }[] = [
  { value: "planning", label: "Planning" },
  { value: "design", label: "Design" },
  { value: "construction", label: "Construction" },
  { value: "complete", label: "Complete" },
];

const badge: Record<Phase, string> = {
  planning: "bg-neutral-100 text-neutral-800 ring-neutral-300",
  design: "bg-indigo-50 text-indigo-800 ring-indigo-600/20",
  construction: "bg-amber-50 text-amber-900 ring-amber-600/30",
  complete: "bg-emerald-50 text-emerald-800 ring-emerald-600/25",
};

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

export const projectUpdatesBlock: ComponentConfig<ProjectUpdatesProps> = {
  label: "Project Updates",
  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" },
    projects: {
      type: "array",
      label: "Projects",
      min: 1,
      max: 12,
      getItemSummary: (item) => (item?.name ? `${phases.find((p) => p.value === item.phase)?.label ?? "Project"} · ${item.name.slice(0, 40)}` : "Project"),
      defaultItemProps: { name: "New project", location: "", phase: "planning", completion: "", budget: "", update: "", imageUrl: "", imageAlt: "", href: "" },
      arrayFields: {
        name: { type: "text", label: "Project name" },
        location: { type: "text", label: "Location", metadata: { help: "A street, intersection or park name residents will recognize." } },
        phase: {
          type: "select",
          label: "Phase",
          options: phases.map((p) => ({ label: p.label, value: p.value })),
          metadata: { help: "Drives the progress tracker. The phase name is always shown as text." },
        },
        completion: { type: "text", label: "Expected completion", metadata: { help: "Like Spring 2027. For finished projects, the date it opened." } },
        budget: { type: "text", label: "Budget", metadata: { help: "Optional. Like $3.2 million." } },
        update: { type: "textarea", label: "Latest update", metadata: { help: "One to three sentences on what's happening now and what residents will notice." } },
        imageUrl: { type: "text", label: "Image URL", metadata: { help: "Optional. Leave blank for a text-only card." } },
        imageAlt: { type: "text", label: "Image alt text", metadata: { help: "Describe the photo for screen reader users. Leave blank only if it's purely decorative." } },
        href: { type: "text", label: "Project page link", metadata: { help: "Leave blank if there's no detail page yet." } },
      },
    },
    viewAllLabel: { type: "text", label: "View all link text", metadata: { help: "Leave blank to hide it." } },
    viewAllHref: { type: "text", label: "View all link" },
  },
  defaultProps: {
    heading: "Projects in your neighborhood",
    headingLevel: "h2",
    intro: "Track the roads, parks and facilities your tax dollars are building. Updates are posted at least once a month while work is underway.",
    projects: [
      {
        name: "Oak Street reconstruction",
        location: "Oak Street, 5th Avenue to Mill Road",
        phase: "construction",
        completion: "Summer 2027",
        budget: "$4.8 million",
        update: "Crews are replacing the water main between 6th and 8th Avenues. Expect one lane each way and no street parking on weekdays from 7 a.m. to 5 p.m.",
        imageUrl: "https://picsum.photos/seed/roadwork/800/500",
        imageAlt: "Road crew and excavator working on a torn-up city street",
        href: "/projects/oak-street",
      },
      {
        name: "Riverside Park playground",
        location: "Riverside Park, north lawn",
        phase: "design",
        completion: "Fall 2027",
        budget: "$850,000",
        update: "Thanks to the 600 residents who voted on designs. The inclusive play concept was selected, and final drawings go to the Park Board in November.",
        imageUrl: "https://picsum.photos/seed/playground/800/500",
        imageAlt: "Empty grass lawn by a river where the new playground will go",
        href: "/projects/riverside-playground",
      },
      {
        name: "Fire Station 3 replacement",
        location: "2200 Lincoln Avenue",
        phase: "complete",
        completion: "Opened August 2026",
        budget: "$11.2 million",
        update: "The new station is open and staffed around the clock. Response times on the east side are now measured monthly and posted on the fire department page.",
        imageUrl: "https://picsum.photos/seed/firehouse/800/500",
        imageAlt: "New brick fire station with three open bay doors",
        href: "/projects/fire-station-3",
      },
    ],
    viewAllLabel: "All capital projects",
    viewAllHref: "/projects",
  },
  render: ({ heading, headingLevel, intro, projects, viewAllLabel, viewAllHref }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[headingLevel] || "h3";
    const list = (projects ?? []).filter((p) => p?.name);
    const hasHeader = Boolean(heading || intro || viewAllLabel);
    return (
      <section 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">
          {hasHeader ? (
            <div className="flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between sm:gap-8">
              <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-base leading-7 text-pretty text-neutral-600">{intro}</p> : null}
              </div>
              {viewAllLabel ? (
                <a
                  href={viewAllHref || "#"}
                  className={`group inline-flex min-h-11 shrink-0 items-center gap-1.5 self-start rounded text-sm font-semibold text-indigo-700 sm:self-auto ${focusRing}`}
                >
                  {viewAllLabel}
                  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 transition 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>
          ) : null}

          {list.length ? (
            <ul role="list" className={`grid gap-6 md:grid-cols-2 xl:grid-cols-3 ${hasHeader ? "mt-10 sm:mt-12" : ""}`}>
              {list.map((project, i) => {
                const phase: Phase = phases.some((p) => p.value === project.phase) ? project.phase : "planning";
                const current = phases.findIndex((p) => p.value === phase);
                const phaseLabel = phases[current].label;
                const facts = [
                  project.completion ? { term: phase === "complete" ? "Finished" : "Expected", value: project.completion } : null,
                  project.budget ? { term: "Budget", value: project.budget } : null,
                ].filter((f): f is { term: string; value: string } => Boolean(f));
                return (
                  <li key={`${project.name}-${i}`} className="flex">
                    <article className={`group relative flex w-full flex-col overflow-hidden rounded-2xl bg-white shadow-sm ring-1 ring-neutral-200 transition ${project.href ? "hover:shadow-md" : ""}`}>
                      {project.imageUrl ? (
                        <img src={project.imageUrl} alt={project.imageAlt || ""} className="aspect-[16/9] w-full bg-neutral-100 object-cover" />
                      ) : null}
                      <div className="flex flex-1 flex-col p-5 sm:p-6">
                        <p className={`inline-flex items-center gap-1.5 self-start rounded-md px-2 py-0.5 text-xs font-semibold ring-1 ring-inset ${badge[phase]}`}>
                          <span className="sr-only">Current phase: </span>
                          {phaseLabel}
                        </p>
                        <Sub className="mt-3 text-xl leading-snug font-semibold tracking-tight text-pretty text-neutral-950">
                          {project.href ? (
                            <a
                              href={project.href}
                              className="outline-none group-hover:text-indigo-700 group-hover:underline group-hover:decoration-indigo-300 group-hover:underline-offset-4 after:absolute after:inset-0 after:rounded-2xl focus-visible:after:outline-2 focus-visible:after:outline-offset-2 focus-visible:after:outline-indigo-600"
                            >
                              {project.name}
                            </a>
                          ) : (
                            project.name
                          )}
                        </Sub>
                        {project.location ? (
                          <p className="mt-1.5 flex items-start gap-1.5 text-sm leading-6 text-neutral-600">
                            <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-4 shrink-0 text-neutral-500">
                              <path fillRule="evenodd" d="m9.69 18.933.003.001C9.89 19.02 10 19 10 19s.11.02.308-.066l.002-.001.006-.003.018-.008a5.741 5.741 0 0 0 .281-.14c.186-.096.446-.24.757-.433.62-.384 1.445-.966 2.274-1.765C15.302 14.988 17 12.493 17 9A7 7 0 1 0 3 9c0 3.492 1.698 5.988 3.355 7.584a13.731 13.731 0 0 0 2.273 1.765 11.842 11.842 0 0 0 .976.544l.062.029.018.008.006.003ZM10 11.25a2.25 2.25 0 1 0 0-4.5 2.25 2.25 0 0 0 0 4.5Z" clipRule="evenodd" />
                            </svg>
                            <span className="sr-only">Location: </span>
                            {project.location}
                          </p>
                        ) : null}

                        <ol role="list" aria-label="Project phase" className="mt-5 grid grid-cols-4 gap-1.5">
                          {phases.map((step, s) => {
                            const done = s < current || phase === "complete";
                            const isCurrent = s === current;
                            const bar = phase === "complete" ? "bg-emerald-600" : isCurrent ? "bg-indigo-600" : done ? "bg-indigo-300" : "bg-neutral-200";
                            return (
                              <li key={step.value} aria-current={isCurrent ? "step" : undefined} className="min-w-0">
                                <span aria-hidden="true" className={`block h-1.5 rounded-full ${bar}`} />
                                <span
                                  className={`mt-2 block text-xs leading-4 break-words hyphens-auto ${isCurrent ? "font-semibold text-neutral-950" : done ? "text-neutral-700" : "text-neutral-600"}`}
                                >
                                  {step.label}
                                  <span className="sr-only">{isCurrent ? " (current phase)" : done ? " (done)" : " (not started)"}</span>
                                </span>
                              </li>
                            );
                          })}
                        </ol>

                        {project.update ? (
                          <div className="mt-5 border-t border-neutral-200 pt-5">
                            <p className="text-xs font-semibold tracking-wide text-neutral-600 uppercase">Latest update</p>
                            <p className="mt-1.5 text-sm leading-6 text-pretty text-neutral-700">{project.update}</p>
                          </div>
                        ) : null}

                        {facts.length ? (
                          <dl className="mt-auto grid grid-cols-2 gap-4 pt-5 text-sm">
                            {facts.map((f) => (
                              <div key={f.term} className="min-w-0 rounded-lg bg-neutral-50 px-3 py-2.5 ring-1 ring-neutral-200 ring-inset">
                                <dt className="text-xs text-neutral-600">{f.term}</dt>
                                <dd className="mt-0.5 font-semibold text-neutral-950">{f.value}</dd>
                              </div>
                            ))}
                          </dl>
                        ) : null}
                      </div>
                    </article>
                  </li>
                );
              })}
            </ul>
          ) : null}
        </div>
      </section>
    );
  },
};
```
