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

ComposerPendingApprovalPanel.tsx

49 lines1.7 KB

1import { memo } from "react";
2import { type PendingApproval } from "../../session-logic";
3​
4interface ComposerPendingApprovalPanelProps {
5 approval: PendingApproval;
6 pendingCount: number;
7}
8​
9export const ComposerPendingApprovalPanel = memo(function ComposerPendingApprovalPanel({
10 approval,
11 pendingCount,
12}: ComposerPendingApprovalPanelProps) {
13 const approvalSummary =
14 approval.requestKind === "command"
15 ? "Command approval requested"
16 : approval.requestKind === "file-read"
17 ? "File-read approval requested"
18 : "File-change approval requested";
19 const detailLabel =
20 approval.requestKind === "command"
21 ? "Command"
22 : approval.requestKind === "file-read"
23 ? "File to read"
24 : "File change";
25​
26 return (
27 <div className="min-w-0 px-4 py-3.5 sm:px-5 sm:py-4">
28 <div className="flex flex-wrap items-center gap-2">
29 <span className="uppercase text-sm tracking-[0.2em]">PENDING APPROVAL</span>
30 <span className="text-sm font-medium">{approvalSummary}</span>
31 {pendingCount > 1 ? (
32 <span className="text-xs text-muted-foreground">1/{pendingCount}</span>
33 ) : null}
34 </div>
35 {approval.detail ? (
36 <div className="mt-3 min-w-0 max-w-full rounded-lg border border-border/65 bg-background/70 p-3">
37 <p className="text-xs font-medium text-muted-foreground">{detailLabel}</p>
38 <pre
39 aria-label={detailLabel}
40 className="mt-2 min-w-0 max-w-full max-h-40 overflow-auto whitespace-pre-wrap [overflow-wrap:anywhere] font-mono text-xs leading-relaxed text-foreground"
41 data-approval-detail="complete"
42 >
43 {approval.detail}
44 </pre>
45 </div>
46 ) : null}
47 </div>
48 );
49});