Open History to see the last commit
1import { memo } from "react";
2import { type PendingApproval } from "../../session-logic";
3import { cn } from "~/lib/utils";
4
5interface ComposerPendingApprovalPanelProps {
6 approval: PendingApproval;
7 pendingCount: number;
8 className?: string;
9}
10
11export const ComposerPendingApprovalPanel = memo(function ComposerPendingApprovalPanel({
12 approval,
13 pendingCount,
14 className,
15}: ComposerPendingApprovalPanelProps) {
16 const fallbackLabel =
17 approval.requestKind === "mcp-elicitation"
18 ? "App access approval"
19 : approval.requestKind === "command"
20 ? "Command approval"
21 : approval.requestKind === "file-read"
22 ? "File read approval"
23 : "File change approval";
24 const detailAriaLabel =
25 approval.requestKind === "mcp-elicitation"
26 ? "App access request"
27 : approval.requestKind === "command"
28 ? "Command"
29 : approval.requestKind === "file-read"
30 ? "File to read"
31 : "File change";
32
33 return (
34 <span
35 aria-label={fallbackLabel}
36 className={cn("flex min-w-0 flex-1 items-center gap-2", className)}
37 role="group"
38 >
39 {approval.appName ? (
40 <span className="max-w-32 shrink truncate text-[11px] font-medium text-foreground">
41 {approval.appName}
42 </span>
43 ) : null}
44 <code
45 aria-label={detailAriaLabel}
46 className="block max-h-20 min-w-0 flex-1 overflow-auto whitespace-pre font-mono text-[11px] text-foreground/85 [scrollbar-width:thin] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/70 [&::-webkit-scrollbar]:h-1.5"
47 data-approval-detail="complete"
48 tabIndex={0}
49 >
50 {approval.detail || fallbackLabel}
51 </code>
52 {pendingCount > 1 ? (
53 <span className="shrink-0 text-[10px] font-medium text-muted-foreground tabular-nums">
54 1/{pendingCount}
55 </span>
56 ) : null}
57 </span>
58 );
59});