Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

ComposerPendingApprovalActions.tsx

55 lines1.4 KB

1import { type ApprovalRequestId, type ProviderApprovalDecision } from "@t3tools/contracts";
2import { memo } from "react";
3import { Button } from "../ui/button";
4​
5interface ComposerPendingApprovalActionsProps {
6 requestId: ApprovalRequestId;
7 isResponding: boolean;
8 onRespondToApproval: (
9 requestId: ApprovalRequestId,
10 decision: ProviderApprovalDecision,
11 ) => Promise<unknown>;
13​
14export const ComposerPendingApprovalActions = memo(function ComposerPendingApprovalActions({
15 requestId,
16 isResponding,
17 onRespondToApproval,
18}: ComposerPendingApprovalActionsProps) {
19 return (
20 <>
21 <Button
22 size="sm"
23 variant="ghost"
24 disabled={isResponding}
25 onClick={() => void onRespondToApproval(requestId, "cancel")}
26 >
27 Cancel turn
28 </Button>
29 <Button
30 size="sm"
31 variant="destructive-outline"
32 disabled={isResponding}
33 onClick={() => void onRespondToApproval(requestId, "decline")}
34 >
35 Decline
36 </Button>
37 <Button
38 size="sm"
39 variant="outline"
40 disabled={isResponding}
41 onClick={() => void onRespondToApproval(requestId, "acceptForSession")}
42 >
43 Always allow this session
44 </Button>
45 <Button
46 size="sm"
47 variant="default"
48 disabled={isResponding}
49 onClick={() => void onRespondToApproval(requestId, "accept")}
50 >
51 Approve once
52 </Button>
53 </>
54 );
55});