# Add the "Application Timeline" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/application-timeline) to this Pantheon Content Publisher (P1) Next.js project. Grant cycle steps from letter of inquiry to payment with dates, completed steps and the current step marked.

## Steps

1. Create `components/puck/application-timeline-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 { applicationTimelineBlock } from "./components/puck/application-timeline-block";`
3. Register it under `components` as `ApplicationTimelineBlock: applicationTimelineBlock`.
4. Add `"ApplicationTimelineBlock"` to the best-fitting entry in `categories` (this block's library category is "Foundations"). 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/application-timeline-block.tsx`

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

/**
 * Application Timeline — the grant cycle from letter of inquiry to payment, with dates.
 * The current step carries aria-current="step" plus a visible text label.
 * Register: `ApplicationTimelineBlock: applicationTimelineBlock` in puck.config.tsx.
 */

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

type Step = { title: string; dateIso: string; dateText: string; description: string };

export type ApplicationTimelineProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  cycleLabel: string;
  steps: Step[];
  currentStep: number;
  note: string;
  ctaLabel: string;
  ctaHref: string;
};

const childHeading: Record<Heading, "h2" | "h3" | "h4" | "h5"> = { h1: "h2", h2: "h3", h3: "h4", h4: "h5" };
const isoPattern = /^\d{4}-\d{2}-\d{2}$/;
const dateFormat = new Intl.DateTimeFormat("en-US", { month: "short", day: "numeric", year: "numeric", timeZone: "UTC" });
const formatIso = (iso: string) => {
  const d = new Date(`${iso}T00:00:00Z`);
  return Number.isNaN(d.getTime()) ? iso : dateFormat.format(d);
};

const check = "M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z";

export const applicationTimelineBlock: ComponentConfig<ApplicationTimelineProps> = {
  label: "Application Timeline",
  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" },
    cycleLabel: { type: "text", label: "Cycle label", metadata: { help: "Names the cycle, like Spring 2027 grant cycle. Also labels the list for screen readers." } },
    steps: {
      type: "array",
      label: "Steps",
      min: 2,
      max: 8,
      getItemSummary: (item) => [item?.title, item?.dateIso].filter(Boolean).join(" · ") || "Step",
      defaultItemProps: { title: "New step", dateIso: "", dateText: "", description: "" },
      arrayFields: {
        title: { type: "text", label: "Step" },
        dateIso: { type: "text", label: "Date (YYYY-MM-DD)", metadata: { help: "Read by calendars and screen readers. Leave blank for steps without a fixed date." } },
        dateText: { type: "text", label: "Date text (optional)", metadata: { help: "Overrides the displayed date, such as Late March or Within 30 days." } },
        description: { type: "textarea", label: "Description" },
      },
      metadata: { help: "Six steps fit in one row on wide screens; on phones they stack." },
    },
    currentStep: {
      type: "number",
      label: "Current step",
      min: 0,
      max: 8,
      metadata: { help: "The step number the cycle is on now, counting from 1. Earlier steps show as completed. Use 0 before the cycle opens." },
    },
    note: { type: "textarea", label: "Note", metadata: { help: "Small print under the timeline. Leave blank to hide it." } },
    ctaLabel: { type: "text", label: "Button text", metadata: { help: "Leave blank to hide the button." } },
    ctaHref: { type: "text", label: "Button link" },
  },
  defaultProps: {
    eyebrow: "How it works",
    heading: "From first letter to first payment",
    headingLevel: "h2",
    intro: "Our competitive cycle takes about five months. You'll hear from a program officer at every step, including when a request isn't moving forward.",
    cycleLabel: "Spring 2027 grant cycle",
    steps: [
      { title: "Letter of inquiry", dateIso: "2026-11-14", dateText: "", description: "A two-page summary of the project, budget and the need it meets." },
      { title: "Invitation to apply", dateIso: "2026-12-12", dateText: "", description: "About one in three letters is invited to submit a full proposal." },
      { title: "Full proposal", dateIso: "2027-02-06", dateText: "", description: "Narrative, budget, outcomes and board list, submitted through the grants portal." },
      { title: "Site visit", dateIso: "", dateText: "February–March", description: "A conversation with your staff and, where possible, the people you serve." },
      { title: "Board decision", dateIso: "2027-04-08", dateText: "", description: "The board of directors approves grants at its quarterly meeting." },
      { title: "Payment", dateIso: "", dateText: "Within 30 days", description: "Funds arrive by ACH after the grant agreement is signed." },
    ],
    currentStep: 1,
    note: "Dates are for the sample spring cycle. Deadlines are 5 p.m. Eastern; late submissions roll to the next cycle.",
    ctaLabel: "Start a letter of inquiry",
    ctaHref: "/grants/letter-of-inquiry",
  },
  render: ({ id, eyebrow, heading, headingLevel, intro, cycleLabel, steps, currentStep, note, ctaLabel, ctaHref }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[H] ?? "h3";
    const uid = `at-${id || "timeline"}`;
    const list = (steps ?? []).filter((s) => s?.title);
    const current = Math.max(0, Math.min(list.length, Math.round(Number(currentStep) || 0)));
    const wide = list.length >= 5 ? "lg:grid-cols-6" : list.length === 4 ? "lg:grid-cols-4" : "lg:grid-cols-3";
    const lgCols = list.length > 6 ? "lg:grid-cols-4" : wide;

    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">
          <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-widest text-indigo-700 uppercase">{eyebrow}</p> : null}
              {heading ? <H className={`text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl ${eyebrow ? "mt-3" : ""}`}>{heading}</H> : null}
              {intro ? <p className="mt-4 text-lg leading-8 text-pretty text-neutral-600">{intro}</p> : null}
            </div>
            {ctaLabel ? (
              <a
                href={ctaHref || "#"}
                className="inline-flex min-h-11 shrink-0 items-center justify-center self-start rounded-lg bg-indigo-600 px-5 py-3 text-base font-semibold text-white shadow-xs transition hover:bg-indigo-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 lg:self-auto"
              >
                {ctaLabel}
              </a>
            ) : null}
          </div>

          {list.length ? (
            <div className="mt-12 sm:mt-14">
              {cycleLabel ? (
                <p id={`${uid}-label`} className="text-sm font-semibold text-neutral-950">
                  {cycleLabel}
                </p>
              ) : null}
              <ol
                role="list"
                aria-labelledby={cycleLabel ? `${uid}-label` : undefined}
                aria-label={cycleLabel ? undefined : "Grant cycle steps"}
                className={`grid grid-cols-1 gap-0 sm:grid-cols-2 sm:gap-x-8 sm:gap-y-10 lg:gap-x-0 ${lgCols} ${cycleLabel ? "mt-6" : ""}`}
              >
                {list.map((s, i) => {
                  const n = i + 1;
                  const state = n < current ? "done" : n === current ? "current" : "upcoming";
                  const iso = isoPattern.test((s.dateIso || "").trim()) ? s.dateIso.trim() : "";
                  const shownDate = s.dateText || (iso ? formatIso(iso) : "");
                  const last = i === list.length - 1;
                  return (
                    <li key={`${s.title}-${i}`} aria-current={state === "current" ? "step" : undefined} className="relative flex gap-4 pb-10 last:pb-0 sm:block sm:pb-0 lg:pr-6">
                      {!last ? (
                        <span
                          aria-hidden="true"
                          className={`absolute top-10 bottom-0 left-5 w-0.5 -translate-x-1/2 sm:hidden lg:top-5 lg:right-0 lg:bottom-auto lg:left-10 lg:block lg:h-0.5 lg:w-auto lg:translate-x-0 ${state === "done" ? "bg-indigo-600" : "bg-neutral-300"}`}
                        />
                      ) : null}
                      <span
                        aria-hidden="true"
                        className={`relative z-10 grid size-10 shrink-0 place-items-center rounded-full text-sm font-semibold tabular-nums ${
                          state === "done"
                            ? "bg-indigo-600 text-white"
                            : state === "current"
                              ? "bg-white text-indigo-700 ring-2 ring-indigo-600 ring-offset-4 ring-offset-neutral-50"
                              : "bg-white text-neutral-600 ring-1 ring-neutral-300"
                        }`}
                      >
                        {state === "done" ? (
                          <svg viewBox="0 0 20 20" fill="currentColor" className="size-5">
                            <path fillRule="evenodd" d={check} clipRule="evenodd" />
                          </svg>
                        ) : (
                          n
                        )}
                      </span>
                      <div className="min-w-0 sm:mt-5">
                        <p className={`text-xs font-semibold tracking-wide uppercase ${state === "current" ? "text-indigo-700" : "text-neutral-600"}`}>
                          {state === "upcoming" ? (
                            <>
                              Step {n}
                              <span className="sr-only">, upcoming:</span>
                            </>
                          ) : (
                            <>
                              <span className="sr-only">Step {n}, </span>
                              {state === "done" ? "Completed" : "Current step"}
                              <span className="sr-only">:</span>
                            </>
                          )}
                        </p>
                        <Sub className={`mt-1 text-base leading-6 font-semibold text-balance ${state === "upcoming" ? "text-neutral-800" : "text-neutral-950"}`}>{s.title}</Sub>
                        {shownDate ? (
                          <p className="mt-1 text-sm font-medium text-neutral-700 tabular-nums">
                            {iso ? <time dateTime={iso}>{shownDate}</time> : shownDate}
                          </p>
                        ) : null}
                        {s.description ? <p className="mt-2 text-sm leading-6 text-pretty text-neutral-600">{s.description}</p> : null}
                      </div>
                    </li>
                  );
                })}
              </ol>
            </div>
          ) : null}

          {note ? <p className="mt-12 max-w-3xl border-t border-neutral-200 pt-6 text-sm leading-6 text-pretty text-neutral-600">{note}</p> : null}
        </div>
      </section>
    );
  },
};
```
