import type { DirectiveWithProgress } from "../../lib/api";
export function ApprovalsTab({ directive, onRefresh }: { directive: DirectiveWithProgress; onRefresh: () => void }) {
if (directive.pendingApprovals.length === 0) {
return (
);
}
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 (
{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 (
{approval.approvalType}
{approval.urgency}
{approval.description}
);
})}
);
}