Files
gemini-cli/packages/cli/src/ui/components/ApprovalModeIndicator.tsx
T

53 lines
1.2 KiB
TypeScript
Raw Normal View History

2025-05-17 21:25:28 -07:00
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type React from 'react';
2025-05-17 21:25:28 -07:00
import { Box, Text } from 'ink';
2025-09-10 10:57:07 -07:00
import { theme } from '../semantic-colors.js';
import { ApprovalMode } from '@google/gemini-cli-core';
2025-05-17 21:25:28 -07:00
interface ApprovalModeIndicatorProps {
approvalMode: ApprovalMode;
}
export const ApprovalModeIndicator: React.FC<ApprovalModeIndicatorProps> = ({
approvalMode,
}) => {
let textColor = '';
let textContent = '';
let subText = '';
switch (approvalMode) {
case ApprovalMode.AUTO_EDIT:
textColor = theme.status.warning;
textContent = 'accepting edits';
subText = ' (shift + tab to cycle)';
break;
case ApprovalMode.PLAN:
textColor = theme.status.success;
textContent = 'plan mode';
subText = ' (shift + tab to cycle)';
break;
case ApprovalMode.YOLO:
2025-09-10 10:57:07 -07:00
textColor = theme.status.error;
textContent = 'YOLO mode';
subText = ' (ctrl + y to toggle)';
break;
case ApprovalMode.DEFAULT:
default:
break;
}
return (
<Box>
<Text color={textColor}>
{textContent}
2025-09-10 10:57:07 -07:00
{subText && <Text color={theme.text.secondary}>{subText}</Text>}
</Text>
</Box>
);
};