"use client"; /** * Editor header — flow name / description, status badge, dirty * indicator, and the action buttons (Save, Activate/Pause, Delete, * View runs, Back). * * Lifted out of flow-builder.tsx so the same header renders above * both views in FlowEditorShell. Without this, canvas users had no * way to save without toggling to list view. * * Reads everything from the editor context (`useFlowEditor`) so it * stays in sync with whichever view is mutating state, and routes * router navigation locally (back to /flows, View runs to * /flows/[id]/runs) — those don't belong in the hook. */ import { useRouter } from "next/navigation"; import { ArrowLeft, History, Loader2, PauseCircle, PlayCircle, Save, Trash2, Workflow, } from "lucide-react"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { cn } from "@/lib/utils"; import { useFlowEditor, type BuilderState, } from "./flow-editor-state"; export function EditorHeader() { const router = useRouter(); const { flow, state, setState, dirty, saving, activating, canActivate, save, setStatus, deleteFlow, } = useFlowEditor(); return (