diff --git a/src/renderer/components/execution.tsx b/src/renderer/components/execution.tsx index f613a716..f56aa33d 100644 --- a/src/renderer/components/execution.tsx +++ b/src/renderer/components/execution.tsx @@ -3,7 +3,7 @@ export { TaskQueue } from "./execution/TaskQueue" export { TaskInspector } from "./execution/TaskInspector" export { TaskCreator } from "./execution/TaskCreator" export { ApprovalList } from "./execution/ApprovalList" -export { ApprovalInspector } from "./execution/ApprovalInspector" +export { ApprovalInspector } from "./execution/approval-inspector" export { ActivityList } from "./execution/ActivityList" export { CostList } from "./execution/CostList" export { BudgetSummary } from "./execution/BudgetSummary" diff --git a/src/renderer/components/execution/ApprovalInspector.tsx b/src/renderer/components/execution/ApprovalInspector.tsx deleted file mode 100644 index 713ce2fc..00000000 --- a/src/renderer/components/execution/ApprovalInspector.tsx +++ /dev/null @@ -1,346 +0,0 @@ -import { useMemo, useState } from "react" -import { Briefcase, CheckCircle, Clock, ClockCounterClockwise, Robot, Trash, XCircle } from "@phosphor-icons/react" -import { CaretDown, CaretUp } from "@phosphor-icons/react" -import type { AgentRecord, ApprovalRecord, DocumentRecord, TaskRecord } from "@shared/types" -import { extractApprovalDocumentReferences, type ApprovalDocumentReference } from "@shared/approval-documents" -import { useT } from "../../i18n" -import { formatMoney, formatTime } from "../../lib/formatters" -import { unwrap } from "../../lib/desktop" -import { ActionButton, ConfirmDialog, InlineNotice, Input, StatusPill, TextArea } from "../ui" -import { describeActionError, parseApprovalPayloadJson } from "./execution-utils" -import { SocialDraftPreview } from "./SocialDraftPreview" -import { useAppStore } from "../../state/store" - -function getTypeBadgeClass(type: string): string { - if (type === "hire_agent") return "bg-accent text-primary" - if (type === "approve_ceo_strategy") return "bg-warning-muted text-warning" - if (type === "secret_access") return "bg-destructive-muted text-destructive" - if (type === "social_post") return "bg-accent text-primary" - if (type === "deliverable_review") return "bg-accent text-primary" - return "bg-muted text-muted-foreground" -} - -function ApprovalDocumentEditor({ - companyId, - document, - fallback, -}: { - companyId: string - document: DocumentRecord - fallback?: ApprovalDocumentReference -}) { - const addToast = useAppStore((s) => s.addToast) - const [title, setTitle] = useState(document.title) - const [content, setContent] = useState(document.content ?? "") - const [saving, setSaving] = useState(false) - const [saveError, setSaveError] = useState(null) - - async function handleSave() { - if (!title.trim()) { - setSaveError("Document title is required.") - return - } - setSaving(true) - setSaveError(null) - try { - unwrap(await window.agentCompany.saveDocument({ - id: document.id, - companyId, - type: document.type, - title: title.trim(), - content, - authorAgentId: document.authorAgentId ?? null, - reviewerAgentId: document.reviewerAgentId ?? null, - projectId: document.projectId ?? null, - goalId: document.goalId ?? null, - parentDocId: document.parentDocId ?? null, - version: document.version, - status: document.status, - tagsJson: document.tagsJson, - })) - addToast(`Saved document: ${title.trim()}`, "success") - } catch (error) { - setSaveError(describeActionError(error)) - } finally { - setSaving(false) - } - } - - return ( -
-
-
-
{fallback?.title ?? document.title}
-
{(fallback?.type ?? document.type).replaceAll("_", " ")} · v{document.version} · {document.status}
-
- void handleSave()} loading={saving} /> -
- {saveError ? : null} - -