import { useState } from "react"; import { Pencil, Trash } from "@phosphor-icons/react"; import type { AgentRecord, GoalRecord } from "@shared/types"; import { ActionButton, Input, Select, TextArea } from "../ui"; import { ConfirmDelete } from "./helpers"; export function GoalEditor({ goal, goals, agents, companyId, onSaved, onDeleted, }: { goal: GoalRecord; goals: GoalRecord[]; agents: AgentRecord[]; companyId: string; onSaved: () => Promise; onDeleted: () => Promise; }) { const [title, setTitle] = useState(goal.title); const [description, setDescription] = useState(goal.description); const [status, setStatus] = useState(goal.status); const [parentId, setParentId] = useState(goal.parentId ?? ""); const [ownerAgentId, setOwnerAgentId] = useState(goal.ownerAgentId ?? ""); const [confirmingDelete, setConfirmingDelete] = useState(false); const parentCandidates = goals.filter((g) => g.id !== goal.id); return (