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

Function ModelsTab

src/components/Stats.tsx:716–815  ·  view source on GitHub ↗
(t0)

Source from the content-addressed store, hash-verified

714 return factoids[randomIndex]!;
715}
716function ModelsTab(t0) {
717 const $ = _c(15);
718 const {
719 stats,
720 dateRange,
721 isLoading
722 } = t0;
723 const {
724 headerFocused,
725 focusHeader
726 } = useTabHeaderFocus();
727 const [scrollOffset, setScrollOffset] = useState(0);
728 const {
729 columns: terminalWidth
730 } = useTerminalSize();
731 const modelEntries = Object.entries(stats.modelUsage).sort(_temp7);
732 const t1 = !headerFocused;
733 let t2;
734 if ($[0] !== t1) {
735 t2 = {
736 isActive: t1
737 };
738 $[0] = t1;
739 $[1] = t2;
740 } else {
741 t2 = $[1];
742 }
743 useInput((_input, key) => {
744 if (key.downArrow && scrollOffset < modelEntries.length - 4) {
745 setScrollOffset(prev => Math.min(prev + 2, modelEntries.length - 4));
746 }
747 if (key.upArrow) {
748 if (scrollOffset > 0) {
749 setScrollOffset(_temp8);
750 } else {
751 focusHeader();
752 }
753 }
754 }, t2);
755 if (modelEntries.length === 0) {
756 let t3;
757 if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
758 t3 = <Box><Text color="subtle">No model usage data available</Text></Box>;
759 $[2] = t3;
760 } else {
761 t3 = $[2];
762 }
763 return t3;
764 }
765 const totalTokens = modelEntries.reduce(_temp9, 0);
766 const chartOutput = generateTokenChart(stats.dailyModelTokens, modelEntries.map(_temp0), terminalWidth);
767 const visibleModels = modelEntries.slice(scrollOffset, scrollOffset + 4);
768 const midpoint = Math.ceil(visibleModels.length / 2);
769 const leftModels = visibleModels.slice(0, midpoint);
770 const rightModels = visibleModels.slice(midpoint);
771 const canScrollUp = scrollOffset > 0;
772 const canScrollDown = scrollOffset < modelEntries.length - 4;
773 const showScrollHint = modelEntries.length > 4;

Callers

nothing calls this directly

Calls 5

useTabHeaderFocusFunction · 0.85
useTerminalSizeFunction · 0.85
useInputFunction · 0.85
generateTokenChartFunction · 0.85
entriesMethod · 0.80

Tested by

no test coverage detected