MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / SelectedChips

Function SelectedChips

cli/src/components/selected-chips.tsx:13–80  ·  view source on GitHub ↗
({
  selectedAgents,
  onRemove,
})

Source from the content-addressed store, hash-verified

11}
12
13export const SelectedChips: React.FC<SelectedChipsProps> = ({
14 selectedAgents,
15 onRemove,
16}) => {
17 const theme = useTheme()
18 const [hoveredChipId, setHoveredChipId] = useState<string | null>(null)
19
20 if (selectedAgents.length === 0) {
21 return null
22 }
23
24 return (
25 <box style={{ flexDirection: 'row', alignItems: 'center', paddingLeft: 1, paddingRight: 1, flexWrap: 'wrap' }}>
26 {selectedAgents.map((agent) => {
27 const isHovered = hoveredChipId === agent.id
28 const displayText = agent.displayName !== agent.id
29 ? agent.displayName
30 : agent.id
31
32 return (
33 <Button
34 key={agent.id}
35 onClick={() => onRemove(agent.id)}
36 onMouseOver={() => setHoveredChipId(agent.id)}
37 onMouseOut={() => setHoveredChipId(null)}
38 style={{
39 backgroundColor: 'transparent',
40 paddingLeft: 0,
41 paddingRight: 0,
42 paddingTop: 0,
43 paddingBottom: 0,
44 }}
45 >
46 <box
47 border
48 borderStyle="single"
49 borderColor={isHovered ? theme.error : theme.success}
50 customBorderChars={BORDER_CHARS}
51 style={{
52 flexDirection: 'row',
53 gap: 1,
54 paddingLeft: 1,
55 paddingRight: 1,
56 }}
57 >
58 <text
59 style={{
60 fg: isHovered ? theme.error : theme.success,
61 attributes: TextAttributes.BOLD,
62 }}
63 >
64 {displayText}
65 </text>
66 <text
67 style={{
68 fg: isHovered ? theme.error : theme.muted,
69 }}
70 >

Callers

nothing calls this directly

Calls 1

useThemeFunction · 0.90

Tested by

no test coverage detected