mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 12:55:51 +00:00
删除未使用的文件(BuiltinStatusLine.tsx、4 个重复的 .ts stub)、 移除约 55 个文件中未使用的 React 导入、 清理约 50 处未使用的导入/变量/参数。 净减少 ~296 行代码,precheck 4077 测试全部通过。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import type { ReactNode } from 'react';
|
|
import { Text } from '@anthropic/ink';
|
|
import type { TaskStatus } from 'src/Task.js';
|
|
import type { LocalShellTaskState } from 'src/tasks/LocalShellTask/guards.js';
|
|
import type { DeepImmutable } from 'src/types/utils.js';
|
|
|
|
type TaskStatusTextProps = {
|
|
status: TaskStatus;
|
|
label?: string;
|
|
suffix?: string;
|
|
};
|
|
|
|
export function TaskStatusText({ status, label, suffix }: TaskStatusTextProps): ReactNode {
|
|
const displayLabel = label ?? status;
|
|
const color =
|
|
status === 'completed' ? 'success' : status === 'failed' ? 'error' : status === 'killed' ? 'warning' : undefined;
|
|
return (
|
|
<Text color={color} dimColor>
|
|
({displayLabel}
|
|
{suffix})
|
|
</Text>
|
|
);
|
|
}
|
|
|
|
export function ShellProgress({ shell }: { shell: DeepImmutable<LocalShellTaskState> }): ReactNode {
|
|
switch (shell.status) {
|
|
case 'completed':
|
|
return <TaskStatusText status="completed" label="done" />;
|
|
case 'failed':
|
|
return <TaskStatusText status="failed" label="error" />;
|
|
case 'killed':
|
|
return <TaskStatusText status="killed" label="stopped" />;
|
|
case 'running':
|
|
case 'pending':
|
|
return <TaskStatusText status="running" />;
|
|
}
|
|
}
|