import type { ReactNode } from "react"; import { Link } from "react-router"; import { FeatherArrowLeft } from "@subframe/core"; import { Button } from "~/ui/components/Button"; import { cn } from "~/lib/utils"; /** * Shared page chrome for the HiveGrid app screens. * * The header bar markup is the one shipped with the Subframe screens for * /automations and /forms: a full-bleed bar (own padding + bottom border) that * carries icon, heading and optional actions. Every app screen composes the same * three primitives so the pages stay visually aligned and each page renders * exactly one

. * * Layout constraint (see screens/subframe-layout-boundary.test.ts): never combine * `h-full`+`overflow-hidden` or `basis-0`+`overflow-y-auto` in here — the app * shell's
has no definite height and such a screen collapses to 0px. */ /** Canonical icon styling for PageHeader icons — keeps icon size/tone aligned across screens. */ export const PAGE_HEADER_ICON_CLASS = "text-heading- font-heading- text-icon-neutral-tertiary"; export function PageShell({ uiId, className, sseHref, children, }: { uiId?: string; className?: string; /** Optional realtime hint mirrored onto the root as `data-sse-href` (SSE-backed screens). */ sseHref?: string | null; /** Optional so not-ready/empty screen states can render a bare shell. */ children?: ReactNode; }): React.JSX.Element { return (
{children}
); } export function PageHeader({ icon, title, subtitle, subtitleClassName, subtitleTone = "tertiary", actions, dense = false, titleTrailing, uiId, }: { icon?: ReactNode; title: ReactNode; subtitle?: ReactNode; subtitleClassName?: string; subtitleTone?: "secondary" | "tertiary"; actions?: ReactNode; /** * Compact header bar: smaller bar height and a smaller heading, for a screen * whose own controls (not a description) say what is being shown. A subtitle * still fits — it sits directly under the heading and keeps the bar to two * short lines. */ dense?: boolean; /** Controls that belong to the heading itself, split off by a vertical rule (dense only). */ titleTrailing?: ReactNode; uiId?: string; }): React.JSX.Element { const heading = (
{icon}

{title}

); if (dense) { return (
{/* `gap-1.5`: the subtitle of a dense header is a chip, not a text line — without air between the two it reads as part of the heading. */}
{heading} {titleTrailing ? ( <>
{titleTrailing} ) : null}
{subtitle ? (

{subtitle}

) : null}
{actions ?
{actions}
: null}
); } return (
{heading} {subtitle ? (

{subtitle}

) : null}
{actions ?
{actions}
: null}
); } /** * Full-bleed filter/toolbar strip directly below the PageHeader. * * Same chrome as the header bar (own padding, bottom border, secondary surface) * so filter controls read as page chrome rather than as content. Must be a * sibling of PageHeader, NOT nested in PageBody — PageBody adds the 24px content * padding and would break the full-bleed edge. */ export function PageToolbar({ className, uiId, children, }: { className?: string; uiId?: string; children: ReactNode; }): React.JSX.Element { return (
{children}
); } /** Canonical back navigation for subpages: tertiary button with a left arrow, placed at the top of PageBody. */ export function PageBackLink({ to, label, uiId }: { to: string; label: ReactNode; uiId?: string }): React.JSX.Element { return (
); } /** * Description line for a screen that renders inside a settings hub (AK-SET-01). * * A hub already owns the page's single

and its tab bar names the section, * so an embedded screen must not render a second PageHeader. Its description is * still worth keeping — this is where it goes. */ export function PageIntro({ children, uiId }: { children: ReactNode; uiId?: string }): React.JSX.Element { return (

{children}

); } /** Content area below the header bar: 24px page padding (16px on mobile, matching the header edge). */ export function PageBody({ className, uiId, children, }: { className?: string; uiId?: string; children: ReactNode; }): React.JSX.Element { return (
{children}
); }