import type { ReactNode } from "react"; import { cn } from "@/lib/utils"; import { PauseCircle, PlayCircle, Repeat, XCircle } from "lucide-react"; import { Button } from "./ui/button"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "./ui/dialog"; /** Shared by the task header and its Storybook composition. */ export function TaskTreeControlMenuItems({ scope, canPause, canResume, canCancel, canRestore, pending, onPause, onResume, onCancel, onRestore, }: { scope: "leaf" | "subtree"; canPause: boolean; canResume: boolean; canCancel: boolean; canRestore: boolean; pending?: boolean; onPause: () => void; onResume: () => void; onCancel: () => void; onRestore: () => void; }) { const itemClass = "flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-accent/50 disabled:opacity-50 disabled:pointer-events-none"; return ( <> {canPause ? ( ) : null} {canResume ? ( ) : null} {canCancel ? ( ) : null} {canRestore ? ( ) : null} > ); } export function TaskTreeControlDialog({ open, onOpenChange, mode, scope, affectedCount, affectedAgentCount, loading, error, pending, valid, wakeAgents, onWakeAgentsChange, onRetry, onApply, }: { open: boolean; onOpenChange: (open: boolean) => void; mode: "resume" | "cancel" | "restore"; scope: "leaf" | "subtree"; affectedCount: number; affectedAgentCount: number; loading: boolean; error?: string | null; pending: boolean; valid: boolean; wakeAgents: boolean; onWakeAgentsChange: (wake: boolean) => void; onRetry: () => void; onApply: () => void; }) { const cancel = mode === "cancel"; const tasks = `${affectedCount} task${affectedCount === 1 ? "" : "s"}`; const title = cancel ? "Cancel subtree?" : mode === "restore" ? "Restore subtree" : scope === "leaf" ? "Resume work" : "Resume subtree"; return ( ); } /** Quiet, persistent pause feedback shared by the task page and previews. */ export function TaskPauseNotice({ scope, onResume, pending, className, resumeLink, }: { scope: "leaf" | "subtree"; onResume?: () => void; pending?: boolean; className?: string; resumeLink?: ReactNode; }) { return (