feat: Add Welcome Back Dialog, Project Summary, and Enhanced Quit Options (#553)

This commit is contained in:
pomelo
2025-09-11 16:59:26 +08:00
committed by GitHub
parent 03eb1faf0a
commit b1a1ce530e
28 changed files with 1322 additions and 24 deletions

View 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>
);
};