MCPcopy Create free account
hub / github.com/Noumena-Network/code / StatsContent

Function StatsContent

src/components/Stats.tsx:122–312  ·  view source on GitHub ↗

* Inner component that uses React 19's use() to read the stats promise. * Suspends while loading all-time stats, then handles date range changes without suspending.

(t0)

Source from the content-addressed store, hash-verified

120 * Suspends while loading all-time stats, then handles date range changes without suspending.
121 */
122function StatsContent(t0) {
123 const $ = _c(34);
124 const {
125 allTimePromise,
126 onClose
127 } = t0;
128 const allTimeResult = use(allTimePromise);
129 const [dateRange, setDateRange] = useState("all");
130 let t1;
131 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
132 t1 = {};
133 $[0] = t1;
134 } else {
135 t1 = $[0];
136 }
137 const [statsCache, setStatsCache] = useState(t1);
138 const [isLoadingFiltered, setIsLoadingFiltered] = useState(false);
139 const [activeTab, setActiveTab] = useState("Overview");
140 const [copyStatus, setCopyStatus] = useState(null);
141 let t2;
142 let t3;
143 if ($[1] !== dateRange || $[2] !== statsCache) {
144 t2 = () => {
145 if (dateRange === "all") {
146 return;
147 }
148 if (statsCache[dateRange]) {
149 return;
150 }
151 let cancelled = false;
152 setIsLoadingFiltered(true);
153 aggregateClaudeCodeStatsForRange(dateRange).then(data => {
154 if (!cancelled) {
155 setStatsCache(prev => ({
156 ...prev,
157 [dateRange]: data
158 }));
159 setIsLoadingFiltered(false);
160 }
161 }).catch(() => {
162 if (!cancelled) {
163 setIsLoadingFiltered(false);
164 }
165 });
166 return () => {
167 cancelled = true;
168 };
169 };
170 t3 = [dateRange, statsCache];
171 $[1] = dateRange;
172 $[2] = statsCache;
173 $[3] = t2;
174 $[4] = t3;
175 } else {
176 t2 = $[3];
177 t3 = $[4];
178 }
179 useEffect(t2, t3);

Callers

nothing calls this directly

Calls 5

useKeybindingFunction · 0.85
getNextDateRangeFunction · 0.85
handleScreenshotFunction · 0.85
useInputFunction · 0.85

Tested by

no test coverage detected