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

Function ExtraUsageSection

src/components/Settings/Usage.tsx:271–375  ·  view source on GitHub ↗
(t0)

Source from the content-addressed store, hash-verified

269};
270const EXTRA_USAGE_SECTION_TITLE = 'Extra usage';
271function ExtraUsageSection(t0) {
272 const $ = _c(20);
273 const {
274 extraUsage,
275 maxWidth
276 } = t0;
277 const isProOrMax = getCurrentUsageSessionState().isProOrMax;
278 if (!isProOrMax) {
279 return false;
280 }
281 if (!extraUsage.is_enabled) {
282 if (extraUsageCommand.isEnabled()) {
283 let t1;
284 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
285 t1 = <Box flexDirection="column"><Text bold={true}>{EXTRA_USAGE_SECTION_TITLE}</Text><Text dimColor={true}>Extra usage not enabled · /extra-usage to enable</Text></Box>;
286 $[0] = t1;
287 } else {
288 t1 = $[0];
289 }
290 return t1;
291 }
292 return null;
293 }
294 if (extraUsage.monthly_limit === null) {
295 let t1;
296 if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
297 t1 = <Box flexDirection="column"><Text bold={true}>{EXTRA_USAGE_SECTION_TITLE}</Text><Text dimColor={true}>Unlimited</Text></Box>;
298 $[1] = t1;
299 } else {
300 t1 = $[1];
301 }
302 return t1;
303 }
304 if (typeof extraUsage.used_credits !== "number" || typeof extraUsage.utilization !== "number") {
305 return null;
306 }
307 const t1 = extraUsage.used_credits / 100;
308 let t2;
309 if ($[2] !== t1) {
310 t2 = formatCost(t1, 2);
311 $[2] = t1;
312 $[3] = t2;
313 } else {
314 t2 = $[3];
315 }
316 const formattedUsedCredits = t2;
317 const t3 = extraUsage.monthly_limit / 100;
318 let t4;
319 if ($[4] !== t3) {
320 t4 = formatCost(t3, 2);
321 $[4] = t3;
322 $[5] = t4;
323 } else {
324 t4 = $[5];
325 }
326 const formattedMonthlyLimit = t4;
327 let T0;
328 let t5;

Callers

nothing calls this directly

Calls 2

formatCostFunction · 0.85

Tested by

no test coverage detected