import type { ComponentPropsWithRef, ReactNode } from "react"; import { Button } from "../../ui/button"; import { cn } from "../../lib/utils"; export type ApprovalViewProps = Omit, "onSubmit"> & { description: string; requester: ReactNode; args?: { key: string; value: string }[]; detail: string; detailLabel?: string; count: number; disabled?: boolean; submitting?: boolean; error?: string; status?: string; actions?: ReactNode; denyLabel?: string; onApprove: () => void; onDeny: () => void; }; /** Present an approval while its owner controls authorization and submission. */ export function ApprovalView( { description, requester, args = [], detail, detailLabel = "Details", count, disabled = false, submitting = false, error, status, actions, denyLabel = "No", onApprove, onDeny, className, ...props }: ApprovalViewProps, ) { let extra = count > 1 ? count - 1 : 0; return (

{description}

Requested by {requester} {extra > 0 && ` · ${extra} more pending`}

{args.length > 0 && (
{args.map(arg => (
{arg.key}
{arg.value}
))}
)}
{detailLabel}
					{detail}
				
{(error || status) && (

{error || status}

)}
{actions}
); }