import Link from "next/link";
import { cn } from "@/lib/utils";
import PageActions from "./PageActions";
import PlaceBar from "./PlaceBar";
import { Mark } from "./Wordmark";
export type Crumb = { href?: string; label: string };
// ---------------------------------------------------------------------------
// The page head (canvas `.pagehead`), the top of the work column.
//
// The breadcrumb is ONE nav (aria-label "Breadcrumb"): the trail above, small,
// and the page's own name under it as the
-- set in Archivo at 125% width,
// the face kept for place and piece titles. The name stays INSIDE the nav, so
// the breadcrumb still contains every crumb (specs read it) and no text is on
// the page twice.
//
// `note` is the page's one-line status (`.micro`), always the LAST `.micro` in
// the header -- dashboard.spec reads /browse's that way. `actions` sit to its
// left. A BENCH header is one compact row (canvas `.benchtop`): a bench fits
// 1366×768 and its rail is collapsed, so the mark links home from here.
//
// No hooks, no server imports: a client page (the song deck) renders it too.
//
// ON A PHONE (below md; the desk is unchanged) a PAGE head is three things:
// - the place bar (PlaceBar.tsx), fixed at the top: back, the trail, ⋯;
// - the title, the meta and `below` IN FLOW, so they scroll away -- the
// trail is not drawn here, it is the place bar's;
// - the actions and the note in the ⋯ sheet (PageActions.tsx), with
// `sheet`, what only the sheet carries.
// A BENCH head is left as it is: the bench draws its own phone head.
// ---------------------------------------------------------------------------
export default function AppHeader({
crumbs,
note,
actions,
meta,
below,
sheet,
variant = "page",
clamp = false,
className,
}: {
crumbs: Crumb[];
note?: React.ReactNode;
/** Controls on the right, before the note. */
actions?: React.ReactNode;
/** A line under the title (counts, a hint); muted. */
meta?: React.ReactNode;
/** A full-width row at the foot of the head (a piece's stage stepper). */
below?: React.ReactNode;
/** Page actions on a phone only, in the ⋯ sheet (a piece's policy chip): never on the desk. */
sheet?: React.ReactNode;
variant?: "page" | "bench";
/** A long title (a run's question) wraps to two lines, its full text in `title`, instead of one truncated line. */
clamp?: boolean;
className?: string;
}) {
const trail = crumbs.slice(0, -1);
const here = crumbs[crumbs.length - 1];
const bench = variant === "bench";
return (
<>
{!bench && }
{bench && (
)}
{meta &&