import { useNavigate } from "react-router"; import { useSupervisorQuestions } from "../contexts/SupervisorQuestionsContext"; import { useUserSettings } from "../hooks/useUserSettings"; import type { PendingQuestion } from "../lib/api"; export function SupervisorQuestionNotification() { const navigate = useNavigate(); const { notificationQuestions, dismissNotification } = useSupervisorQuestions(); const { settings } = useUserSettings(); const documentMode = settings?.documentModeEnabled ?? false; // Filter out contract_complete questions - they are displayed on the task page instead const filteredQuestions = notificationQuestions.filter( (q) => q.questionType !== "contract_complete" ); if (filteredQuestions.length === 0) { return null; } const handleGoToTask = (q: PendingQuestion) => { dismissNotification(q.questionId); // In document mode, route directly to the directive folder page with // the task selected — that's the canonical surface where the question // is answered (same comment/interrupt UI as the task stream). Fall // back to /exec for non-doc-mode users or for tasks not tied to a // directive. if (documentMode && q.directiveId) { navigate(`/directives/${q.directiveId}?task=${q.taskId}`); } else { navigate(`/exec/${q.taskId}`); } }; return (
{filteredQuestions.map((question) => (
{/* Header */}
? Task needs input
{/* Question preview */}
{question.context && (
{question.context}
)}

{question.question}

))}
); }