import Link from "next/link"; import { buttonVariants } from "@/components/ui/button"; import { playHref } from "@/lib/hrefs"; import { cn } from "@/lib/utils"; // --------------------------------------------------------------------------- // PLAY, FROM ANYWHERE A CUT OR A TAKE IS NAMED (lane/ui-simplify, 5 Nov; the // operator: "sometimes going to the play screen for a cut is hard to do without // just entering the /play page"). // // One link, one address builder (lib/hrefs.ts playHref): with no take it lands // on Play of THE DRAFT (the project's manifest, where every edit lands -- L3), // with a take on that saved version (read-only), with a clip at that item. Every surface that names a cut or a take wears this rather // than a hand-built `/play` link, so no surface leaves the operator typing it. // // `where` is the surface (`header`, `row`, `take-card`, `walk`, `jobs`, `rail`, // `note`): `data-play-link=""`, the e2e's handle. // --------------------------------------------------------------------------- export type PlayLinkVariant = "primary" | "header" | "button" | "link" | "icon"; export default function PlayLink({ project, take = null, clip = null, at = null, note = null, where, variant = "button", label, title, className, }: { project: string; /** A version's id; null plays the draft. */ take?: string | null; /** Start on this item (a clip or a post item's id). */ clip?: string | null; at?: number | null; note?: string | null; where: string; variant?: PlayLinkVariant; label?: React.ReactNode; title?: string; className?: string; }) { const href = playHref(project, { take, clip, at, note }); const words = label ?? (variant === "icon" ? "▶" : clip ? "▶ Play here" : take ? `▶ Play ${take}` : "▶ Play"); const look = variant === "primary" ? buttonVariants({ variant: "go", size: "md" }) : variant === "header" ? buttonVariants({ variant: "outline", size: "md" }) : variant === "button" ? buttonVariants({ variant: "outline", size: "sm" }) : variant === "icon" ? "inline-flex items-center rounded-[3px] px-1 text-[11px] text-signal-text hover:bg-panel-2" : "ink-link text-[11.5px]"; return ( {words} ); }