mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
remove unused files
This commit is contained in:
@@ -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<QuitConfirmationDialogProps> = ({
|
|
||||||
onSelect,
|
|
||||||
}) => {
|
|
||||||
useKeypress(
|
|
||||||
(key) => {
|
|
||||||
if (key.name === 'escape') {
|
|
||||||
onSelect(QuitChoice.CANCEL);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ isActive: true },
|
|
||||||
);
|
|
||||||
|
|
||||||
const options: Array<RadioSelectItem<QuitChoice>> = [
|
|
||||||
{
|
|
||||||
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 (
|
|
||||||
<Box
|
|
||||||
flexDirection="column"
|
|
||||||
borderStyle="round"
|
|
||||||
borderColor={Colors.AccentYellow}
|
|
||||||
padding={1}
|
|
||||||
width="100%"
|
|
||||||
marginLeft={1}
|
|
||||||
>
|
|
||||||
<Box flexDirection="column" marginBottom={1}>
|
|
||||||
<Text>{t('What would you like to do before exiting?')}</Text>
|
|
||||||
</Box>
|
|
||||||
|
|
||||||
<RadioButtonSelect items={options} onSelect={onSelect} isFocused />
|
|
||||||
</Box>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -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,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user