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 === "command"
18 ? "Command approval"
19 : approval.requestKind === "file-read"
20 ? "File read approval"
21 : "File change approval";
22 const detailAriaLabel =
23 approval.requestKind === "command"
24 ? "Command"
25 : approval.requestKind === "file-read"
26 ? "File to read"
27 : "File change";
28
29 return (
30 <div
31 aria-label={fallbackLabel}
32 className={cn("flex min-w-0 flex-1 items-center gap-2", className)}
33 role="group"
34 >
35 <code
36 aria-label={detailAriaLabel}
37 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"
38 data-approval-detail="complete"
39 tabIndex={0}
40 >
41 {approval.detail || fallbackLabel}
42 </code>
43 {pendingCount > 1 ? (
44 <span className="shrink-0 text-[10px] font-medium text-muted-foreground tabular-nums">
45 1/{pendingCount}
46 </span>
47 ) : null}
48 </div>
49 );
50});