# Add the "Audio Tour" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/audio-tour) to this Pantheon Content Publisher (P1) Next.js project. Numbered self-guided tour stops with optional native audio, transcripts in disclosures and a phone dial-in panel.

## Steps

1. Create `components/puck/audio-tour-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 { audioTourBlock } from "./components/puck/audio-tour-block";`
3. Register it under `components` as `AudioTourBlock: audioTourBlock`.
4. Add `"AudioTourBlock"` to the best-fitting entry in `categories` (this block's library category is "Arts & culture"). 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/audio-tour-block.tsx`

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

/**
 * Audio Tour — a self-guided gallery tour: numbered stops with gallery and running time, an
 * optional native audio player per stop, a full transcript in a disclosure, and a dial-in panel
 * for visitors listening by phone. Register: `AudioTourBlock: audioTourBlock` in puck.config.tsx.
 */

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

type Stop = {
  number: string;
  title: string;
  gallery: string;
  duration: string;
  imageUrl: string;
  imageAlt: string;
  audioUrl: string;
  transcript: string;
};

export type AudioTourProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  dialLabel: string;
  dialNumber: string;
  dialInstructions: string;
  appNote: string;
  transcriptLabel: string;
  stops: Stop[];
};

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

export const audioTourBlock: ComponentConfig<AudioTourProps> = {
  label: "Audio Tour",
  fields: {
    eyebrow: { type: "text", label: "Eyebrow", metadata: { help: "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." } },
    dialLabel: { type: "text", label: "Phone panel label", metadata: { help: "Like Listen by phone. Leave the number blank to hide the panel." } },
    dialNumber: { type: "text", label: "Phone number", metadata: { help: "Shown large and dialable, like 555-0142." } },
    dialInstructions: { type: "textarea", label: "Phone instructions", metadata: { help: "Like Press the stop number, then #." } },
    appNote: { type: "textarea", label: "App note", metadata: { help: "Where else to listen, like the museum app. Leave blank to hide it." } },
    transcriptLabel: { type: "text", label: "Transcript button text", metadata: { help: "Like Read transcript. The stop title is added for screen readers." } },
    stops: {
      type: "array",
      label: "Stops",
      min: 1,
      max: 30,
      getItemSummary: (item) => [item?.number, item?.title].filter(Boolean).join(" · ") || "Stop",
      defaultItemProps: { number: "100", title: "New stop", gallery: "", duration: "2:00", imageUrl: "", imageAlt: "", audioUrl: "", transcript: "" },
      arrayFields: {
        number: { type: "text", label: "Stop number", metadata: { help: "The number on the gallery label, like 204." } },
        title: { type: "text", label: "Title" },
        gallery: { type: "text", label: "Gallery", metadata: { help: "Where to stand, like Gallery 202." } },
        duration: { type: "text", label: "Running time", metadata: { help: "Like 2:40." } },
        imageUrl: { type: "text", label: "Image URL", metadata: { help: "A small thumbnail of the artwork. Leave blank to hide it." } },
        imageAlt: { type: "text", label: "Image alt text" },
        audioUrl: { type: "text", label: "Audio file URL", metadata: { help: "An MP3 or M4A file. Leave blank and visitors use the phone or app instead." } },
        transcript: { type: "textarea", label: "Transcript", metadata: { help: "The full spoken text. Separate paragraphs with a blank line. Required for deaf and hard-of-hearing visitors." } },
      },
    },
  },
  defaultProps: {
    eyebrow: "Audio guide",
    heading: "The Weight of Water, in her own words",
    headingLevel: "h2",
    intro: "Eight stops, about 25 minutes. The artist and curators talk you through the exhibition, one painting at a time. Look for the headphone symbol and number on gallery labels.",
    dialLabel: "Listen by phone",
    dialNumber: "555-0142",
    dialInstructions: "Call, then enter the stop number followed by #. Standard call rates apply.",
    appNote: "Also free in the Halvorsen app, and on loaner players at the coat check. Bring headphones, or borrow a pair.",
    transcriptLabel: "Read transcript",
    stops: [
      {
        number: "201",
        title: "Introduction",
        gallery: "Gallery 201, entrance",
        duration: "1:50",
        imageUrl: "https://picsum.photos/seed/tourintro/400/400",
        imageAlt: "Exhibition title painted on a deep blue wall",
        audioUrl: "",
        transcript: "Welcome to The Weight of Water. I'm Signe Arneson, curator of contemporary art at the Halvorsen.\n\nFor thirty years Ines Okonkwo-Lindqvist has gone down to the same stretch of the Mississippi every week, collected silt, and carried it back to her studio. Everything you'll see today began there.",
      },
      {
        number: "202",
        title: "Delta, Low Water",
        gallery: "Gallery 201",
        duration: "3:05",
        imageUrl: "https://picsum.photos/seed/silt1/400/400",
        imageAlt: "Grey-blue canvas with fine branching lines",
        audioUrl: "",
        transcript: "INES OKONKWO-LINDQVIST: That summer the river dropped lower than anyone could remember. Sandbars came up like the backs of animals.\n\nI laid the canvas flat on the bank and let the water run across it for a whole afternoon. What you see is what it left behind.",
      },
      {
        number: "203",
        title: "Twelve Soundings",
        gallery: "Gallery 202",
        duration: "2:40",
        imageUrl: "https://picsum.photos/seed/silt3/400/400",
        imageAlt: "Twelve small square panels in browns and greens",
        audioUrl: "",
        transcript: "SIGNE ARNESON: Each of these twelve panels records a single month. Stand back and you'll see the year move from the brown of spring flood to the green of August.",
      },
      {
        number: "204",
        title: "Ice Out, April",
        gallery: "Gallery 204",
        duration: "4:15",
        imageUrl: "https://picsum.photos/seed/silt4/400/400",
        imageAlt: "Deep blue canvas with a faint horizon and white flecks",
        audioUrl: "",
        transcript: "INES OKONKWO-LINDQVIST: People ask why the last painting is so quiet. Ice out is the quietest sound I know. You hear it more than you see it.",
      },
    ],
  },
  render: ({ id, eyebrow, heading, headingLevel, intro, dialLabel, dialNumber, dialInstructions, appNote, transcriptLabel, stops }) => {
    const H = headingLevel || "h2";
    const Sub = SUB[H] ?? "h3";
    const uid = `p1-audio-${id}`;
    const list = (stops ?? []).filter((s) => s?.title);
    const tel = (dialNumber || "").replace(/[^\d+]/g, "");

    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 grid max-w-7xl grid-cols-1 gap-12 lg:grid-cols-12 lg:gap-16">
          <div className="lg:col-span-5">
            <div className="lg:sticky lg:top-8">
              {eyebrow ? (
                <p className="flex items-center gap-2 text-xs font-semibold tracking-widest text-indigo-700 uppercase">
                  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4">
                    <path d="M10 2a7 7 0 0 0-7 7v4.5A2.5 2.5 0 0 0 5.5 16H6a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1H4.5V9a5.5 5.5 0 0 1 11 0v1H14a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h.5a2.5 2.5 0 0 0 2.5-2.5V9a7 7 0 0 0-7-7Z" />
                  </svg>
                  {eyebrow}
                </p>
              ) : null}
              {heading ? <H className={`${eyebrow ? "mt-4" : ""} font-serif text-4xl leading-none font-normal tracking-tight text-balance text-neutral-950 sm:text-5xl lg:text-6xl`}>{heading}</H> : null}
              {intro ? <p className="mt-6 text-base leading-7 text-pretty text-neutral-600 sm:text-lg sm:leading-8">{intro}</p> : null}

              {dialNumber ? (
                <aside aria-labelledby={`${uid}-dial`} className="mt-10 bg-neutral-950 p-6 text-white sm:p-8">
                  <p id={`${uid}-dial`} className="text-xs font-semibold tracking-widest text-indigo-200 uppercase">
                    {dialLabel || "Listen by phone"}
                  </p>
                  <a href={tel ? `tel:${tel}` : "#"} className="mt-3 inline-flex min-h-11 items-center font-serif text-4xl tracking-tight text-white tabular-nums underline decoration-indigo-400 decoration-1 underline-offset-8 hover:decoration-2 focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-white sm:text-5xl">
                    {dialNumber}
                  </a>
                  {dialInstructions ? <p className="mt-4 text-sm leading-6 text-pretty text-neutral-300">{dialInstructions}</p> : null}
                  <div aria-hidden="true" className="mt-6 grid max-w-48 grid-cols-3 gap-1.5">
                    {["1", "2", "3", "4", "5", "6", "7", "8", "9", "*", "0", "#"].map((k) => (
                      <span key={k} className={`flex h-8 items-center justify-center text-sm tabular-nums ${k === "#" ? "bg-indigo-600 font-semibold text-white" : "bg-white/10 text-neutral-300"}`}>
                        {k}
                      </span>
                    ))}
                  </div>
                </aside>
              ) : null}
              {appNote ? <p className="mt-6 border-l border-indigo-600 pl-4 text-sm leading-6 text-pretty text-neutral-600">{appNote}</p> : null}
            </div>
          </div>

          {list.length ? (
            <ol role="list" className="min-w-0 border-t border-neutral-950 lg:col-span-7">
              {list.map((s, i) => {
                const paras = (s.transcript || "").split(/\n\s*\n/).map((p) => p.trim()).filter(Boolean);
                return (
                  <li key={`${s.number}-${i}`} className="border-b border-neutral-300 py-8">
                    <article className="grid grid-cols-1 gap-5 sm:grid-cols-12 sm:gap-6">
                      <div className="flex items-start gap-4 sm:col-span-3 sm:flex-col">
                        {s.number ? (
                          <p className="font-serif text-6xl leading-none tracking-tight text-neutral-950 tabular-nums">
                            <span className="sr-only">Stop </span>
                            {s.number}
                          </p>
                        ) : null}
                        {s.imageUrl ? <img src={s.imageUrl} alt={s.imageAlt || ""} loading="lazy" className="ml-auto size-16 bg-neutral-200 object-cover sm:ml-0 sm:size-20" /> : null}
                      </div>
                      <div className="min-w-0 sm:col-span-9">
                        <Sub className="font-serif text-2xl leading-tight font-normal text-balance text-neutral-950 sm:text-3xl">{s.title}</Sub>
                        {s.gallery || s.duration ? (
                          <p className="mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-neutral-600">
                            {s.gallery ? <span>{s.gallery}</span> : null}
                            {s.gallery && s.duration ? <span aria-hidden="true" className="h-3 w-px bg-neutral-300" /> : null}
                            {s.duration ? (
                              <span className="inline-flex items-center gap-1.5 tabular-nums">
                                <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 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>
                                <span className="sr-only">Running time </span>
                                {s.duration}
                              </span>
                            ) : null}
                          </p>
                        ) : null}
                        {s.audioUrl ? (
                          <audio controls preload="none" src={s.audioUrl} className="mt-5 w-full" aria-label={`Stop ${s.number}: ${s.title}`}>
                            <a href={s.audioUrl} className="text-indigo-700 underline">
                              Download the audio
                            </a>
                          </audio>
                        ) : null}
                        {paras.length ? (
                          <details className="group mt-4">
                            <summary className="inline-flex min-h-11 cursor-pointer list-none items-center gap-2 text-sm font-semibold text-neutral-950 underline decoration-indigo-600 underline-offset-4 hover:decoration-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 [&::-webkit-details-marker]:hidden">
                              <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4 text-indigo-600 transition group-open:rotate-90 motion-reduce:transition-none">
                                <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>
                              {transcriptLabel || "Read transcript"}
                              <span className="sr-only">: {s.title}</span>
                            </summary>
                            <div className="mt-3 space-y-4 border-l border-neutral-300 pl-5 font-serif text-base leading-7 text-pretty text-neutral-800 sm:text-lg sm:leading-8">
                              {paras.map((p, pi) => (
                                <p key={pi}>{p}</p>
                              ))}
                            </div>
                          </details>
                        ) : null}
                      </div>
                    </article>
                  </li>
                );
              })}
            </ol>
          ) : null}
        </div>
      </section>
    );
  },
};
```
