mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
feat: Add Welcome Back Dialog, Project Summary, and Enhanced Quit Options (#553)
This commit is contained in:
59
packages/cli/src/ui/components/messages/SummaryMessage.tsx
Normal file
59
packages/cli/src/ui/components/messages/SummaryMessage.tsx
Normal file
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2025 Qwen
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import { SummaryProps } from '../../types.js';
|
||||
import Spinner from 'ink-spinner';
|
||||
import { Colors } from '../../colors.js';
|
||||
|
||||
export interface SummaryDisplayProps {
|
||||
summary: SummaryProps;
|
||||
}
|
||||
|
||||
/*
|
||||
* Summary messages appear when the /chat summary command is run, and show a loading spinner
|
||||
* while summary generation is in progress, followed up by success confirmation.
|
||||
*/
|
||||
export const SummaryMessage: React.FC<SummaryDisplayProps> = ({ summary }) => {
|
||||
const getText = () => {
|
||||
if (summary.isPending) {
|
||||
switch (summary.stage) {
|
||||
case 'generating':
|
||||
return 'Generating project summary...';
|
||||
case 'saving':
|
||||
return 'Saving project summary...';
|
||||
default:
|
||||
return 'Processing summary...';
|
||||
}
|
||||
}
|
||||
const baseMessage = 'Project summary generated and saved successfully!';
|
||||
if (summary.filePath) {
|
||||
return `${baseMessage} Saved to: ${summary.filePath}`;
|
||||
}
|
||||
return baseMessage;
|
||||
};
|
||||
|
||||
const getIcon = () => {
|
||||
if (summary.isPending) {
|
||||
return <Spinner type="dots" />;
|
||||
}
|
||||
return <Text color={Colors.AccentGreen}>✅</Text>;
|
||||
};
|
||||
|
||||
return (
|
||||
<Box flexDirection="row">
|
||||
<Box marginRight={1}>{getIcon()}</Box>
|
||||
<Box>
|
||||
<Text
|
||||
color={summary.isPending ? Colors.AccentPurple : Colors.AccentGreen}
|
||||
>
|
||||
{getText()}
|
||||
</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user