# Add the "Needs Wishlist" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/needs-wishlist) to this Pantheon Content Publisher (P1) Next.js project. In-kind needs sorted urgent first with labeled status, drop-off address and hours, and a wishlist link.

## Steps

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

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

// spec: status-colors

/**
 * Needs Wishlist — the in-kind donations you need right now, grouped so urgent items come
 * first, with drop-off details and a link to an online wishlist.
 * Register: `NeedsWishlistBlock: needsWishlistBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";
type Urgency = "urgent" | "needed" | "stocked";

export type NeedsWishlistProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  updated: string;
  items: { item: string; detail: string; urgency: Urgency }[];
  dropoffHeading: string;
  address: string;
  hours: string;
  dropoffNote: string;
  wishlistLabel: string;
  wishlistHref: string;
};

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

const groups: {
  key: Urgency;
  title: string;
  badge: string;
  badgeClass: string;
  dotClass: string;
}[] = [
  {
    key: "urgent",
    title: "Needed most right now",
    badge: "Urgent",
    badgeClass: "bg-red-50 text-red-800 ring-red-600/20",
    dotClass: "bg-red-600",
  },
  {
    key: "needed",
    title: "Always welcome",
    badge: "Needed",
    badgeClass: "bg-amber-50 text-amber-800 ring-amber-600/25",
    dotClass: "bg-amber-500",
  },
  {
    key: "stocked",
    title: "Fully stocked, thank you",
    badge: "Stocked",
    badgeClass: "bg-emerald-50 text-emerald-800 ring-emerald-600/20",
    dotClass: "bg-emerald-600",
  },
];

export const needsWishlistBlock: ComponentConfig<NeedsWishlistProps> = {
  label: "Needs Wishlist",
  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. Group titles use the next level down.",
      },
    },
    intro: { type: "textarea", label: "Intro" },
    updated: {
      type: "text",
      label: "Last updated",
      metadata: {
        help: "Free text, like Updated March 3. Tells donors the list is current. Leave blank to hide it.",
      },
    },
    items: {
      type: "array",
      label: "Items",
      min: 1,
      max: 30,
      getItemSummary: (item) =>
        item?.item
          ? `${item.item}${item.urgency === "urgent" ? " (urgent)" : ""}`
          : "Item",
      defaultItemProps: { item: "New item", detail: "", urgency: "needed" },
      arrayFields: {
        item: { type: "text", label: "Item" },
        detail: {
          type: "text",
          label: "Detail",
          metadata: {
            help: "Sizes, brands or condition, like Sizes 4T–8 or New only. Leave blank to hide it.",
          },
        },
        urgency: {
          type: "select",
          label: "Urgency",
          options: [
            { label: "Urgent", value: "urgent" },
            { label: "Needed", value: "needed" },
            { label: "Stocked", value: "stocked" },
          ],
          metadata: {
            help: "Items are grouped automatically, urgent first. Mark something stocked to thank donors without removing it.",
          },
        },
      },
    },
    dropoffHeading: { type: "text", label: "Drop-off heading" },
    address: {
      type: "textarea",
      label: "Drop-off address",
      metadata: {
        help: "One line per row of the address. Leave blank to hide the drop-off panel.",
      },
    },
    hours: {
      type: "textarea",
      label: "Drop-off hours",
      metadata: { help: "One line per row, like Mon–Fri 9 a.m.–4 p.m." },
    },
    dropoffNote: {
      type: "textarea",
      label: "Drop-off note",
      metadata: {
        help: "Anything donors should know, like where to park. Leave blank to hide it.",
      },
    },
    wishlistLabel: {
      type: "text",
      label: "Wishlist link text",
      metadata: { help: "Leave blank to hide it." },
    },
    wishlistHref: {
      type: "text",
      label: "Wishlist link",
      metadata: { help: "Your online registry or wishlist." },
    },
  },
  defaultProps: {
    heading: "What our families need this month",
    headingLevel: "h2",
    intro:
      "Every item on this list goes straight to a family who visits our pantry. Please bring new or gently used items only, and check here first so your gift fills a real gap.",
    updated: "Updated November 3",
    items: [
      {
        item: "Winter coats",
        detail: "Kids' sizes 4T–8 and adult XL",
        urgency: "urgent",
      },
      { item: "Diapers", detail: "Sizes 5 and 6", urgency: "urgent" },
      {
        item: "Canned protein",
        detail: "Tuna, chicken or beans, pop-top preferred",
        urgency: "urgent",
      },
      { item: "Peanut butter", detail: "Plastic jars only", urgency: "needed" },
      { item: "Warm socks", detail: "New, all sizes", urgency: "needed" },
      {
        item: "Menstrual products",
        detail: "Pads and tampons, any brand",
        urgency: "needed",
      },
      { item: "Reusable grocery bags", detail: "", urgency: "needed" },
      { item: "Pasta and rice", detail: "", urgency: "stocked" },
      { item: "Children's books", detail: "", urgency: "stocked" },
    ],
    dropoffHeading: "Drop off donations",
    address:
      "Harbor Street Family Pantry\n418 Harbor Street, Door B\nPort Ellery, OR 97000",
    hours: "Mon–Fri · 9 a.m.–4 p.m.\nSat · 10 a.m.–1 p.m.",
    dropoffNote:
      "Pull up to the loading door on Elm Alley and ring the bell. A volunteer will help unload and give you a receipt.",
    wishlistLabel: "Shop our online wishlist",
    wishlistHref: "/wishlist",
  },
  render: ({
    heading,
    headingLevel,
    intro,
    updated,
    items,
    dropoffHeading,
    address,
    hours,
    dropoffNote,
    wishlistLabel,
    wishlistHref,
  }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[headingLevel] || "h3";
    const list = (items ?? []).filter((i) => i?.item);
    const grouped = groups
      .map((g) => ({
        ...g,
        entries: list.filter((i) => (i.urgency || "needed") === g.key),
      }))
      .filter((g) => g.entries.length);
    const lines = (s: string) =>
      (s || "")
        .split("\n")
        .map((l) => l.trim())
        .filter(Boolean);
    const addressLines = lines(address);
    const hoursLines = lines(hours);
    const hasPanel = Boolean(
      addressLines.length || hoursLines.length || dropoffNote || wishlistLabel,
    );

    const badge = (g: (typeof groups)[number]) => (
      <span
        className={`inline-flex shrink-0 items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-semibold ring-1 ring-inset ${g.badgeClass}`}
      >
        <span
          aria-hidden="true"
          className={`size-1.5 rounded-full ${g.dotClass}`}
        />
        {g.badge}
      </span>
    );

    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">
          <div className="flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between sm:gap-10">
            <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-lg leading-8 text-pretty text-neutral-600">
                  {intro}
                </p>
              ) : null}
            </div>
            {updated ? (
              <p className="inline-flex shrink-0 items-center gap-2 text-sm font-medium text-neutral-600">
                <svg
                  aria-hidden="true"
                  viewBox="0 0 16 16"
                  fill="currentColor"
                  className="size-4 text-neutral-500"
                >
                  <path
                    fillRule="evenodd"
                    d="M1 8a7 7 0 1 1 14 0A7 7 0 0 1 1 8Zm7.75-4.25a.75.75 0 0 0-1.5 0V8c0 .414.336.75.75.75h3.25a.75.75 0 0 0 0-1.5h-2.5v-3.5Z"
                    clipRule="evenodd"
                  />
                </svg>
                {updated}
              </p>
            ) : null}
          </div>

          <div
            className={`mt-12 grid gap-10 sm:mt-14 lg:gap-12 ${hasPanel ? "lg:grid-cols-12" : ""}`}
          >
            <div className={`space-y-12 ${hasPanel ? "lg:col-span-8" : ""}`}>
              {grouped.map((g) =>
                g.key === "urgent" ? (
                  <div key={g.key}>
                    <Sub className="text-sm font-semibold tracking-wide text-neutral-950 uppercase">
                      {g.title}
                    </Sub>
                    <ul role="list" className="mt-4 grid gap-3 sm:grid-cols-2">
                      {g.entries.map((entry, i) => (
                        <li
                          key={`${entry.item}-${i}`}
                          className="flex items-start justify-between gap-4 rounded-xl border-l-4 border-red-600 bg-red-50/60 p-5 ring-1 ring-red-600/10 ring-inset"
                        >
                          <div className="min-w-0">
                            <p className="text-lg leading-7 font-semibold text-neutral-950">
                              {entry.item}
                            </p>
                            {entry.detail ? (
                              <p className="mt-1 text-sm leading-6 text-neutral-700">
                                {entry.detail}
                              </p>
                            ) : null}
                          </div>
                          {badge(g)}
                        </li>
                      ))}
                    </ul>
                  </div>
                ) : (
                  <div key={g.key}>
                    <Sub className="text-sm font-semibold tracking-wide text-neutral-950 uppercase">
                      {g.title}
                    </Sub>
                    <ul
                      role="list"
                      className="mt-4 divide-y divide-neutral-200 border-y border-neutral-200"
                    >
                      {g.entries.map((entry, i) => (
                        <li
                          key={`${entry.item}-${i}`}
                          className="flex min-h-14 items-center justify-between gap-4 py-3"
                        >
                          <p className="min-w-0 text-base leading-6">
                            <span
                              className={
                                g.key === "stocked"
                                  ? "font-medium text-neutral-600"
                                  : "font-semibold text-neutral-950"
                              }
                            >
                              {entry.item}
                            </span>
                            {entry.detail ? (
                              <span className="block text-sm text-neutral-600 sm:ml-2 sm:inline">
                                {entry.detail}
                              </span>
                            ) : null}
                          </p>
                          {badge(g)}
                        </li>
                      ))}
                    </ul>
                  </div>
                ),
              )}
            </div>

            {hasPanel ? (
              <aside className="lg:col-span-4">
                <div className="rounded-2xl bg-neutral-50 p-6 ring-1 ring-neutral-900/5 sm:p-8 lg:sticky lg:top-8">
                  {dropoffHeading ? (
                    <Sub className="text-lg font-semibold tracking-tight text-neutral-950">
                      {dropoffHeading}
                    </Sub>
                  ) : null}
                  <dl
                    className={`space-y-5 text-base leading-7 ${dropoffHeading ? "mt-5" : ""}`}
                  >
                    {addressLines.length ? (
                      <div className="flex gap-3">
                        <dt className="mt-1 shrink-0">
                          <span className="sr-only">Address</span>
                          <svg
                            aria-hidden="true"
                            viewBox="0 0 20 20"
                            fill="currentColor"
                            className="size-5 text-indigo-600"
                          >
                            <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>
                        </dt>
                        <dd>
                          <address className="text-neutral-800 not-italic">
                            {addressLines.map((l, i) => (
                              <span
                                key={i}
                                className={
                                  i === 0
                                    ? "block font-semibold text-neutral-950"
                                    : "block"
                                }
                              >
                                {l}
                              </span>
                            ))}
                          </address>
                        </dd>
                      </div>
                    ) : null}
                    {hoursLines.length ? (
                      <div className="flex gap-3">
                        <dt className="mt-1 shrink-0">
                          <span className="sr-only">Hours</span>
                          <svg
                            aria-hidden="true"
                            viewBox="0 0 20 20"
                            fill="currentColor"
                            className="size-5 text-indigo-600"
                          >
                            <path
                              fillRule="evenodd"
                              d="M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm.75-13a.75.75 0 0 0-1.5 0v5c0 .414.336.75.75.75h4a.75.75 0 0 0 0-1.5h-3.25V5Z"
                              clipRule="evenodd"
                            />
                          </svg>
                        </dt>
                        <dd className="text-neutral-800 tabular-nums">
                          {hoursLines.map((l, i) => (
                            <span key={i} className="block">
                              {l}
                            </span>
                          ))}
                        </dd>
                      </div>
                    ) : null}
                  </dl>
                  {dropoffNote ? (
                    <p className="mt-5 border-t border-neutral-200 pt-5 text-sm leading-6 text-pretty text-neutral-600">
                      {dropoffNote}
                    </p>
                  ) : null}
                  {wishlistLabel ? (
                    <a
                      href={wishlistHref || "#"}
                      className="mt-6 flex min-h-12 w-full items-center justify-center gap-2 rounded-lg bg-indigo-600 px-5 py-3 text-base font-semibold text-white shadow-sm transition hover:bg-indigo-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
                    >
                      <svg
                        aria-hidden="true"
                        viewBox="0 0 20 20"
                        fill="currentColor"
                        className="size-5"
                      >
                        <path d="M1 1.75A.75.75 0 0 1 1.75 1h1.628a1.75 1.75 0 0 1 1.734 1.51L5.18 3a65.25 65.25 0 0 1 13.36 1.412.75.75 0 0 1 .58.875 48.645 48.645 0 0 1-1.618 6.2.75.75 0 0 1-.712.513H6a2.503 2.503 0 0 0-2.292 1.5H17.25a.75.75 0 0 1 0 1.5H2.76a.75.75 0 0 1-.748-.807 4.002 4.002 0 0 1 2.716-3.486L3.626 2.716a.25.25 0 0 0-.248-.216H1.75A.75.75 0 0 1 1 1.75ZM6 17.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0ZM15.5 19a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z" />
                      </svg>
                      {wishlistLabel}
                    </a>
                  ) : null}
                </div>
              </aside>
            ) : null}
          </div>
        </div>
      </section>
    );
  },
};
```
