import { useEffect, type ReactNode } from "react"; import { AnimatePresence, motion } from "framer-motion"; import { Trash, XCircle } from "./icons"; import { ActionButton } from "./primitives"; import { useFocusTrap } from "./hooks"; const EASE = [0.16, 1, 0.3, 1] as const; /* ------------------------------------------------------------------ */ /* StatusPill */ /* ------------------------------------------------------------------ */ export function StatusPill({ status }: { status: string }) { const positive = ["ready", "active", "running", "succeeded", "approved", "achieved", "done"].includes(status); const negative = ["error", "failed", "cancelled", "blocked", "rejected", "interrupted"].includes(status); const warning = ["auth_required", "degraded", "pending", "in_review", "todo", "queued", "not_installed"].includes(status); const checking = status === "detected"; const toneClass = positive ? "text-success" : negative ? "text-destructive" : warning ? "text-warning" : "text-muted-foreground"; const dotClass = positive ? "bg-success" : negative ? "bg-destructive" : warning ? "bg-warning" : "bg-[color:var(--muted-foreground)]"; const displayLabel = checking ? "checking" : status.replaceAll("_", " "); return ( {checking ? ( ) : ( )} {displayLabel} ); } /* ------------------------------------------------------------------ */ /* InlineNotice */ /* ------------------------------------------------------------------ */ export function InlineNotice({ message, tone = "danger", action, }: { message: string; tone?: "danger" | "success" | "warn"; action?: ReactNode; }) { const toneClass = tone === "success" ? "border-success bg-success-muted text-success" : tone === "warn" ? "border-warning bg-warning-muted text-warning" : "border-destructive bg-destructive-muted text-destructive"; const role = tone === "danger" || (tone === "warn" && action) ? "alert" : "status"; return (