import { useTranslation } from "react-i18next"; import { ChevronDown, ChevronUp, Trash2 } from "lucide-react"; import { Button } from "@/components/button"; import { Input } from "@/components/input"; import { Label } from "@/components/label"; import { Textarea } from "@/components/textarea"; import { Switch } from "@/components/switch"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/select"; import type { Step, StepType } from "@/types/automations"; import { HostSelectorField } from "./HostSelectorField"; import type { AutomationEditorOptions } from "./editor-types"; const STEP_TYPES: StepType[] = [ "notify", "http", "run_command", "run_snippet", "docker", "tunnel", "wol", "wait", "set_var", "if", "stop", ]; interface StepBlockProps { step: Step; index: number; total: number; depth: number; options: AutomationEditorOptions; onChange: (next: Step) => void; onRemove: () => void; onMove: (direction: -1 | 1) => void; renderNested: ( steps: Step[], onChange: (next: Step[]) => void, depth: number, ) => React.ReactNode; } /** * One block in the automation's step list. Each step type renders only the * fields it actually uses, so the form stays readable as more types are added. */ export function StepBlock({ step, index, total, depth, options, onChange, onRemove, onMove, renderNested, }: StepBlockProps) { const { t } = useTranslation(); const base = "newUi.sidebar.automations"; function patch(changes: Partial) { onChange({ ...step, ...changes } as Step); } return (
0 ? "border-l-2 border-l-primary/40" : ""}`} >
{step.type === "notify" && ( <> patch({ title: e.target.value } as Partial) } />