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
74
75
76
77
|
import type { DirectiveWithProgress } from "../../lib/api";
export function ApprovalsTab({ directive, onRefresh }: { directive: DirectiveWithProgress; onRefresh: () => void }) {
if (directive.pendingApprovals.length === 0) {
return (
<div className="text-center py-8">
<p className="font-mono text-sm text-[#556677]">No pending approvals</p>
</div>
);
}
const handleApprove = async (approvalId: string) => {
try {
const { approveDirectiveRequest } = await import("../../lib/api");
await approveDirectiveRequest(directive.id, approvalId);
onRefresh();
} catch (err) {
console.error("Failed to approve:", err);
}
};
const handleDeny = async (approvalId: string) => {
try {
const { denyDirectiveRequest } = await import("../../lib/api");
await denyDirectiveRequest(directive.id, approvalId);
onRefresh();
} catch (err) {
console.error("Failed to deny:", err);
}
};
return (
<div className="space-y-3">
{directive.pendingApprovals.map((approval) => {
const urgencyColor = {
low: "text-[#556677]",
normal: "text-[#75aafc]",
high: "text-yellow-400",
critical: "text-red-400",
}[approval.urgency] || "text-[#556677]";
return (
<div
key={approval.id}
className="p-4 bg-[rgba(117,170,252,0.05)] border border-[rgba(117,170,252,0.2)]"
>
<div className="flex items-start justify-between">
<div>
<div className="flex items-center gap-2">
<span className="font-mono text-sm text-[#dbe7ff]">{approval.approvalType}</span>
<span className={`font-mono text-[10px] uppercase ${urgencyColor}`}>
{approval.urgency}
</span>
</div>
<p className="font-mono text-xs text-[#9bc3ff] mt-1">{approval.description}</p>
</div>
<div className="flex gap-2">
<button
onClick={() => handleApprove(approval.id)}
className="px-3 py-1 font-mono text-[10px] text-[#dbe7ff] bg-green-700 border border-green-600 hover:bg-green-600 uppercase"
>
Approve
</button>
<button
onClick={() => handleDeny(approval.id)}
className="px-3 py-1 font-mono text-[10px] text-[#dbe7ff] bg-red-700 border border-red-600 hover:bg-red-600 uppercase"
>
Deny
</button>
</div>
</div>
</div>
);
})}
</div>
);
}
|