import { useMemo } from "react"; import type { DirectiveSummary, DirectiveStatus } from "../../lib/api"; import { useSupervisorQuestions } from "../../contexts/SupervisorQuestionsContext"; const STATUS_BADGE: Record = { draft: { color: "text-[#7788aa] border-[#2a3a5a]", label: "DRAFT" }, active: { color: "text-green-400 border-green-800", label: "ACTIVE" }, idle: { color: "text-yellow-400 border-yellow-800", label: "IDLE" }, paused: { color: "text-orange-400 border-orange-800", label: "PAUSED" }, archived: { color: "text-[#556677] border-[#2a3a5a]", label: "ARCHIVED" }, }; interface DirectiveListProps { directives: DirectiveSummary[]; selectedId: string | null; onSelect: (id: string) => void; onCreate: () => void; } export function DirectiveList({ directives, selectedId, onSelect, onCreate }: DirectiveListProps) { const { pendingQuestions } = useSupervisorQuestions(); const questionsPerDirective = useMemo(() => { const counts = new Map(); for (const q of pendingQuestions) { if (q.directiveId) { counts.set(q.directiveId, (counts.get(q.directiveId) || 0) + 1); } } return counts; }, [pendingQuestions]); return (
Directives
{directives.length === 0 ? (
No directives yet
) : ( directives.map((d) => { const badge = STATUS_BADGE[d.status] || STATUS_BADGE.draft; const progress = d.totalSteps > 0 ? Math.round((d.completedSteps / d.totalSteps) * 100) : 0; return ( ); }) )}
); }