import { useState } from "react";
import type { DirectiveWithProgress, DirectiveGraphResponse } from "../../lib/api";
import { OverviewTab } from "./OverviewTab";
import { ChainTab } from "./ChainTab";
import { EventsTab } from "./EventsTab";
import { EvaluationsTab } from "./EvaluationsTab";
import { ApprovalsTab } from "./ApprovalsTab";
import { VerifiersTab } from "./VerifiersTab";
interface DirectiveDetailProps {
directive: DirectiveWithProgress;
graph: DirectiveGraphResponse | null;
loading: boolean;
onBack: () => void;
onRefresh: () => void;
onStart: () => void;
onPause: () => void;
onResume: () => void;
onStop: () => void;
}
export function DirectiveDetail({
directive,
graph,
loading,
onBack,
onRefresh,
onStart,
onPause,
onResume,
onStop,
}: DirectiveDetailProps) {
const [activeTab, setActiveTab] = useState<"overview" | "chain" | "events" | "evaluations" | "approvals" | "verifiers">("overview");
if (loading) {
return (
);
}
const statusColor = {
draft: "text-[#556677] bg-[#556677]/10 border-[#556677]/30",
planning: "text-yellow-400 bg-yellow-400/10 border-yellow-400/30",
active: "text-green-400 bg-green-400/10 border-green-400/30",
paused: "text-yellow-400 bg-yellow-400/10 border-yellow-400/30",
completed: "text-[#75aafc] bg-[#75aafc]/10 border-[#75aafc]/30",
archived: "text-[#556677] bg-[#556677]/10 border-[#556677]/30",
failed: "text-red-400 bg-red-400/10 border-red-400/30",
}[directive.status] || "text-[#556677] bg-[#556677]/10 border-[#556677]/30";
return (
{/* Header */}
{directive.title || directive.goal.slice(0, 50)}
{directive.status}
{directive.status === "draft" && (
)}
{directive.status === "active" && (
)}
{directive.status === "paused" && (
)}
{["active", "paused"].includes(directive.status) && (
)}
{/* Tabs */}
{(["overview", "chain", "events", "evaluations", "approvals", "verifiers"] as const).map((tab) => (
))}
{/* Tab Content */}
{activeTab === "overview" && (
)}
{activeTab === "chain" && (
)}
{activeTab === "events" && (
)}
{activeTab === "evaluations" && (
)}
{activeTab === "approvals" && (
)}
{activeTab === "verifiers" && (
)}
);
}