mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
style: Format execution time as minutes, seconds (#2707)
This commit is contained in:
@@ -97,13 +97,25 @@ describe('<LoadingIndicator />', () => {
|
|||||||
it('should display the elapsedTime correctly when Responding', () => {
|
it('should display the elapsedTime correctly when Responding', () => {
|
||||||
const props = {
|
const props = {
|
||||||
currentLoadingPhrase: 'Working...',
|
currentLoadingPhrase: 'Working...',
|
||||||
elapsedTime: 8,
|
elapsedTime: 60,
|
||||||
};
|
};
|
||||||
const { lastFrame } = renderWithContext(
|
const { lastFrame } = renderWithContext(
|
||||||
<LoadingIndicator {...props} />,
|
<LoadingIndicator {...props} />,
|
||||||
StreamingState.Responding,
|
StreamingState.Responding,
|
||||||
);
|
);
|
||||||
expect(lastFrame()).toContain('(esc to cancel, 8s)');
|
expect(lastFrame()).toContain('(esc to cancel, 1m)');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should display the elapsedTime correctly in human-readable format', () => {
|
||||||
|
const props = {
|
||||||
|
currentLoadingPhrase: 'Working...',
|
||||||
|
elapsedTime: 125,
|
||||||
|
};
|
||||||
|
const { lastFrame } = renderWithContext(
|
||||||
|
<LoadingIndicator {...props} />,
|
||||||
|
StreamingState.Responding,
|
||||||
|
);
|
||||||
|
expect(lastFrame()).toContain('(esc to cancel, 2m 5s)');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render rightContent when provided', () => {
|
it('should render rightContent when provided', () => {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { Colors } from '../colors.js';
|
|||||||
import { useStreamingContext } from '../contexts/StreamingContext.js';
|
import { useStreamingContext } from '../contexts/StreamingContext.js';
|
||||||
import { StreamingState } from '../types.js';
|
import { StreamingState } from '../types.js';
|
||||||
import { GeminiRespondingSpinner } from './GeminiRespondingSpinner.js';
|
import { GeminiRespondingSpinner } from './GeminiRespondingSpinner.js';
|
||||||
|
import { formatDuration } from '../utils/formatters.js';
|
||||||
|
|
||||||
interface LoadingIndicatorProps {
|
interface LoadingIndicatorProps {
|
||||||
currentLoadingPhrase?: string;
|
currentLoadingPhrase?: string;
|
||||||
@@ -50,7 +51,7 @@ export const LoadingIndicator: React.FC<LoadingIndicatorProps> = ({
|
|||||||
<Text color={Colors.Gray}>
|
<Text color={Colors.Gray}>
|
||||||
{streamingState === StreamingState.WaitingForConfirmation
|
{streamingState === StreamingState.WaitingForConfirmation
|
||||||
? ''
|
? ''
|
||||||
: ` (esc to cancel, ${elapsedTime}s)`}
|
: ` (esc to cancel, ${elapsedTime < 60 ? `${elapsedTime}s` : formatDuration(elapsedTime * 1000)})`}
|
||||||
</Text>
|
</Text>
|
||||||
<Box flexGrow={1}>{/* Spacer */}</Box>
|
<Box flexGrow={1}>{/* Spacer */}</Box>
|
||||||
{rightContent && <Box>{rightContent}</Box>}
|
{rightContent && <Box>{rightContent}</Box>}
|
||||||
|
|||||||
Reference in New Issue
Block a user