/** * @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 = ({ 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 ( {'▬'.repeat(activeChars)} {'▬'.repeat(inactiveChars)} ); };