import type { ReactNode } from "react"; interface HousekeepingPageStateBaseProps { title: string; description: string; headingLevel?: "h1" | "h2"; retryAction?: ReactNode; } type HousekeepingPageStateProps = HousekeepingPageStateBaseProps & ( | { state: "partial"; partialLabel: string } | { state: | "loading" | "empty" | "conflict" | "dependency" | "forbidden" | "error" | "not-found" | "success"; partialLabel?: never; } ); const ALERT_STATES = new Set(["conflict", "dependency", "forbidden", "error"]); export function HousekeepingPageState({ state, partialLabel, title, description, headingLevel = "h2", retryAction, }: HousekeepingPageStateProps) { const isAlert = ALERT_STATES.has(state); const isPartial = state === "partial"; const isWarning = isPartial || state === "conflict" || state === "dependency"; const isError = state === "error" || state === "forbidden"; const isSuccess = state === "success"; const Heading = headingLevel; return (
{isPartial ? (

{partialLabel}

) : null} {title}

{description}

{retryAction ?
{retryAction}
: null}
); }