MCPcopy
hub / github.com/codeaashu/claude-code / BtwSideQuestion

Function BtwSideQuestion

src/commands/btw/btw.tsx:36–181  ·  view source on GitHub ↗
(t0)

Source from the content-addressed store, hash-verified

34const OUTER_CHROME_ROWS = 6;
35const SCROLL_LINES = 3;
36function BtwSideQuestion(t0) {
37 const $ = _c(25);
38 const {
39 question,
40 context,
41 onDone
42 } = t0;
43 const [response, setResponse] = useState(null);
44 const [error, setError] = useState(null);
45 const [frame, setFrame] = useState(0);
46 const scrollRef = useRef(null);
47 const {
48 rows
49 } = useModalOrTerminalSize(useTerminalSize());
50 let t1;
51 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
52 t1 = () => setFrame(_temp);
53 $[0] = t1;
54 } else {
55 t1 = $[0];
56 }
57 useInterval(t1, response || error ? null : 80);
58 let t2;
59 if ($[1] !== onDone) {
60 t2 = function handleKeyDown(e) {
61 if (e.key === "escape" || e.key === "return" || e.key === " " || e.ctrl && (e.key === "c" || e.key === "d")) {
62 e.preventDefault();
63 onDone(undefined, {
64 display: "skip"
65 });
66 return;
67 }
68 if (e.key === "up" || e.ctrl && e.key === "p") {
69 e.preventDefault();
70 scrollRef.current?.scrollBy(-SCROLL_LINES);
71 }
72 if (e.key === "down" || e.ctrl && e.key === "n") {
73 e.preventDefault();
74 scrollRef.current?.scrollBy(SCROLL_LINES);
75 }
76 };
77 $[1] = onDone;
78 $[2] = t2;
79 } else {
80 t2 = $[2];
81 }
82 const handleKeyDown = t2;
83 let t3;
84 let t4;
85 if ($[3] !== context || $[4] !== question) {
86 t3 = () => {
87 const abortController = createAbortController();
88 const fetchResponse = async function fetchResponse() {
89 ;
90 try {
91 const cacheSafeParams = await buildCacheSafeParams(context);
92 const result = await runSideQuestion({
93 question,

Callers

nothing calls this directly

Calls 8

useModalOrTerminalSizeFunction · 0.85
useTerminalSizeFunction · 0.85
useIntervalFunction · 0.85
createAbortControllerFunction · 0.85
fetchResponseFunction · 0.85
preventDefaultMethod · 0.80
maxMethod · 0.80
onDoneFunction · 0.50

Tested by

no test coverage detected