MCPcopy Index your code
hub / github.com/codeaashu/claude-code / ColorPicker

Function ColorPicker

src/components/agents/ColorPicker.tsx:15–105  ·  view source on GitHub ↗
(t0)

Source from the content-addressed store, hash-verified

13 onConfirm: (color: AgentColorName | undefined) => void;
14};
15export function ColorPicker(t0) {
16 const $ = _c(17);
17 const {
18 agentName,
19 currentColor: t1,
20 onConfirm
21 } = t0;
22 const currentColor = t1 === undefined ? "automatic" : t1;
23 let t2;
24 if ($[0] !== currentColor) {
25 t2 = COLOR_OPTIONS.findIndex(opt => opt === currentColor);
26 $[0] = currentColor;
27 $[1] = t2;
28 } else {
29 t2 = $[1];
30 }
31 const [selectedIndex, setSelectedIndex] = useState(Math.max(0, t2));
32 let t3;
33 if ($[2] !== onConfirm || $[3] !== selectedIndex) {
34 t3 = e => {
35 if (e.key === "up") {
36 e.preventDefault();
37 setSelectedIndex(_temp);
38 } else {
39 if (e.key === "down") {
40 e.preventDefault();
41 setSelectedIndex(_temp2);
42 } else {
43 if (e.key === "return") {
44 e.preventDefault();
45 const selected = COLOR_OPTIONS[selectedIndex];
46 onConfirm(selected === "automatic" ? undefined : selected);
47 }
48 }
49 }
50 };
51 $[2] = onConfirm;
52 $[3] = selectedIndex;
53 $[4] = t3;
54 } else {
55 t3 = $[4];
56 }
57 const handleKeyDown = t3;
58 const selectedValue = COLOR_OPTIONS[selectedIndex];
59 let t4;
60 if ($[5] !== selectedIndex) {
61 t4 = COLOR_OPTIONS.map((option, index) => {
62 const isSelected = index === selectedIndex;
63 return <Box key={option} flexDirection="row" gap={1}><Text color={isSelected ? "suggestion" : undefined}>{isSelected ? figures.pointer : " "}</Text>{option === "automatic" ? <Text bold={isSelected}>Automatic color</Text> : <Box gap={1}><Text backgroundColor={AGENT_COLOR_TO_THEME_COLOR[option]} color="inverseText">{" "}</Text><Text bold={isSelected}>{capitalize(option)}</Text></Box>}</Box>;
64 });
65 $[5] = selectedIndex;
66 $[6] = t4;
67 } else {
68 t4 = $[6];
69 }
70 let t5;
71 if ($[7] !== t4) {
72 t5 = <Box flexDirection="column">{t4}</Box>;

Callers

nothing calls this directly

Calls 3

capitalizeFunction · 0.85
maxMethod · 0.80
preventDefaultMethod · 0.80

Tested by

no test coverage detected