MCPcopy Create free account
hub / github.com/freecodexyz/free-code / DiffFileList

Function DiffFileList

src/components/diff/DiffFileList.tsx:14–151  ·  view source on GitHub ↗
(t0)

Source from the content-addressed store, hash-verified

12 selectedIndex: number;
13};
14export function DiffFileList(t0) {
15 const $ = _c(36);
16 const {
17 files,
18 selectedIndex
19 } = t0;
20 const {
21 columns
22 } = useTerminalSize();
23 let t1;
24 bb0: {
25 if (files.length === 0 || files.length <= MAX_VISIBLE_FILES) {
26 let t2;
27 if ($[0] !== files.length) {
28 t2 = {
29 startIndex: 0,
30 endIndex: files.length
31 };
32 $[0] = files.length;
33 $[1] = t2;
34 } else {
35 t2 = $[1];
36 }
37 t1 = t2;
38 break bb0;
39 }
40 let start = Math.max(0, selectedIndex - Math.floor(MAX_VISIBLE_FILES / 2));
41 let end = start + MAX_VISIBLE_FILES;
42 if (end > files.length) {
43 end = files.length;
44 start = Math.max(0, end - MAX_VISIBLE_FILES);
45 }
46 let t2;
47 if ($[2] !== end || $[3] !== start) {
48 t2 = {
49 startIndex: start,
50 endIndex: end
51 };
52 $[2] = end;
53 $[3] = start;
54 $[4] = t2;
55 } else {
56 t2 = $[4];
57 }
58 t1 = t2;
59 }
60 const {
61 startIndex,
62 endIndex
63 } = t1;
64 if (files.length === 0) {
65 let t2;
66 if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
67 t2 = <Text dimColor={true}>No changed files</Text>;
68 $[5] = t2;
69 } else {
70 t2 = $[5];
71 }

Callers

nothing calls this directly

Calls 3

useTerminalSizeFunction · 0.85
pluralFunction · 0.85
maxMethod · 0.80

Tested by

no test coverage detected