refactor(execution): split ApprovalInspector 346-line god-component

Decompose monolithic src/renderer/components/execution/ApprovalInspector.tsx
into src/renderer/components/execution/approval-inspector/:
- ApprovalInspector.tsx (168 lines, orchestrator only)
- ApprovalSummary.tsx, ProposedHireCard.tsx, ApprovalDocumentsPanel.tsx
- DeliverableReviewPanel.tsx, SchedulePicker.tsx, DecisionForm.tsx
- TypeBadge.tsx, useApprovalPayload.ts, index.ts (barrel)

Hoist JSON.parse out of JSX IIFE into useApprovalPayload hook with typed
return. Replace roll-your-own role=radio spans with native
input[type=radio]. Extract getTypeBadgeClass switch into TypeBadge
component. Update execution.tsx barrel to re-export from new path.

Business logic preserved: approval decision flow, schedule validation,
deliverable review, document editing, delete confirmation.
This commit is contained in:
ZacharyZhang-NY committed 2026-04-16 22:06:39 -04:00
1 parent cc02b45864
commit 0f1b313272
12 files changed
+763 -347

No files matched your search

@@ -0,0 +1,52 @@
import { Briefcase, Robot } from "@phosphor-icons/react"
import type { AgentRecord, ApprovalRecord, TaskRecord } from "@shared/types"
import { formatTime } from "../../../lib/formatters"
import { StatusPill } from "../../ui"
import { TypeBadge } from "./TypeBadge"
export function ApprovalSummary({
approval,
requestingAgent,
relatedTask,
}: {
approval: ApprovalRecord
requestingAgent: AgentRecord | null
relatedTask: TaskRecord | null
}) {
return (
<>
<div className="flex items-center gap-3">
<TypeBadge type={approval.type} />
<StatusPill status={approval.state} />
</div>
<div className="text-[13px] font-medium text-foreground">{approval.payloadSummary}</div>
{approval.impactSummary ? (
<div className="text-[13px] text-muted-foreground">{approval.impactSummary}</div>
) : null}
<div className="grid gap-2 text-[13px] md:grid-cols-2">
<div className="flex items-center gap-2 text-muted-foreground">
<Robot size={14} />
Requested by:{" "}
<span className="font-medium text-foreground">{requestingAgent?.name ?? "Unknown"}</span>
{requestingAgent?.role ? (
<span className="text-[10px] text-muted-foreground">({requestingAgent.role})</span>
) : null}
</div>
{relatedTask ? (
<div className="flex items-center gap-2 text-muted-foreground">
<Briefcase size={14} />
Task: <span className="font-medium text-foreground">{relatedTask.title}</span>
</div>
) : null}
<div className="text-muted-foreground">
Created: <span className="font-mono text-foreground">{formatTime(approval.createdAt)}</span>
</div>
{approval.updatedAt !== approval.createdAt ? (
<div className="text-muted-foreground">
Updated: <span className="font-mono text-foreground">{formatTime(approval.updatedAt)}</span>
</div>
) : null}
</div>
</>
)
}