From 8243f58ef7d888d4769742b1b6e1709a5badde5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Thu, 16 Apr 2026 22:02:29 -0400 Subject: [PATCH] refactor(automation): use Modal/ConfirmDialog for DeleteConfirmDialog --- .../components/automation/AutomationPanel.tsx | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/renderer/components/automation/AutomationPanel.tsx b/src/renderer/components/automation/AutomationPanel.tsx index 78308494..c623e058 100644 --- a/src/renderer/components/automation/AutomationPanel.tsx +++ b/src/renderer/components/automation/AutomationPanel.tsx @@ -1,8 +1,8 @@ import { useCallback, useEffect, useMemo, useState } from "react" import { AnimatePresence, motion } from "framer-motion" -import { ArrowRight, ArrowsClockwise, Lightning, Plus, Robot, Trash, X } from "@phosphor-icons/react" +import { ArrowRight, ArrowsClockwise, Lightning, Plus, Robot, X } from "@phosphor-icons/react" import type { AutomationAction, AutomationRuleRecord, AutomationStatus, AutomationTrigger, WorkflowPipelineRecord } from "@shared/types" -import { ActionButton } from "../ui" +import { ActionButton, ConfirmDialog } from "../ui" import { useT } from "../../i18n" import { ACCENT, LINE, triggerConfig, actionConfig, type AutomationLogEntry } from "./automation-config" import { timeAgo } from "../../lib/formatters" @@ -11,19 +11,6 @@ import { RuleFormModal } from "./RuleEditor" import { WorkflowCard } from "./WorkflowList" import { WorkflowFormModal } from "./WorkflowEditor" -function DeleteConfirmDialog({ open, entityName, onConfirm, onCancel }: { open: boolean; entityName: string; onConfirm: () => void; onCancel: () => void }) { - if (!open) return null - return ( - - e.stopPropagation()}> -

Delete

-

Are you sure you want to delete {entityName}? This action cannot be undone.

-
-
-
- ) -} - function AutomationActivityLog({ entries }: { entries: AutomationLogEntry[] }) { if (entries.length === 0) return
No activity yet
return ( @@ -58,7 +45,7 @@ function RulesPanel({ rules, companyId, onRefresh }: { rules: AutomationRuleReco :
{filtered.map((r) => void handleToggle(r)} onDelete={() => setDelTarget(r)} onEdit={() => setEditRule(r)} />)}
} : } {showCreate ? setShowCreate(false)} onSaved={onRefresh} /> : null}{editRule ? setEditRule(null)} onSaved={onRefresh} /> : null} - {delTarget ? void handleDelete()} onCancel={() => setDelTarget(null)} /> : null} + void handleDelete()} onCancel={() => setDelTarget(null)} /> ) } @@ -76,7 +63,7 @@ function WorkflowsPanel({ workflows, companyId, onRefresh }: { workflows: Workfl {workflows.length === 0 ?
No workflow pipelines
Workflows chain actions into multi-step pipelines.
setShowCreate(true)} icon={ArrowsClockwise} tone="accent" />
:
{workflows.map((wf) => setDelTarget(wf)} onEdit={() => setEditWf(wf)} onRun={() => void handleRun(wf)} />)}
} {showCreate ? setShowCreate(false)} onSaved={onRefresh} /> : null}{editWf ? setEditWf(null)} onSaved={onRefresh} /> : null} - {delTarget ? void handleDelete()} onCancel={() => setDelTarget(null)} /> : null} + void handleDelete()} onCancel={() => setDelTarget(null)} /> ) }