Switch from useInput to useKeypress. (#6056)

This commit is contained in:
Jacob Richman
2025-08-12 14:05:49 -07:00
committed by GitHub
parent 74fd0841d0
commit d219f90132
19 changed files with 350 additions and 259 deletions

View File

@@ -4,12 +4,13 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { Box, Newline, Text, useInput } from 'ink';
import { Box, Newline, Text } from 'ink';
import { RadioButtonSelect } from '../components/shared/RadioButtonSelect.js';
import { usePrivacySettings } from '../hooks/usePrivacySettings.js';
import { CloudPaidPrivacyNotice } from './CloudPaidPrivacyNotice.js';
import { Config } from '@google/gemini-cli-core';
import { Colors } from '../colors.js';
import { useKeypress } from '../hooks/useKeypress.js';
interface CloudFreePrivacyNoticeProps {
config: Config;
@@ -23,11 +24,14 @@ export const CloudFreePrivacyNotice = ({
const { privacyState, updateDataCollectionOptIn } =
usePrivacySettings(config);
useInput((input, key) => {
if (privacyState.error && key.escape) {
onExit();
}
});
useKeypress(
(key) => {
if (privacyState.error && key.name === 'escape') {
onExit();
}
},
{ isActive: true },
);
if (privacyState.isLoading) {
return <Text color={Colors.Gray}>Loading...</Text>;