diff --git a/surfsense_web/components/tool-ui/gmail/create-draft.tsx b/surfsense_web/components/tool-ui/gmail/create-draft.tsx
index 4f1181039..2f7b72009 100644
--- a/surfsense_web/components/tool-ui/gmail/create-draft.tsx
+++ b/surfsense_web/components/tool-ui/gmail/create-draft.tsx
@@ -129,6 +129,7 @@ function ApprovalCard({
const [decided, setDecided] = useState<"approve" | "reject" | "edit" | null>(
interruptData.__decided__ ?? null
);
+ const wasAlreadyDecided = interruptData.__decided__ != null;
const [isPanelOpen, setIsPanelOpen] = useState(false);
const openHitlEditPanel = useSetAtom(openHitlEditPanelAtom);
@@ -175,8 +176,6 @@ function ApprovalCard({
return () => window.removeEventListener("keydown", handler);
}, [handleApprove]);
- if (decided && decided !== "reject") return null;
-
return (
{/* Header */}
@@ -190,15 +189,21 @@ function ApprovalCard({
? "Gmail Draft Approved"
: "Create Gmail Draft"}
-
- {decided === "reject"
- ? "Draft creation was cancelled"
- : decided === "edit"
- ? "Draft creation is in progress with your changes"
- : decided === "approve"
- ? "Draft creation is in progress"
- : "Requires your approval to proceed"}
-
+ {decided === "approve" || decided === "edit" ? (
+ wasAlreadyDecided ? (
+
+ {decided === "edit" ? "Draft created with your changes" : "Draft created"}
+
+ ) : (
+
+ )
+ ) : (
+
+ {decided === "reject"
+ ? "Draft creation was cancelled"
+ : "Requires your approval to proceed"}
+
+ )}
{!decided && canEdit && (
@@ -436,15 +441,7 @@ export const CreateGmailDraftToolUI = makeAssistantToolUI<
CreateGmailDraftResult
>({
toolName: "create_gmail_draft",
- render: function CreateGmailDraftUI({ args, result, status }) {
- if (status.type === "running") {
- return (
-
-
-
- );
- }
-
+ render: function CreateGmailDraftUI({ args, result, status: _status }) {
if (!result) return null;
if (isInterruptResult(result)) {
diff --git a/surfsense_web/components/tool-ui/gmail/send-email.tsx b/surfsense_web/components/tool-ui/gmail/send-email.tsx
index 5414fdb71..8e23d23ae 100644
--- a/surfsense_web/components/tool-ui/gmail/send-email.tsx
+++ b/surfsense_web/components/tool-ui/gmail/send-email.tsx
@@ -130,6 +130,7 @@ function ApprovalCard({
const [decided, setDecided] = useState<"approve" | "reject" | "edit" | null>(
interruptData.__decided__ ?? null
);
+ const wasAlreadyDecided = interruptData.__decided__ != null;
const [isPanelOpen, setIsPanelOpen] = useState(false);
const openHitlEditPanel = useSetAtom(openHitlEditPanelAtom);
@@ -176,8 +177,6 @@ function ApprovalCard({
return () => window.removeEventListener("keydown", handler);
}, [handleApprove]);
- if (decided && decided !== "reject") return null;
-
return (
{/* Header */}
@@ -192,15 +191,21 @@ function ApprovalCard({
? "Email Sending Approved"
: "Send Email"}
-
- {decided === "reject"
- ? "Email sending was cancelled"
- : decided === "edit"
- ? "Email is being sent with your changes"
- : decided === "approve"
- ? "Email is being sent"
- : "This will send the email immediately"}
-
+ {decided === "approve" || decided === "edit" ? (
+ wasAlreadyDecided ? (
+
+ {decided === "edit" ? "Email sent with your changes" : "Email sent"}
+
+ ) : (
+
+ )
+ ) : (
+
+ {decided === "reject"
+ ? "Email sending was cancelled"
+ : "Requires your approval to proceed"}
+
+ )}
{!decided && canEdit && (
@@ -439,15 +444,7 @@ export const SendGmailEmailToolUI = makeAssistantToolUI<
SendGmailEmailResult
>({
toolName: "send_gmail_email",
- render: function SendGmailEmailUI({ args, result, status }) {
- if (status.type === "running") {
- return (
-
-
-
- );
- }
-
+ render: function SendGmailEmailUI({ args, result, status: _status }) {
if (!result) return null;
if (isInterruptResult(result)) {
diff --git a/surfsense_web/components/tool-ui/gmail/trash-email.tsx b/surfsense_web/components/tool-ui/gmail/trash-email.tsx
index 2becf5dcc..6a7af5c59 100644
--- a/surfsense_web/components/tool-ui/gmail/trash-email.tsx
+++ b/surfsense_web/components/tool-ui/gmail/trash-email.tsx
@@ -149,6 +149,7 @@ function ApprovalCard({
const [decided, setDecided] = useState<"approve" | "reject" | null>(
interruptData.__decided__ ?? null
);
+ const wasAlreadyDecided = interruptData.__decided__ != null;
const [deleteFromKb, setDeleteFromKb] = useState(false);
const account = interruptData.context?.account;
@@ -180,8 +181,6 @@ function ApprovalCard({
return () => window.removeEventListener("keydown", handler);
}, [handleApprove]);
- if (decided && decided !== "reject") return null;
-
return (
{/* Header */}
@@ -196,13 +195,19 @@ function ApprovalCard({
? "Email Trash Approved"
: "Trash Email"}
-
- {decided === "reject"
- ? "Email trash was cancelled"
- : decided === "approve"
- ? "Email is being trashed"
+ {decided === "approve" ? (
+ wasAlreadyDecided ? (
+
Email trashed
+ ) : (
+
+ )
+ ) : (
+
+ {decided === "reject"
+ ? "Email trash was cancelled"
: "Requires your approval to proceed"}
-
+
+ )}
@@ -396,15 +401,7 @@ export const TrashGmailEmailToolUI = makeAssistantToolUI<
TrashGmailEmailResult
>({
toolName: "trash_gmail_email",
- render: function TrashGmailEmailUI({ result, status }) {
- if (status.type === "running") {
- return (
-
-
-
- );
- }
-
+ render: function TrashGmailEmailUI({ result, status: _status }) {
if (!result) return null;
if (isInterruptResult(result)) {
diff --git a/surfsense_web/components/tool-ui/google-calendar/create-event.tsx b/surfsense_web/components/tool-ui/google-calendar/create-event.tsx
index fcf8f804f..b14e27fa3 100644
--- a/surfsense_web/components/tool-ui/google-calendar/create-event.tsx
+++ b/surfsense_web/components/tool-ui/google-calendar/create-event.tsx
@@ -157,6 +157,7 @@ function ApprovalCard({
const [decided, setDecided] = useState<"approve" | "reject" | "edit" | null>(
interruptData.__decided__ ?? null
);
+ const wasAlreadyDecided = interruptData.__decided__ != null;
const [isPanelOpen, setIsPanelOpen] = useState(false);
const openHitlEditPanel = useSetAtom(openHitlEditPanelAtom);
@@ -217,8 +218,6 @@ function ApprovalCard({
return () => window.removeEventListener("keydown", handler);
}, [handleApprove]);
- if (decided && decided !== "reject") return null;
-
const attendeesList = (args.attendees as string[]) ?? [];
return (
@@ -235,15 +234,21 @@ function ApprovalCard({
? "Calendar Event Approved"
: "Create Calendar Event"}
-
- {decided === "reject"
- ? "Event creation was cancelled"
- : decided === "edit"
- ? "Event creation is in progress with your changes"
- : decided === "approve"
- ? "Event creation is in progress"
- : "Requires your approval to proceed"}
-
+ {decided === "approve" || decided === "edit" ? (
+ wasAlreadyDecided ? (
+
+ {decided === "edit" ? "Event created with your changes" : "Event created"}
+
+ ) : (
+
+ )
+ ) : (
+
+ {decided === "reject"
+ ? "Event creation was cancelled"
+ : "Requires your approval to proceed"}
+
+ )}
{!decided && canEdit && (
@@ -549,15 +554,7 @@ export const CreateCalendarEventToolUI = makeAssistantToolUI<
CreateCalendarEventResult
>({
toolName: "create_calendar_event",
- render: function CreateCalendarEventUI({ args, result, status }) {
- if (status.type === "running") {
- return (
-
-
-
- );
- }
-
+ render: function CreateCalendarEventUI({ args, result }) {
if (!result) return null;
if (isInterruptResult(result)) {
diff --git a/surfsense_web/components/tool-ui/google-calendar/delete-event.tsx b/surfsense_web/components/tool-ui/google-calendar/delete-event.tsx
index ce7b9ec8f..c5c10fed0 100644
--- a/surfsense_web/components/tool-ui/google-calendar/delete-event.tsx
+++ b/surfsense_web/components/tool-ui/google-calendar/delete-event.tsx
@@ -177,6 +177,7 @@ function ApprovalCard({
const [decided, setDecided] = useState<"approve" | "reject" | null>(
interruptData.__decided__ ?? null
);
+ const wasAlreadyDecided = interruptData.__decided__ != null;
const [deleteFromKb, setDeleteFromKb] = useState(false);
const context = interruptData.context;
@@ -209,8 +210,6 @@ function ApprovalCard({
return () => window.removeEventListener("keydown", handler);
}, [handleApprove]);
- if (decided && decided !== "reject") return null;
-
return (
{/* Header */}
@@ -225,13 +224,19 @@ function ApprovalCard({
? "Calendar Event Deletion Approved"
: "Delete Calendar Event"}
-
- {decided === "reject"
- ? "Event deletion was cancelled"
- : decided === "approve"
- ? "Event deletion is in progress"
+ {decided === "approve" ? (
+ wasAlreadyDecided ? (
+
Event deleted
+ ) : (
+
+ )
+ ) : (
+
+ {decided === "reject"
+ ? "Event deletion was cancelled"
: "Requires your approval to proceed"}
-
+
+ )}
@@ -447,15 +452,7 @@ export const DeleteCalendarEventToolUI = makeAssistantToolUI<
DeleteCalendarEventResult
>({
toolName: "delete_calendar_event",
- render: function DeleteCalendarEventUI({ result, status }) {
- if (status.type === "running") {
- return (
-
-
-
- );
- }
-
+ render: function DeleteCalendarEventUI({ result }) {
if (!result) return null;
if (isInterruptResult(result)) {
diff --git a/surfsense_web/components/tool-ui/google-calendar/update-event.tsx b/surfsense_web/components/tool-ui/google-calendar/update-event.tsx
index 5fc72f6f4..85eb4d661 100644
--- a/surfsense_web/components/tool-ui/google-calendar/update-event.tsx
+++ b/surfsense_web/components/tool-ui/google-calendar/update-event.tsx
@@ -168,6 +168,7 @@ function ApprovalCard({
const [decided, setDecided] = useState<"approve" | "reject" | "edit" | null>(
interruptData.__decided__ ?? null
);
+ const wasAlreadyDecided = interruptData.__decided__ != null;
const [isPanelOpen, setIsPanelOpen] = useState(false);
const openHitlEditPanel = useSetAtom(openHitlEditPanelAtom);
@@ -251,8 +252,6 @@ function ApprovalCard({
return () => window.removeEventListener("keydown", handler);
}, [handleApprove]);
- if (decided && decided !== "reject") return null;
-
return (
{/* Header */}
@@ -267,15 +266,21 @@ function ApprovalCard({
? "Calendar Event Update Approved"
: "Update Calendar Event"}
-
- {decided === "reject"
- ? "Event update was cancelled"
- : decided === "edit"
- ? "Event update is in progress with your changes"
- : decided === "approve"
- ? "Event update is in progress"
- : "Requires your approval to proceed"}
-
+ {decided === "approve" || decided === "edit" ? (
+ wasAlreadyDecided ? (
+
+ {decided === "edit" ? "Event updated with your changes" : "Event updated"}
+
+ ) : (
+
+ )
+ ) : (
+
+ {decided === "reject"
+ ? "Event update was cancelled"
+ : "Requires your approval to proceed"}
+
+ )}
{!decided && canEdit && (
@@ -592,15 +597,7 @@ export const UpdateCalendarEventToolUI = makeAssistantToolUI<
UpdateCalendarEventResult
>({
toolName: "update_calendar_event",
- render: function UpdateCalendarEventUI({ result, status }) {
- if (status.type === "running") {
- return (
-
-
-
- );
- }
-
+ render: function UpdateCalendarEventUI({ result }) {
if (!result) return null;
if (isInterruptResult(result)) {
diff --git a/surfsense_web/components/tool-ui/google-drive/create-file.tsx b/surfsense_web/components/tool-ui/google-drive/create-file.tsx
index aa2eb9eee..cca93ce17 100644
--- a/surfsense_web/components/tool-ui/google-drive/create-file.tsx
+++ b/surfsense_web/components/tool-ui/google-drive/create-file.tsx
@@ -134,6 +134,7 @@ function ApprovalCard({
const [decided, setDecided] = useState<"approve" | "reject" | "edit" | null>(
interruptData.__decided__ ?? null
);
+ const wasAlreadyDecided = interruptData.__decided__ != null;
const [isPanelOpen, setIsPanelOpen] = useState(false);
const openHitlEditPanel = useSetAtom(openHitlEditPanelAtom);
@@ -202,8 +203,6 @@ function ApprovalCard({
return () => window.removeEventListener("keydown", handler);
}, [handleApprove]);
- if (decided && decided !== "reject") return null;
-
return (
{/* Header */}
@@ -216,15 +215,21 @@ function ApprovalCard({
? `${fileTypeLabel} Approved`
: `Create ${fileTypeLabel}`}
-
- {decided === "reject"
- ? "File creation was cancelled"
- : decided === "edit"
- ? "File creation is in progress with your changes"
- : decided === "approve"
- ? "File creation is in progress"
- : "Requires your approval to proceed"}
-
+ {decided === "approve" || decided === "edit" ? (
+ wasAlreadyDecided ? (
+
+ {decided === "edit" ? "File created with your changes" : "File created"}
+
+ ) : (
+
+ )
+ ) : (
+
+ {decided === "reject"
+ ? "File creation was cancelled"
+ : "Requires your approval to proceed"}
+
+ )}
{!decided && canEdit && (
({
toolName: "create_google_drive_file",
- render: function CreateGoogleDriveFileUI({ args, result, status }) {
- if (status.type === "running") {
- return (
-
-
-
- );
- }
-
+ render: function CreateGoogleDriveFileUI({ args, result, status: _status }) {
if (!result) return null;
if (isInterruptResult(result)) {
diff --git a/surfsense_web/components/tool-ui/google-drive/trash-file.tsx b/surfsense_web/components/tool-ui/google-drive/trash-file.tsx
index f9fc4c266..1923a0f17 100644
--- a/surfsense_web/components/tool-ui/google-drive/trash-file.tsx
+++ b/surfsense_web/components/tool-ui/google-drive/trash-file.tsx
@@ -163,6 +163,7 @@ function ApprovalCard({
const [decided, setDecided] = useState<"approve" | "reject" | null>(
interruptData.__decided__ ?? null
);
+ const wasAlreadyDecided = interruptData.__decided__ != null;
const [deleteFromKb, setDeleteFromKb] = useState(false);
const account = interruptData.context?.account;
@@ -195,8 +196,6 @@ function ApprovalCard({
return () => window.removeEventListener("keydown", handler);
}, [handleApprove]);
- if (decided && decided !== "reject") return null;
-
return (
{/* Header */}
@@ -209,13 +208,19 @@ function ApprovalCard({
? "Google Drive File Deletion Approved"
: "Delete Google Drive File"}
-
- {decided === "reject"
- ? "File deletion was cancelled"
- : decided === "approve"
- ? "File deletion is in progress"
+ {decided === "approve" ? (
+ wasAlreadyDecided ? (
+
File trashed
+ ) : (
+
+ )
+ ) : (
+
+ {decided === "reject"
+ ? "File deletion was cancelled"
: "Requires your approval to proceed"}
-
+
+ )}
@@ -420,15 +425,7 @@ export const DeleteGoogleDriveFileToolUI = makeAssistantToolUI<
DeleteGoogleDriveFileResult
>({
toolName: "delete_google_drive_file",
- render: function DeleteGoogleDriveFileUI({ result, status }) {
- if (status.type === "running") {
- return (
-
-
-
- );
- }
-
+ render: function DeleteGoogleDriveFileUI({ result, status: _status }) {
if (!result) return null;
if (isInterruptResult(result)) {
diff --git a/surfsense_web/components/tool-ui/linear/create-linear-issue.tsx b/surfsense_web/components/tool-ui/linear/create-linear-issue.tsx
index 7914aa54e..22b826d80 100644
--- a/surfsense_web/components/tool-ui/linear/create-linear-issue.tsx
+++ b/surfsense_web/components/tool-ui/linear/create-linear-issue.tsx
@@ -146,6 +146,7 @@ function ApprovalCard({
const [decided, setDecided] = useState<"approve" | "reject" | "edit" | null>(
interruptData.__decided__ ?? null
);
+ const wasAlreadyDecided = interruptData.__decided__ != null;
const [isPanelOpen, setIsPanelOpen] = useState(false);
const openHitlEditPanel = useSetAtom(openHitlEditPanelAtom);
@@ -213,8 +214,6 @@ function ApprovalCard({
return () => window.removeEventListener("keydown", handler);
}, [handleApprove]);
- if (decided && decided !== "reject") return null;
-
return (
{/* Header */}
@@ -227,15 +226,21 @@ function ApprovalCard({
? "Linear Issue Approved"
: "Create Linear Issue"}
-
- {decided === "reject"
- ? "Issue creation was cancelled"
- : decided === "edit"
- ? "Issue creation is in progress with your changes"
- : decided === "approve"
- ? "Issue creation is in progress"
- : "Requires your approval to proceed"}
-
+ {decided === "approve" || decided === "edit" ? (
+ wasAlreadyDecided ? (
+
+ {decided === "edit" ? "Issue created with your changes" : "Issue created"}
+
+ ) : (
+
+ )
+ ) : (
+
+ {decided === "reject"
+ ? "Issue creation was cancelled"
+ : "Requires your approval to proceed"}
+
+ )}
{!decided && canEdit && (
({
toolName: "create_linear_issue",
- render: function CreateLinearIssueUI({ args, result, status }) {
- if (status.type === "running") {
- return (
-
-
-
- );
- }
-
+ render: function CreateLinearIssueUI({ args, result, status: _status }) {
if (!result) return null;
if (isInterruptResult(result)) {
diff --git a/surfsense_web/components/tool-ui/linear/delete-linear-issue.tsx b/surfsense_web/components/tool-ui/linear/delete-linear-issue.tsx
index bf6ae72e8..8e9037d66 100644
--- a/surfsense_web/components/tool-ui/linear/delete-linear-issue.tsx
+++ b/surfsense_web/components/tool-ui/linear/delete-linear-issue.tsx
@@ -135,6 +135,7 @@ function ApprovalCard({
const [decided, setDecided] = useState<"approve" | "reject" | null>(
interruptData.__decided__ ?? null
);
+ const wasAlreadyDecided = interruptData.__decided__ != null;
const [deleteFromKb, setDeleteFromKb] = useState(
typeof actionArgs.delete_from_kb === "boolean" ? actionArgs.delete_from_kb : false
);
@@ -165,8 +166,6 @@ function ApprovalCard({
return () => window.removeEventListener("keydown", handler);
}, [handleApprove]);
- if (decided && decided !== "reject") return null;
-
return (
{/* Header */}
@@ -179,13 +178,19 @@ function ApprovalCard({
? "Linear Issue Deletion Approved"
: "Delete Linear Issue"}
-
- {decided === "reject"
- ? "Issue deletion was cancelled"
- : decided === "approve"
- ? "Issue deletion is in progress"
+ {decided === "approve" ? (
+ wasAlreadyDecided ? (
+
Issue deleted
+ ) : (
+
+ )
+ ) : (
+
+ {decided === "reject"
+ ? "Issue deletion was cancelled"
: "Requires your approval to proceed"}
-
+
+ )}
@@ -367,15 +372,7 @@ export const DeleteLinearIssueToolUI = makeAssistantToolUI<
DeleteLinearIssueResult
>({
toolName: "delete_linear_issue",
- render: function DeleteLinearIssueUI({ result, status }) {
- if (status.type === "running") {
- return (
-
-
-
- );
- }
-
+ render: function DeleteLinearIssueUI({ result, status: _status }) {
if (!result) return null;
if (isInterruptResult(result)) {
diff --git a/surfsense_web/components/tool-ui/linear/update-linear-issue.tsx b/surfsense_web/components/tool-ui/linear/update-linear-issue.tsx
index e6bdafc7c..214127ca3 100644
--- a/surfsense_web/components/tool-ui/linear/update-linear-issue.tsx
+++ b/surfsense_web/components/tool-ui/linear/update-linear-issue.tsx
@@ -186,6 +186,7 @@ function ApprovalCard({
const [decided, setDecided] = useState<"approve" | "reject" | "edit" | null>(
interruptData.__decided__ ?? null
);
+ const wasAlreadyDecided = interruptData.__decided__ != null;
const [isPanelOpen, setIsPanelOpen] = useState(false);
const [editedArgs, setEditedArgs] = useState(initialEditState);
const openHitlEditPanel = useSetAtom(openHitlEditPanelAtom);
@@ -274,8 +275,6 @@ function ApprovalCard({
return () => window.removeEventListener("keydown", handler);
}, [handleApprove]);
- if (decided && decided !== "reject") return null;
-
return (
{/* Header */}
@@ -288,15 +287,21 @@ function ApprovalCard({
? "Linear Issue Update Approved"
: "Update Linear Issue"}
-
- {decided === "reject"
- ? "Issue update was cancelled"
- : decided === "edit"
- ? "Issue update is in progress with your changes"
- : decided === "approve"
- ? "Issue update is in progress"
- : "Requires your approval to proceed"}
-
+ {decided === "approve" || decided === "edit" ? (
+ wasAlreadyDecided ? (
+
+ {decided === "edit" ? "Issue updated with your changes" : "Issue updated"}
+
+ ) : (
+
+ )
+ ) : (
+
+ {decided === "reject"
+ ? "Issue update was cancelled"
+ : "Requires your approval to proceed"}
+
+ )}
{!decided && canEdit && (
({
toolName: "update_linear_issue",
- render: function UpdateLinearIssueUI({ result, status }) {
- if (status.type === "running") {
- return (
-
-
-
- );
- }
-
+ render: function UpdateLinearIssueUI({ result, status: _status }) {
if (!result) return null;
if (isInterruptResult(result)) {
diff --git a/surfsense_web/components/tool-ui/notion/create-notion-page.tsx b/surfsense_web/components/tool-ui/notion/create-notion-page.tsx
index bbecd05ab..1532a43e1 100644
--- a/surfsense_web/components/tool-ui/notion/create-notion-page.tsx
+++ b/surfsense_web/components/tool-ui/notion/create-notion-page.tsx
@@ -118,6 +118,7 @@ function ApprovalCard({
const [decided, setDecided] = useState<"approve" | "reject" | "edit" | null>(
interruptData.__decided__ ?? null
);
+ const wasAlreadyDecided = interruptData.__decided__ != null;
const [isPanelOpen, setIsPanelOpen] = useState(false);
const openHitlEditPanel = useSetAtom(openHitlEditPanelAtom);
@@ -178,8 +179,6 @@ function ApprovalCard({
return () => window.removeEventListener("keydown", handler);
}, [handleApprove]);
- if (decided && decided !== "reject") return null;
-
return (
-
- {decided === "reject"
- ? "Page creation was cancelled"
- : decided === "edit"
- ? "Page creation is in progress with your changes"
- : decided === "approve"
- ? "Page creation is in progress"
- : "Requires your approval to proceed"}
-
+ {decided === "approve" || decided === "edit" ? (
+ wasAlreadyDecided ? (
+
+ {decided === "edit" ? "Page created with your changes" : "Page created"}
+
+ ) : (
+
+ )
+ ) : (
+
+ {decided === "reject"
+ ? "Page creation was cancelled"
+ : "Requires your approval to proceed"}
+
+ )}
{!decided && canEdit && (
({
toolName: "create_notion_page",
- render: function CreateNotionPageUI({ args, result, status }) {
- if (status.type === "running") {
- return (
-
-
-
- );
- }
-
+ render: function CreateNotionPageUI({ args, result }) {
if (!result) {
return null;
}
diff --git a/surfsense_web/components/tool-ui/notion/delete-notion-page.tsx b/surfsense_web/components/tool-ui/notion/delete-notion-page.tsx
index 9db51c72a..461f4d070 100644
--- a/surfsense_web/components/tool-ui/notion/delete-notion-page.tsx
+++ b/surfsense_web/components/tool-ui/notion/delete-notion-page.tsx
@@ -139,6 +139,7 @@ function ApprovalCard({
const [decided, setDecided] = useState<"approve" | "reject" | null>(
interruptData.__decided__ ?? null
);
+ const wasAlreadyDecided = interruptData.__decided__ != null;
const [deleteFromKb, setDeleteFromKb] = useState(false);
const account = interruptData.context?.account;
@@ -170,8 +171,6 @@ function ApprovalCard({
return () => window.removeEventListener("keydown", handler);
}, [handleApprove]);
- if (decided && decided !== "reject") return null;
-
return (
{/* Header */}
@@ -184,13 +183,19 @@ function ApprovalCard({
? "Notion Page Deletion Approved"
: "Delete Notion Page"}
-
- {decided === "reject"
- ? "Page deletion was cancelled"
- : decided === "approve"
- ? "Page deletion is in progress"
+ {decided === "approve" ? (
+ wasAlreadyDecided ? (
+
Page deleted
+ ) : (
+
+ )
+ ) : (
+
+ {decided === "reject"
+ ? "Page deletion was cancelled"
: "Requires your approval to proceed"}
-
+
+ )}
@@ -216,7 +221,7 @@ function ApprovalCard({
Page to Delete
- 📄 {currentTitle}
+ {currentTitle}
)}
@@ -383,15 +388,7 @@ export const DeleteNotionPageToolUI = makeAssistantToolUI<
DeleteNotionPageResult
>({
toolName: "delete_notion_page",
- render: function DeleteNotionPageUI({ result, status }) {
- if (status.type === "running") {
- return (
-
-
-
- );
- }
-
+ render: function DeleteNotionPageUI({ result }) {
if (!result) {
return null;
}
diff --git a/surfsense_web/components/tool-ui/notion/update-notion-page.tsx b/surfsense_web/components/tool-ui/notion/update-notion-page.tsx
index 17bba9907..de1701099 100644
--- a/surfsense_web/components/tool-ui/notion/update-notion-page.tsx
+++ b/surfsense_web/components/tool-ui/notion/update-notion-page.tsx
@@ -120,6 +120,7 @@ function ApprovalCard({
const [decided, setDecided] = useState<"approve" | "reject" | "edit" | null>(
interruptData.__decided__ ?? null
);
+ const wasAlreadyDecided = interruptData.__decided__ != null;
const [isPanelOpen, setIsPanelOpen] = useState(false);
const openHitlEditPanel = useSetAtom(openHitlEditPanelAtom);
@@ -157,8 +158,6 @@ function ApprovalCard({
return () => window.removeEventListener("keydown", handler);
}, [handleApprove]);
- if (decided && decided !== "reject") return null;
-
return (
{/* Header */}
@@ -171,15 +170,21 @@ function ApprovalCard({
? "Notion Page Update Approved"
: "Update Notion Page"}
-
- {decided === "reject"
- ? "Page update was cancelled"
- : decided === "edit"
- ? "Page update is in progress with your changes"
- : decided === "approve"
- ? "Page update is in progress"
- : "Requires your approval to proceed"}
-
+ {decided === "approve" || decided === "edit" ? (
+ wasAlreadyDecided ? (
+
+ {decided === "edit" ? "Page updated with your changes" : "Page updated"}
+
+ ) : (
+
+ )
+ ) : (
+
+ {decided === "reject"
+ ? "Page update was cancelled"
+ : "Requires your approval to proceed"}
+
+ )}
{!decided && canEdit && (
Current Page
- 📄 {currentTitle}
+ {currentTitle}
)}
@@ -389,15 +394,7 @@ export const UpdateNotionPageToolUI = makeAssistantToolUI<
UpdateNotionPageResult
>({
toolName: "update_notion_page",
- render: function UpdateNotionPageUI({ args, result, status }) {
- if (status.type === "running") {
- return (
-
-
-
- );
- }
-
+ render: function UpdateNotionPageUI({ args, result }) {
if (!result) {
return null;
}