import { Link } from "../../lib/navigation"; import { ArrowLeftIcon, LinkIcon, XIcon } from "lucide-react"; import type { ReactNode } from "react"; import { Button } from "../../../ui/button"; import { useArtifactsBackLink } from "../artifacts/artifact-page-chrome"; import { ArtifactBrowseControls } from "../artifacts/artifact-browse-controls"; import { COPY_ARTIFACT_LINK, useCopyArtifactLink } from "../artifacts/copy-artifact-link"; import type { ArtifactKind } from "../../lib/artifact-catalog"; /** Explicit, reload-safe navigation for full-page artifacts (never embedded viewers). */ export function ArtifactSessionPage({ workspaceId, artifactId, fromSession, showAllArtifacts = false, linkKind, children, }: { workspaceId: string; artifactId?: string | undefined; fromSession?: string | undefined; /** Opt in when the detail content does not already own its library link. */ showAllArtifacts?: boolean | undefined; /** Shows Copy link here, for pages whose own header has no place for it. */ linkKind?: ArtifactKind | undefined; children: ReactNode; }) { if (!fromSession && !showAllArtifacts && !artifactId) return children; return ( {children} ); } function ArtifactSessionNavigation({ workspaceId, artifactId, fromSession, showAllArtifacts, linkKind, children, }: { workspaceId: string; artifactId?: string | undefined; fromSession?: string | undefined; showAllArtifacts: boolean; linkKind?: ArtifactKind | undefined; children: ReactNode; }) { const back = useArtifactsBackLink(workspaceId, fromSession); const copyLink = useCopyArtifactLink(workspaceId); return (
{showAllArtifacts ? ( ) : null} {artifactId && linkKind ? ( ) : null} {artifactId ? ( ) : null} {fromSession ? ( ) : null}
{children}
); }