import { useRef } from 'react' import { Modal } from '@/components/common/Modal' import { cn } from '@/lib/utils' import type { SessionOutcome } from '@/types' import { Button } from '@/components/ui/Button' interface SessionOutcomeModalProps { isOpen: boolean onClose: () => void onSubmit: (data: { outcome: SessionOutcome; outcome_notes?: string; next_steps?: string }) => Promise isSubmitting?: boolean } const OUTCOME_OPTIONS: Array<{ value: SessionOutcome; label: string; description: string }> = [ { value: 'resolved', label: 'Resolved', description: 'Issue fully resolved in this session.' }, { value: 'workaround', label: 'Workaround', description: 'Temporary fix applied, root cause remains.' }, { value: 'escalated', label: 'Escalated', description: 'Handed off to another engineer/team.' }, { value: 'unresolved', label: 'Unresolved', description: 'No fix or workaround identified yet.' }, ] export function SessionOutcomeModal({ isOpen, onClose, onSubmit, isSubmitting = false, }: SessionOutcomeModalProps) { const formRef = useRef(null) const handleSubmit = async () => { if (!formRef.current) return const formData = new FormData(formRef.current) const outcome = (formData.get('session-outcome') as SessionOutcome | null) ?? 'resolved' const outcomeNotes = ((formData.get('outcome-notes') as string | null) ?? '').trim() const nextSteps = ((formData.get('next-steps') as string | null) ?? '').trim() await onSubmit({ outcome, outcome_notes: outcomeNotes || undefined, next_steps: nextSteps || undefined, }) } return ( )} >

Select the session outcome before completion.

{OUTCOME_OPTIONS.map((option) => ( ))}