import Link from "next/link"; import { UndoBar } from "@/components/piece/Lifecycle"; import AppShell from "@/components/shell/AppShell"; import { buttonVariants } from "@/components/ui/button"; import { Stepper } from "@/components/ui/stepper"; import { Tabs, type TabItem } from "@/components/ui/tabs"; import type { Crumb } from "@/components/shell/AppHeader"; import { articleHref } from "@/lib/hrefs"; import { researchCaseHref } from "@/lib/research/hrefs"; import type { PieceFrame as Frame } from "@/lib/pieces/frame"; import ScheduleControls from "@/components/series/ScheduleControls"; import { badgeVariants as chipVariants } from "@/components/ui/badge"; import type { Cadence } from "@/lib/schedule-types"; import { cn } from "@/lib/utils"; import LifecycleChip from "./LifecycleChip"; import Menu from "./Menu"; import PieceKeys from "./PieceKeys"; import StagePips from "./StagePips"; // --------------------------------------------------------------------------- // THE PIECE PAGE's frame (plans/umtool-redesign.md, P4a-1; canvas "Piece · // Overview"): the head -- the trail, the piece's title, the lifecycle chip and // the ⋯ menu, the page's status line, the stage stepper -- then the tabs, as // links (`?tab=`, lib/pieces/tabs.mjs), then the tab's own body. // // Kind-blind: the report-video page (components/projects/ReportProject.tsx) // and the article piece (components/articles/ArticlePage.tsx, P4a-2) hand it // the trail, the tabs and their addresses, the counts and the body. `1`–`9` // open the tabs, in order, and `n` runs the Next card's action (PieceKeys). // A living report's article carries its schedule's cadence chip in the head, // with Pause/Resume and Tick now (`schedule`, R5); an edition says its series. // // ON A PHONE (the desk unchanged): the title block is in flow and scrolls away; // the stepper is Work's stage pips with the lifecycle word; the lifecycle (three // labelled buttons, LifecycleChip), the ⋯ items, the open-notes count and // `head` (the policy chip) are the place bar's ⋯ sheet; the tabs are one // sideways strip, sticky under the place bar (app/globals.css, "phone: the // shell"). The Undo bar stays, above the dock. // --------------------------------------------------------------------------- export type FrameTab = { id: string; label: string; href: string }; export default function PieceFrame({ active = "projects", crumbs, frame, tab, tabs, counts, note, meta, head, more, primary, schedule, edition, children, }: { /** The rail's key (components/AppNav.tsx): a piece is under Work, never Work itself -- `projects` or `articles`. */ active?: string; /** The trail, its last crumb the piece's title (the head's `

`). */ crumbs: Crumb[]; frame: Frame; /** The tab on show. */ tab: string; /** Every tab, in order, with its address. */ tabs: FrameTab[]; /** A line beside the title (an article's status, dates, revisions). */ meta?: React.ReactNode; /** More of the head's foot row, after the stepper (the policy chip). */ head?: React.ReactNode; /** A count beside a tab's name, in Meter (Cut: clips, Media: fields awaiting review, Sources: recordings). */ counts: Partial>; /** The page's one-line status, the head's last `.micro`. */ note?: React.ReactNode; /** The ⋯ menu's items (Delete project …). */ more?: React.ReactNode; /** The head's primary action row (a report video's Play, Walk, + Add a clip): on the stepper's row, on every tab. */ primary?: React.ReactNode; /** A living report's schedule (R5): the cadence chip, Pause/Resume, Tick now. */ schedule?: { id: string; shape: string; chip: string; paused: boolean; cadence: Cadence; running: boolean } | null; /** The series this article is an edition of (R5). */ edition?: { title: string; href: string } | null; children: React.ReactNode; }) { const hrefs = tabs.map((t) => t.href); const items: TabItem[] = tabs.map((t) => ({ href: t.href, label: t.label, current: t.id === tab, count: counts[t.id] ? counts[t.id] : undefined, testid: `piece-tab-${t.id}`, })); const { article, piece } = frame; return ( <> {piece && } {more && ( )} } below={
{/* The head's primary row (lane/ui-simplify): beside the stepper, so the title's row keeps its actions inline. */} {primary && ( {primary} )} {frame.board && ( from the board{" "} {frame.board.title} )} {article && ( a video of{" "} {article.title} )} {head && {head}} {schedule && (