# Add the "Academic Calendar" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/academic-calendar) to this Pantheon Content Publisher (P1) Next.js project. Key dates for each term in side-by-side columns, entered one per line, with a full-calendar PDF link.

## Steps

1. Create `components/puck/academic-calendar-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 { academicCalendarBlock } from "./components/puck/academic-calendar-block";`
3. Register it under `components` as `AcademicCalendarBlock: academicCalendarBlock`.
4. Add `"AcademicCalendarBlock"` 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/academic-calendar-block.tsx`

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

/**
 * Academic Calendar — key dates for each term, side by side, with a link to the full
 * calendar. Each date is one line ("Aug 24 | Classes begin"), so editors never fight a table.
 * Register: `AcademicCalendarBlock: academicCalendarBlock` in puck.config.tsx.
 */

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

type Term = { name: string; dates: string };

export type AcademicCalendarProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  terms: Term[];
  downloadLabel: string;
  downloadHref: string;
  downloadMeta: string;
  note: string;
};

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

function parseDates(raw: string) {
  return (raw || "")
    .split("\n")
    .map((line) => line.trim())
    .filter(Boolean)
    .map((line) => {
      const cut = line.indexOf("|");
      if (cut === -1) return { date: "", event: line };
      return { date: line.slice(0, cut).trim(), event: line.slice(cut + 1).trim() };
    })
    .filter((row) => row.date || row.event);
}

export const academicCalendarBlock: ComponentConfig<AcademicCalendarProps> = {
  label: "Academic Calendar",
  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" },
    terms: {
      type: "array",
      label: "Terms",
      min: 1,
      max: 6,
      getItemSummary: (item) => item?.name || "Term",
      defaultItemProps: { name: "New term", dates: "Jan 1 | First day of classes\nMay 1 | Last day of classes" },
      arrayFields: {
        name: { type: "text", label: "Term name", metadata: { help: "Such as Fall 2026 or Summer Session I." } },
        dates: {
          type: "textarea",
          label: "Dates",
          metadata: { help: "One date per line: the date, a | character, then what happens. Example: Aug 24 | Classes begin" },
        },
      },
    },
    downloadLabel: { type: "text", label: "Download link text", metadata: { help: "Leave blank to hide the download link." } },
    downloadHref: { type: "text", label: "Download link", metadata: { help: "Usually a link to the full calendar PDF." } },
    downloadMeta: { type: "text", label: "File details", metadata: { help: "Shown after the link text, such as PDF, 240 KB. Leave blank to hide it." } },
    note: { type: "textarea", label: "Footnote", metadata: { help: "Small print under the calendar. Leave blank to hide it." } },
  },
  defaultProps: {
    heading: "Academic calendar, 2026–27",
    headingLevel: "h2",
    intro: "The dates that shape the year at Northfield State: when classes start, the last day to change your schedule, breaks and finals.",
    terms: [
      {
        name: "Fall 2026",
        dates:
          "Aug 24 | Classes begin\nAug 28 | Last day to add or drop without a W\nSep 7 | Labor Day, no classes\nOct 15–16 | Fall break\nNov 6 | Last day to withdraw with a W\nNov 25–27 | Thanksgiving recess\nDec 4 | Last day of classes\nDec 7–11 | Final exams",
      },
      {
        name: "Spring 2027",
        dates:
          "Jan 19 | Classes begin\nJan 25 | Last day to add or drop without a W\nMar 15–19 | Spring break\nApr 2 | Last day to withdraw with a W\nMay 7 | Last day of classes\nMay 10–14 | Final exams\nMay 15 | Commencement",
      },
      {
        name: "Summer 2027",
        dates:
          "May 24 | Session I begins\nMay 31 | Memorial Day, no classes\nJun 25 | Session I ends\nJun 28 | Session II begins\nJul 5 | Independence Day observed\nJul 30 | Session II ends",
      },
    ],
    downloadLabel: "Download full calendar",
    downloadHref: "/registrar/academic-calendar-2026-27.pdf",
    downloadMeta: "PDF, 240 KB",
    note: "Approved by the Faculty Senate. Dates may change; the Office of the Registrar posts updates here first.",
  },
  render: ({ heading, headingLevel, intro, terms, downloadLabel, downloadHref, downloadMeta, note }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[headingLevel] || "h3";
    const list = (terms ?? []).filter((t) => t?.name || t?.dates);
    const download = downloadLabel ? (
      <a
        href={downloadHref || "#"}
        className="group inline-flex min-h-11 items-center gap-3 rounded-lg bg-white px-4 py-2.5 text-sm font-semibold text-neutral-950 shadow-sm ring-1 ring-neutral-300 transition ring-inset hover:bg-neutral-50 hover:ring-neutral-400 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 shrink-0 text-indigo-600 transition group-hover:translate-y-0.5">
          <path d="M10.75 2.75a.75.75 0 0 0-1.5 0v8.614L6.295 8.235a.75.75 0 1 0-1.09 1.03l4.25 4.5a.75.75 0 0 0 1.09 0l4.25-4.5a.75.75 0 0 0-1.09-1.03l-2.955 3.129V2.75Z" />
          <path d="M3.5 12.75a.75.75 0 0 0-1.5 0v2.5A2.75 2.75 0 0 0 4.75 18h10.5A2.75 2.75 0 0 0 18 15.25v-2.5a.75.75 0 0 0-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5Z" />
        </svg>
        <span>
          {downloadLabel}
          {downloadMeta ? <span className="ml-1.5 font-normal text-neutral-600">({downloadMeta})</span> : null}
        </span>
      </a>
    ) : null;

    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">
          {heading || intro || download ? (
            <div className="flex flex-col gap-6 border-b border-neutral-200 pb-10 lg:flex-row lg:items-end lg:justify-between lg:gap-12">
              <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>
              {download ? <div className="shrink-0">{download}</div> : null}
            </div>
          ) : null}

          {list.length ? (
            <div className={`grid gap-x-10 gap-y-12 md:grid-cols-2 lg:grid-cols-3 ${heading || intro || download ? "mt-10 sm:mt-12" : ""}`}>
              {list.map((term, i) => {
                const rows = parseDates(term.dates);
                return (
                  <article key={`${term.name}-${i}`} className="min-w-0">
                    {term.name ? (
                      <Sub className="flex items-center gap-3 text-xl font-semibold tracking-tight text-neutral-950">
                        <span aria-hidden="true" className="h-5 w-1 rounded-full bg-indigo-600" />
                        {term.name}
                      </Sub>
                    ) : null}
                    {rows.length ? (
                      <dl className="mt-5 divide-y divide-neutral-200 border-y border-neutral-200">
                        {rows.map((row, j) => (
                          <div key={j} className="flex gap-x-4 py-3.5">
                            <dt className="w-26 shrink-0 text-sm leading-6 font-semibold text-indigo-700 tabular-nums sm:w-30">{row.date || "TBA"}</dt>
                            <dd className="min-w-0 text-sm leading-6 text-pretty text-neutral-700">{row.event}</dd>
                          </div>
                        ))}
                      </dl>
                    ) : null}
                  </article>
                );
              })}
            </div>
          ) : null}

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