From 1c45ef563d69c05a48acbce38238bed380ce3300 Mon Sep 17 00:00:00 2001 From: tanzhenxin Date: Thu, 4 Dec 2025 17:41:52 +0800 Subject: [PATCH] remove unused files --- .../ui/components/QuitConfirmationDialog.tsx | 73 ------------------- .../cli/src/ui/hooks/useQuitConfirmation.ts | 37 ---------- 2 files changed, 110 deletions(-) delete mode 100644 packages/cli/src/ui/components/QuitConfirmationDialog.tsx delete mode 100644 packages/cli/src/ui/hooks/useQuitConfirmation.ts diff --git a/packages/cli/src/ui/components/QuitConfirmationDialog.tsx b/packages/cli/src/ui/components/QuitConfirmationDialog.tsx deleted file mode 100644 index 84162779..00000000 --- a/packages/cli/src/ui/components/QuitConfirmationDialog.tsx +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @license - * Copyright 2025 Qwen - * SPDX-License-Identifier: Apache-2.0 - */ - -import { Box, Text } from 'ink'; -import type React from 'react'; -import { Colors } from '../colors.js'; -import { - RadioButtonSelect, - type RadioSelectItem, -} from './shared/RadioButtonSelect.js'; -import { useKeypress } from '../hooks/useKeypress.js'; -import { t } from '../../i18n/index.js'; - -export enum QuitChoice { - CANCEL = 'cancel', - QUIT = 'quit', - SUMMARY_AND_QUIT = 'summary_and_quit', -} - -interface QuitConfirmationDialogProps { - onSelect: (choice: QuitChoice) => void; -} - -export const QuitConfirmationDialog: React.FC = ({ - onSelect, -}) => { - useKeypress( - (key) => { - if (key.name === 'escape') { - onSelect(QuitChoice.CANCEL); - } - }, - { isActive: true }, - ); - - const options: Array> = [ - { - key: 'quit', - label: t('Quit immediately (/quit)'), - value: QuitChoice.QUIT, - }, - { - key: 'summary-and-quit', - label: t('Generate summary and quit (/summary)'), - value: QuitChoice.SUMMARY_AND_QUIT, - }, - { - key: 'cancel', - label: t('Cancel (stay in application)'), - value: QuitChoice.CANCEL, - }, - ]; - - return ( - - - {t('What would you like to do before exiting?')} - - - - - ); -}; diff --git a/packages/cli/src/ui/hooks/useQuitConfirmation.ts b/packages/cli/src/ui/hooks/useQuitConfirmation.ts deleted file mode 100644 index fff0d488..00000000 --- a/packages/cli/src/ui/hooks/useQuitConfirmation.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @license - * Copyright 2025 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -import { useState, useCallback } from 'react'; -import { QuitChoice } from '../components/QuitConfirmationDialog.js'; - -export const useQuitConfirmation = () => { - const [isQuitConfirmationOpen, setIsQuitConfirmationOpen] = useState(false); - - const showQuitConfirmation = useCallback(() => { - setIsQuitConfirmationOpen(true); - }, []); - - const handleQuitConfirmationSelect = useCallback((choice: QuitChoice) => { - setIsQuitConfirmationOpen(false); - - if (choice === QuitChoice.CANCEL) { - return { shouldQuit: false, action: 'cancel' }; - } else if (choice === QuitChoice.QUIT) { - return { shouldQuit: true, action: 'quit' }; - } else if (choice === QuitChoice.SUMMARY_AND_QUIT) { - return { shouldQuit: true, action: 'summary_and_quit' }; - } - - // Default to cancel if unknown choice - return { shouldQuit: false, action: 'cancel' }; - }, []); - - return { - isQuitConfirmationOpen, - showQuitConfirmation, - handleQuitConfirmationSelect, - }; -};