import { useNavigate } from "react-router"; import type { ContractSummary, ContractStatus } from "../../lib/api"; interface WorkflowContractCardProps { contract: ContractSummary; onClick: () => void; onDragStart: (e: React.DragEvent) => void; onContextMenu?: (e: React.MouseEvent) => void; } const statusConfig: Record = { active: { label: "Active", color: "text-green-400" }, completed: { label: "Done", color: "text-blue-400" }, archived: { label: "Archived", color: "text-[#555]" }, }; export function WorkflowContractCard({ contract, onClick, onDragStart, onContextMenu, }: WorkflowContractCardProps) { const navigate = useNavigate(); const status = statusConfig[contract.status] || statusConfig.active; const handleSupervisorClick = (e: React.MouseEvent) => { e.stopPropagation(); if (contract.supervisorTaskId) { navigate(`/mesh/${contract.supervisorTaskId}`); } }; return (
{/* Header row with name and supervisor button */}
{contract.name}
{contract.supervisorTaskId && ( )}
{/* Status and counts row */}
{status.label}
{contract.fileCount} files {contract.taskCount} tasks
{/* Description preview if exists */} {contract.description && (
{contract.description}
)}
); }