# Add the "Athletics Schedule" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/athletics-schedule) to this Pantheon Content Publisher (P1) Next.js project. A sport's season schedule table with home or away, location, results or start times, and ticket and stream links.

## Steps

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

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

// spec: status-colors

/**
 * Athletics Schedule — one sport's season as a real table: date, opponent, home or away,
 * location, result or start time, and ticket and stream links. Sorted by date.
 * Register: `AthleticsScheduleBlock: athleticsScheduleBlock` in puck.config.tsx.
 */

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

type Site = "home" | "away" | "neutral";

type Game = {
  date: string;
  dateIso: string;
  opponent: string;
  conference: boolean;
  site: Site;
  location: string;
  result: string;
  ticketsHref: string;
  streamHref: string;
};

export type AthleticsScheduleProps = {
  sport: string;
  heading: string;
  headingLevel: Heading;
  record: string;
  caption: string;
  games: Game[];
  footnote: string;
  fullLabel: string;
  fullHref: string;
};

const isoPattern = /^\d{4}-\d{2}-\d{2}/;

const siteStyles: Record<Site, { label: string; className: string }> = {
  home: { label: "Home", className: "bg-indigo-600 text-white" },
  away: { label: "Away", className: "bg-white text-neutral-800 ring-1 ring-neutral-300 ring-inset" },
  neutral: { label: "Neutral", className: "bg-neutral-100 text-neutral-800" },
};

type Outcome = { word: string; className: string } | null;

function outcomeOf(result: string): Outcome {
  const r = result.trim();
  if (/^W\b/i.test(r)) return { word: "Win", className: "bg-emerald-50 text-emerald-800 ring-emerald-600/20" };
  if (/^L\b/i.test(r)) return { word: "Loss", className: "bg-red-50 text-red-800 ring-red-600/20" };
  if (/^[TD]\b/i.test(r)) return { word: "Tie", className: "bg-amber-50 text-amber-900 ring-amber-600/25" };
  return null;
}

export const athleticsScheduleBlock: ComponentConfig<AthleticsScheduleProps> = {
  label: "Athletics Schedule",
  fields: {
    sport: { type: "text", label: "Sport", metadata: { help: "Such as Women's Volleyball. Shown above the heading." } },
    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." },
    },
    record: { type: "text", label: "Record", metadata: { help: "Such as Overall 7–2 · Conference 3–1. Leave blank to hide it." } },
    caption: { type: "text", label: "Table caption", metadata: { help: "Names the table for screen reader users." } },
    games: {
      type: "array",
      label: "Games",
      min: 1,
      max: 40,
      getItemSummary: (item) => [item?.dateIso, item?.opponent].filter(Boolean).join(" · ") || "Game",
      defaultItemProps: {
        date: "Sat, Oct 24",
        dateIso: "2026-10-24",
        opponent: "Opponent",
        conference: false,
        site: "home",
        location: "Hollis Arena",
        result: "7 p.m.",
        ticketsHref: "",
        streamHref: "",
      },
      arrayFields: {
        dateIso: { type: "text", label: "Date (YYYY-MM-DD)", metadata: { help: "Sorts the schedule and feeds calendars and screen readers." } },
        date: { type: "text", label: "Date text", metadata: { help: "As it should appear, such as Sat, Oct 24." } },
        opponent: { type: "text", label: "Opponent" },
        conference: {
          type: "radio",
          label: "Conference game",
          options: [
            { label: "Yes", value: true },
            { label: "No", value: false },
          ],
          metadata: { help: "Marks the game with an asterisk and a footnote." },
        },
        site: {
          type: "select",
          label: "Home or away",
          options: [
            { label: "Home", value: "home" },
            { label: "Away", value: "away" },
            { label: "Neutral site", value: "neutral" },
          ],
        },
        location: { type: "text", label: "Location", metadata: { help: "Venue and city." } },
        result: {
          type: "text",
          label: "Result or time",
          metadata: { help: "Before the game, the start time (7 p.m.). After, start with W, L or T and the score, such as W 3–1." },
        },
        ticketsHref: { type: "text", label: "Tickets link", metadata: { help: "Leave blank to hide it." } },
        streamHref: { type: "text", label: "Watch link", metadata: { help: "Stream or broadcast. Leave blank to hide it." } },
      },
    },
    footnote: { type: "text", label: "Footnote", metadata: { help: "Explains the asterisk and time zone. Leave blank to hide it." } },
    fullLabel: { type: "text", label: "Full schedule link text", metadata: { help: "Such as a printable schedule or calendar subscription. Leave blank to hide it." } },
    fullHref: { type: "text", label: "Full schedule link" },
  },
  defaultProps: {
    sport: "Women's Volleyball",
    heading: "2026 schedule and results",
    headingLevel: "h2",
    record: "Overall 6–2 · Conference 3–1",
    caption: "Northfield State women's volleyball 2026 schedule (sample)",
    games: [
      { date: "Fri, Sep 25", dateIso: "2026-09-25", opponent: "Lakeview College", conference: true, site: "home", location: "Hollis Arena, Northfield", result: "W 3–1", ticketsHref: "", streamHref: "/watch/vb-0925" },
      { date: "Sat, Oct 3", dateIso: "2026-10-03", opponent: "Bridger University", conference: true, site: "away", location: "Bridger Fieldhouse, Grand Bend", result: "L 1–3", ticketsHref: "", streamHref: "/watch/vb-1003" },
      { date: "Fri, Oct 9", dateIso: "2026-10-09", opponent: "Cedar Valley State", conference: true, site: "home", location: "Hollis Arena, Northfield", result: "7 p.m.", ticketsHref: "/tickets/vb-1009", streamHref: "/watch/vb-1009" },
      { date: "Sat, Sep 26", dateIso: "2026-09-26", opponent: "Mount Ellis College", conference: false, site: "home", location: "Hollis Arena, Northfield", result: "W 3–0", ticketsHref: "", streamHref: "" },
      { date: "Sat, Oct 17", dateIso: "2026-10-17", opponent: "Prairie Tech", conference: true, site: "away", location: "Ridley Gym, Hartford Plains", result: "2 p.m.", ticketsHref: "", streamHref: "/watch/vb-1017" },
      { date: "Fri, Oct 23", dateIso: "2026-10-23", opponent: "Ashby College", conference: false, site: "neutral", location: "Riverside Classic, Civic Center, Kingsport", result: "5:30 p.m.", ticketsHref: "/tickets/riverside-classic", streamHref: "" },
      { date: "Sat, Oct 31", dateIso: "2026-10-31", opponent: "Lakeview College", conference: true, site: "home", location: "Hollis Arena, Northfield", result: "6 p.m.", ticketsHref: "/tickets/vb-1031", streamHref: "/watch/vb-1031" },
    ],
    footnote: "* Conference game. All times Central. Sample schedule for illustration.",
    fullLabel: "Add the schedule to your calendar",
    fullHref: "/athletics/volleyball/schedule.ics",
  },
  render: ({ id, sport, heading, headingLevel, record, caption, games, footnote, fullLabel, fullHref }) => {
    const H = headingLevel || "h2";
    const captionId = `${id || "athletics"}-caption`;
    const list = (games ?? [])
      .filter((g) => g?.opponent)
      .map((g, i) => ({ ...g, order: i, iso: isoPattern.test(g.dateIso || "") ? g.dateIso.slice(0, 10) : "" }))
      .sort((a, b) => {
        if (a.iso && b.iso && a.iso !== b.iso) return a.iso < b.iso ? -1 : 1;
        if (a.iso && !b.iso) return -1;
        if (!a.iso && b.iso) return 1;
        return a.order - b.order;
      });
    const linkClass =
      "inline-flex min-h-11 items-center gap-1.5 rounded-md px-2 text-sm font-semibold text-indigo-700 hover:bg-indigo-50 hover:text-indigo-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600";

    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-6 border-b-4 border-neutral-950 pb-6 md:flex-row md:items-end md:justify-between">
            <div>
              {sport ? <p className="text-sm font-bold tracking-widest text-indigo-700 uppercase">{sport}</p> : null}
              {heading ? (
                <H className={`text-3xl font-bold tracking-tight text-balance text-neutral-950 uppercase sm:text-4xl lg:text-5xl ${sport ? "mt-2" : ""}`}>{heading}</H>
              ) : null}
            </div>
            {record || fullLabel ? (
              <div className="flex flex-col items-start gap-3 md:items-end">
                {record ? <p className="text-base font-semibold text-neutral-900 tabular-nums">{record}</p> : null}
                {fullLabel ? (
                  <a
                    href={fullHref || "#"}
                    className="inline-flex min-h-11 items-center gap-2 rounded-lg bg-neutral-950 px-4 py-2.5 text-sm font-semibold text-white 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-4">
                      <path fillRule="evenodd" d="M5.75 2a.75.75 0 0 1 .75.75V4h7V2.75a.75.75 0 0 1 1.5 0V4h.25A2.75 2.75 0 0 1 18 6.75v8.5A2.75 2.75 0 0 1 15.25 18H4.75A2.75 2.75 0 0 1 2 15.25v-8.5A2.75 2.75 0 0 1 4.75 4H5V2.75A.75.75 0 0 1 5.75 2Zm-1 5.5c-.69 0-1.25.56-1.25 1.25v6.5c0 .69.56 1.25 1.25 1.25h10.5c.69 0 1.25-.56 1.25-1.25v-6.5c0-.69-.56-1.25-1.25-1.25H4.75Z" clipRule="evenodd" />
                    </svg>
                    {fullLabel}
                  </a>
                ) : null}
              </div>
            ) : null}
          </div>

          {list.length ? (
            <div
              role="region"
              aria-labelledby={captionId}
              tabIndex={0}
              className="-mx-4 mt-2 relative overflow-x-auto px-4 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 sm:mx-0 sm:px-0"
            >
              <table className="w-full min-w-3xl border-collapse text-left">
                <caption id={captionId} className="sr-only">
                  {caption || [sport, heading].filter(Boolean).join(": ") || "Game schedule"}
                </caption>
                <thead>
                  <tr className="border-b border-neutral-300">
                    {["Date", "Opponent", "Site", "Location", "Result / time"].map((h) => (
                      <th key={h} scope="col" className="py-3 pr-4 text-xs font-semibold tracking-wide whitespace-nowrap text-neutral-600 uppercase">
                        {h}
                      </th>
                    ))}
                    <th scope="col" className="py-3 text-right text-xs font-semibold tracking-wide text-neutral-600 uppercase">
                      <span className="sr-only">Tickets and streaming</span>
                    </th>
                  </tr>
                </thead>
                <tbody className="divide-y divide-neutral-200">
                  {list.map((g, i) => {
                    const site = siteStyles[g.site] ?? siteStyles.home;
                    const result = (g.result || "").trim();
                    const outcome = result ? outcomeOf(result) : null;
                    const score = outcome ? result.replace(/^[WLTD]\b\s*/i, "") : result;
                    return (
                      <tr key={`${g.iso}-${g.opponent}-${i}`} className={g.site === "home" ? "bg-indigo-50/40" : ""}>
                        <td className="py-4 pr-4 text-sm font-semibold whitespace-nowrap text-neutral-950 tabular-nums">
                          {g.iso ? <time dateTime={g.iso}>{g.date || g.iso}</time> : g.date || "TBA"}
                        </td>
                        <th scope="row" className="py-4 pr-4 text-left text-base font-semibold text-neutral-950">
                          {g.site === "away" ? <span className="font-normal text-neutral-600">at </span> : g.site === "neutral" ? <span className="font-normal text-neutral-600">vs. </span> : null}
                          {g.opponent}
                          {g.conference ? (
                            <>
                              <span aria-hidden="true" className="text-indigo-700">
                                *
                              </span>
                              <span className="sr-only"> (conference game)</span>
                            </>
                          ) : null}
                        </th>
                        <td className="py-4 pr-4">
                          <span className={`inline-flex rounded-full px-2.5 py-0.5 text-xs font-semibold ${site.className}`}>{site.label}</span>
                        </td>
                        <td className="py-4 pr-4 text-sm leading-6 text-neutral-700">{g.location || "TBA"}</td>
                        <td className="py-4 pr-4 text-sm whitespace-nowrap tabular-nums">
                          {outcome ? (
                            <span className="inline-flex items-center gap-2">
                              <span className={`inline-flex rounded-md px-2 py-0.5 text-xs font-bold ring-1 ring-inset ${outcome.className}`}>
                                <span aria-hidden="true">{outcome.word.charAt(0)}</span>
                                <span className="sr-only">{outcome.word}</span>
                              </span>
                              <span className="font-semibold text-neutral-950">{score}</span>
                            </span>
                          ) : (
                            <span className="font-medium text-neutral-900">{result || "TBA"}</span>
                          )}
                        </td>
                        <td className="py-2 text-right whitespace-nowrap">
                          <span className="inline-flex gap-1">
                            {g.ticketsHref ? (
                              <a href={g.ticketsHref} className={linkClass}>
                                Tickets<span className="sr-only">, {g.opponent}</span>
                              </a>
                            ) : null}
                            {g.streamHref ? (
                              <a href={g.streamHref} className={linkClass}>
                                <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-4">
                                  <path d="M6.3 2.84A1.5 1.5 0 0 0 4 4.11v11.78a1.5 1.5 0 0 0 2.3 1.27l9.344-5.891a1.5 1.5 0 0 0 0-2.538L6.3 2.841Z" />
                                </svg>
                                Watch<span className="sr-only">, {g.opponent}</span>
                              </a>
                            ) : null}
                          </span>
                        </td>
                      </tr>
                    );
                  })}
                </tbody>
              </table>
            </div>
          ) : null}

          {footnote ? <p className="mt-6 text-sm leading-6 text-neutral-600">{footnote}</p> : null}
        </div>
      </section>
    );
  },
};
```
