1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
import { useNavigate } from "react-router";
import type { ContractSummary, ContractStatus } from "../../lib/api";
interface WorkflowContractCardProps {
contract: ContractSummary;
onClick: () => void;
onDragStart: (e: React.DragEvent) => void;
}
const statusConfig: Record<ContractStatus, { label: string; color: string }> = {
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,
}: 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 (
<div
draggable
onDragStart={onDragStart}
onClick={onClick}
className="p-3 bg-[rgba(9,13,20,0.8)] border border-[rgba(117,170,252,0.2)] hover:border-[rgba(117,170,252,0.4)] cursor-pointer transition-colors select-none"
>
{/* Header row with name and supervisor button */}
<div className="flex items-center justify-between gap-2 mb-1">
<div className="font-mono text-sm text-[#dbe7ff] truncate flex-1">
{contract.name}
</div>
{contract.supervisorTaskId && (
<button
onClick={handleSupervisorClick}
title="Open Supervisor Task"
className="flex-shrink-0 px-1.5 py-0.5 font-mono text-[10px] text-[#75aafc] hover:text-[#9bc3ff] border border-[rgba(117,170,252,0.25)] hover:border-[#3f6fb3] hover:bg-[rgba(117,170,252,0.1)] transition-colors"
>
▶
</button>
)}
</div>
{/* Status and counts row */}
<div className="flex items-center justify-between">
<span className={`font-mono text-[10px] uppercase ${status.color}`}>
{status.label}
</span>
<div className="flex items-center gap-2 font-mono text-[10px] text-[#555]">
<span title="Files">{contract.fileCount} files</span>
<span title="Tasks">{contract.taskCount} tasks</span>
</div>
</div>
{/* Description preview if exists */}
{contract.description && (
<div className="mt-1 font-mono text-[10px] text-[#555] truncate">
{contract.description}
</div>
)}
</div>
);
}
|