diff options
| author | Tommaso Sciortino <[email protected]> | 2025-06-29 00:50:53 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-29 07:50:53 +0000 |
| commit | fc21d1cae3c867a9593abcf7b0f957765961fdeb (patch) | |
| tree | 417c8eca9994402d666756efb032aaa785175f49 /packages/cli/src | |
| parent | 19a9b50aab48394c579d885390438547a93044d2 (diff) | |
Esc to exit privacy screen in error state (#2527)
Diffstat (limited to 'packages/cli/src')
| -rw-r--r-- | packages/cli/src/ui/privacy/CloudFreePrivacyNotice.tsx | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/packages/cli/src/ui/privacy/CloudFreePrivacyNotice.tsx b/packages/cli/src/ui/privacy/CloudFreePrivacyNotice.tsx index f9341bf9..25e14281 100644 --- a/packages/cli/src/ui/privacy/CloudFreePrivacyNotice.tsx +++ b/packages/cli/src/ui/privacy/CloudFreePrivacyNotice.tsx @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { Box, Newline, Text } from 'ink'; +import { Box, Newline, Text, useInput } from 'ink'; import { RadioButtonSelect } from '../components/shared/RadioButtonSelect.js'; import { usePrivacySettings } from '../hooks/usePrivacySettings.js'; import { CloudPaidPrivacyNotice } from './CloudPaidPrivacyNotice.js'; @@ -23,15 +23,24 @@ export const CloudFreePrivacyNotice = ({ const { privacyState, updateDataCollectionOptIn } = usePrivacySettings(config); + useInput((input, key) => { + if (privacyState.error && key.escape) { + onExit(); + } + }); + if (privacyState.isLoading) { return <Text color={Colors.Gray}>Loading...</Text>; } if (privacyState.error) { return ( - <Text color={Colors.AccentRed}> - Error loading Opt-in settings: {privacyState.error} - </Text> + <Box flexDirection="column" marginY={1}> + <Text color={Colors.AccentRed}> + Error loading Opt-in settings: {privacyState.error} + </Text> + <Text color={Colors.Gray}>Press Esc to exit.</Text> + </Box> ); } |
