import { Pencil, Trash2 } from 'lucide-react'; import { iconMap } from '@/data/pipelineData'; import type { PipelineTask } from '@/types/pipeline'; interface TaskCardProps { task: PipelineTask; isSelected: boolean; onSelect: () => void; onDelete: () => void; } // Subtle type indicator colors — just for the small dot/icon, NOT background const typeConfig: Record = { build: { color: '#9a6700', label: '构建' }, deploy: { color: '#1a7f37', label: '部署' }, test: { color: '#8250df', label: '测试' }, custom: { color: '#6e7781', label: '自定义' }, }; export default function TaskCard({ task, isSelected, onSelect, onDelete }: TaskCardProps) { const config = typeConfig[task.type] || typeConfig.custom; const IconComponent = iconMap[task.icon] || iconMap.Settings; const handleDelete = (e: React.MouseEvent) => { e.stopPropagation(); onDelete(); }; return (
{/* Type icon — small colored dot with icon inside */}
{/* Task info */}
{task.name}
{config.label} {task.scriptType && ` · ${task.scriptType}`}
{/* Actions — hover reveal */}
); }