-
- Create Notion Page
+ {/* Header */}
+
+
+
+ {decided === "reject"
+ ? "Notion Page Rejected"
+ : decided === "approve" || decided === "edit"
+ ? "Notion Page Approved"
+ : "Create Notion Page"}
-
- {isEditing ? "You can edit the arguments below" : "Requires your approval to proceed"}
+
+ {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"}
-
-
- {/* Context section - account and parent page selection */}
- {!decided && interruptData.context && (
-
- {interruptData.context.error ? (
-
{interruptData.context.error}
- ) : (
- <>
- {accounts.length > 0 && (
-
-
- Notion Account *
-
-
{
- setSelectedAccountId(value);
- setSelectedParentPageId("__none__");
- }}
- >
-
-
-
-
- {accounts.map((account) => (
-
- {account.workspace_name}
-
- ))}
-
-
-
- )}
-
- {selectedAccountId && (
-
-
- Parent Page (optional)
-
-
-
-
-
-
- None
- {availableParentPages.map((page) => (
-
- 📄 {page.title}
-
- ))}
-
-
- {availableParentPages.length === 0 && selectedAccountId && (
-
- No pages available. Page will be created at workspace root.
-
- )}
-
- )}
- >
- )}
-
- )}
-
- {/* Display mode - show args as read-only */}
- {!isEditing && (
-
- {args.title != null && (
-
-
Title
-
{String(args.title)}
-
- )}
- {args.content != null && (
-
-
Content
-
- {String(args.content)}
-
-
- )}
-
- )}
-
- {/* Edit mode - show editable form fields */}
- {isEditing && !decided && (
-
-
-
- Title *
-
-
setEditedArgs({ ...editedArgs, title: e.target.value })}
- placeholder="Enter page title"
- className={!isTitleValid ? "border-destructive" : ""}
- />
- {!isTitleValid && (
-
Title is required and cannot be empty
- )}
-
-
-
- Content
-
-
-
- )}
-
- {/* Action buttons */}
-
- {decided ? (
-
- {decided === "approve" || decided === "edit" ? (
- <>
-
- {decided === "edit" ? "Approved with Changes" : "Approved"}
- >
- ) : (
- <>
-
- Rejected
- >
- )}
-
- ) : isEditing ? (
- <>
-
{
- setDecided("edit");
- setIsEditing(false);
- onDecision({
- type: "edit",
- edited_action: {
- name: interruptData.action_requests[0].name,
- args: {
- ...editedArgs,
- connector_id: selectedAccountId ? Number(selectedAccountId) : null,
- parent_page_id:
- selectedParentPageId === "__none__" ? null : selectedParentPageId,
- },
- },
- });
- }}
- disabled={!selectedAccountId || !isTitleValid}
- >
-
- Approve with Changes
-
-
{
- setIsEditing(false);
- setEditedArgs(args); // Reset to original args
- }}
- >
- Cancel
-
- >
- ) : (
- <>
- {allowedDecisions.includes("approve") && (
-
{
- setDecided("approve");
+ {!decided && canEdit && (
+ {
+ setIsPanelOpen(true);
+ openHitlEditPanel({
+ title: String(args.title ?? ""),
+ content: String(args.content ?? ""),
+ toolName: "Notion Page",
+ onSave: (newTitle, newContent) => {
+ setIsPanelOpen(false);
+ setDecided("edit");
onDecision({
- type: "approve",
+ type: "edit",
edited_action: {
name: interruptData.action_requests[0].name,
args: {
...args,
+ title: newTitle,
+ content: newContent,
connector_id: selectedAccountId ? Number(selectedAccountId) : null,
parent_page_id:
selectedParentPageId === "__none__" ? null : selectedParentPageId,
},
},
});
- }}
+ },
+ });
+ }}
+ >
+
+ Edit
+
+ )}
+
+
+ {/* Context section */}
+ {!decided && interruptData.context && (
+ <>
+
+
+ {interruptData.context.error ? (
+
{interruptData.context.error}
+ ) : (
+ <>
+ {accounts.length > 0 && (
+
+
+ Notion Account *
+
+
{
+ setSelectedAccountId(value);
+ setSelectedParentPageId("__none__");
+ }}
+ >
+
+
+
+
+ {accounts.map((account) => (
+
+ {account.workspace_name}
+
+ ))}
+
+
+
+ )}
+
+ {selectedAccountId && (
+
+
+ Parent Page (optional)
+
+
+
+
+
+
+ None
+ {availableParentPages.map((page) => (
+
+ 📄 {page.title}
+
+ ))}
+
+
+ {availableParentPages.length === 0 && selectedAccountId && (
+
+ No pages available. Page will be created at workspace root.
+
+ )}
+
+ )}
+ >
+ )}
+
+ >
+ )}
+
+ {/* Content preview */}
+
+
+ {args.title != null && (
+
+
Title
+
{String(args.title)}
+
+ )}
+ {args.content != null && (
+
+ )}
+
+
+ {/* Action buttons - only shown when pending */}
+ {!decided && (
+ <>
+
+
+ {allowedDecisions.includes("approve") && (
+
-
Approve
-
- )}
- {canEdit && (
-
setIsEditing(true)}>
-
- Edit
+
)}
{allowedDecisions.includes("reject") && (
{
setDecided("reject");
onDecision({ type: "reject", message: "User rejected the action." });
}}
>
-
Reject
)}
- >
- )}
-
+