feat: add onClose functionality to ApprovalCard across all HITL tools

This commit is contained in:
Anish Sarkar 2026-03-20 23:50:50 +05:30
parent 85462675a0
commit ab6eeaf02e
11 changed files with 36 additions and 6 deletions

View file

@ -228,6 +228,7 @@ function ApprovalCard({
setIsPanelOpen(false);
setPendingEdits({ title: newTitle, content: newContent });
},
onClose: () => setIsPanelOpen(false),
});
}}
>
@ -346,7 +347,7 @@ function ApprovalCard({
size="sm"
className="rounded-lg gap-1.5"
onClick={handleApprove}
disabled={!selectedAccountId || !isTitleValid}
disabled={!selectedAccountId || !isTitleValid || isPanelOpen}
>
Approve
<CornerDownLeftIcon className="size-3 opacity-60" />
@ -357,6 +358,7 @@ function ApprovalCard({
size="sm"
variant="ghost"
className="rounded-lg text-muted-foreground"
disabled={isPanelOpen}
onClick={() => {
setDecided("reject");
onDecision({ type: "reject", message: "User rejected the action." });

View file

@ -203,6 +203,7 @@ function ApprovalCard({
setIsPanelOpen(false);
setPendingEdits({ content: newContent });
},
onClose: () => setIsPanelOpen(false),
});
}}
>
@ -278,6 +279,7 @@ function ApprovalCard({
size="sm"
className="rounded-lg gap-1.5"
onClick={handleApprove}
disabled={isPanelOpen}
>
Approve
<CornerDownLeftIcon className="size-3 opacity-60" />
@ -288,6 +290,7 @@ function ApprovalCard({
size="sm"
variant="ghost"
className="rounded-lg text-muted-foreground"
disabled={isPanelOpen}
onClick={() => {
setDecided("reject");
onDecision({ type: "reject", message: "User rejected the action." });