fix(ui): hide model quota in /stats and refactor quota display (#24206)

This commit is contained in:
Dan Zaharia
2026-04-02 16:49:14 -04:00
committed by GitHub
parent e5adeaca80
commit 29caa52bb7
15 changed files with 986 additions and 748 deletions
@@ -0,0 +1,39 @@
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type React from 'react';
import { Box, Text } from 'ink';
import { theme } from '../semantic-colors.js';
interface ProgressBarProps {
value: number; // 0 to 100
width: number;
warningThreshold?: number;
}
export const ProgressBar: React.FC<ProgressBarProps> = ({
value,
width,
warningThreshold = 80,
}) => {
const safeValue = Math.min(Math.max(value, 0), 100);
const activeChars = Math.ceil((safeValue / 100) * width);
const inactiveChars = width - activeChars;
let color = theme.status.success;
if (safeValue >= 100) {
color = theme.status.error;
} else if (safeValue >= warningThreshold) {
color = theme.status.warning;
}
return (
<Box flexDirection="row">
<Text color={color}>{'▬'.repeat(activeChars)}</Text>
<Text color={theme.border.default}>{'▬'.repeat(inactiveChars)}</Text>
</Box>
);
};