import { AlertCircle, Ban, Copy, RefreshCw, Trash2, X } from 'lucide-react'
import type { StrmTask } from '../../types/strm'
import { STRM_PROVIDER_LABELS } from '../../types/strm'
import { formatBytes, formatTime, taskStatusMeta } from '../StrmManagePage'
import { getFileIcon } from './taskFileIcon'
export function TaskDetailModal({
task,
isDownload,
onClose,
onRetry,
onCancel,
onDelete,
onCopy,
}: {
task: StrmTask
isDownload: boolean
onClose: () => void
onRetry: (t: StrmTask) => void
onCancel: (t: StrmTask) => void
onDelete: (t: StrmTask) => void
onCopy: (text: string, label: string) => void
}) {
const status = taskStatusMeta(task.status)
return (
e.stopPropagation()}
>
{getFileIcon(task.file_name)}
任务详情
{/* Main Info Box */}
任务 ID
{task.id}
文件名称
{task.file_name}
文件大小
{formatBytes(task.size)}
当前状态
{status.label}
云盘提供方
{STRM_PROVIDER_LABELS[task.provider] ?? task.provider}
{task.retry_count > 0 && (
已重试次数
{task.retry_count} 次
)}
{/* Paths */}
{isDownload ? '本地输出目标路径' : '本地来源路径'}
{task.local_path}
远端网盘路径
{task.remote_path}
{/* Error Message Box */}
{task.error && (
错误详情
{task.error}
)}
{/* Timeline */}
创建时间:{formatTime(task.created_at)}
{task.started_at &&
开始时间:{formatTime(task.started_at)}
}
{task.finished_at &&
结束时间:{formatTime(task.finished_at)}
}
{/* Footer Actions */}
{(task.status === 'done' ||
task.status === 'failed' ||
task.status === 'canceled') && (
)}
{(task.status === 'pending' || task.status === 'running') && (
)}
{(task.status === 'failed' || task.status === 'canceled') && (
)}
)
}