(props: {
path: string;
segment: string;
depth: number;
count: number;
open: boolean;
onToggle: () => void;
search: string;
onSetPolicy?: (pattern: string, action: ToolPolicyAction) => void;
onClearPolicy?: (pattern: string) => void;
patternForDisplay: (displayPattern: string) => string;
exactRule?: ToolPolicyAction;
})
| 625 | } |
| 626 | |
| 627 | function ToolGroupRow(props: { |
| 628 | path: string; |
| 629 | segment: string; |
| 630 | depth: number; |
| 631 | count: number; |
| 632 | open: boolean; |
| 633 | onToggle: () => void; |
| 634 | search: string; |
| 635 | onSetPolicy?: (pattern: string, action: ToolPolicyAction) => void; |
| 636 | onClearPolicy?: (pattern: string) => void; |
| 637 | patternForDisplay: (displayPattern: string) => string; |
| 638 | exactRule?: ToolPolicyAction; |
| 639 | }) { |
| 640 | const showActions = !!props.onSetPolicy; |
| 641 | return ( |
| 642 | <div className="group/tt-row relative flex items-stretch hover:bg-accent/60"> |
| 643 | <Button |
| 644 | variant="ghost" |
| 645 | aria-expanded={props.open} |
| 646 | onClick={props.onToggle} |
| 647 | className={cn(rowBaseClasses, "hover:bg-transparent")} |
| 648 | style={{ |
| 649 | paddingLeft: rowIndent(props.depth), |
| 650 | paddingRight: showActions ? 36 : 12, |
| 651 | }} |
| 652 | > |
| 653 | <ChevronRightIcon |
| 654 | aria-hidden |
| 655 | className={cn( |
| 656 | "size-3.5 shrink-0 text-muted-foreground transition-transform duration-150", |
| 657 | props.open && "rotate-90", |
| 658 | )} |
| 659 | /> |
| 660 | <span className="min-w-0 flex-1 truncate text-left font-mono text-xs text-foreground"> |
| 661 | {highlightMatch(props.segment, props.search)} |
| 662 | </span> |
| 663 | <span className="shrink-0 tabular-nums text-xs text-muted-foreground">{props.count}</span> |
| 664 | </Button> |
| 665 | {showActions && ( |
| 666 | <div |
| 667 | className={cn( |
| 668 | "absolute right-1.5 top-1/2 -translate-y-1/2 transition-opacity", |
| 669 | props.exactRule |
| 670 | ? "opacity-100" |
| 671 | : "opacity-0 group-hover/tt-row:opacity-100 focus-within:opacity-100", |
| 672 | )} |
| 673 | > |
| 674 | <PolicyActionMenu |
| 675 | pattern={props.patternForDisplay(`${props.path}.*`)} |
| 676 | current={props.exactRule} |
| 677 | onSet={props.onSetPolicy!} |
| 678 | onClear={props.onClearPolicy} |
| 679 | triggerLabel={`Set policy for ${props.path}.*`} |
| 680 | /> |
| 681 | </div> |
| 682 | )} |
| 683 | </div> |
| 684 | ); |
nothing calls this directly
no test coverage detected