mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-25 12:34:38 -07:00
fix(ui): hide model quota in /stats and refactor quota display (#24206)
This commit is contained in:
@@ -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>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user