'use client' import * as React from 'react' import { cn } from '../../lib/utils' export interface StageTransitionModalProps { open: boolean onClose: () => void onConfirm: (targetStage: string, notes?: string) => void currentStage: string stages: Array<{ id: string; label: string }> entityName?: string isSubmitting?: boolean } export function StageTransitionModal({ open, onClose, onConfirm, currentStage, stages, entityName, isSubmitting = false, }: StageTransitionModalProps) { const [targetStage, setTargetStage] = React.useState('') const [notes, setNotes] = React.useState('') React.useEffect(() => { if (open) { // Default to the first stage that isn't the current one const firstOther = stages.find((s) => s.id !== currentStage) setTargetStage(firstOther?.id ?? '') setNotes('') } }, [open, currentStage, stages]) const handleConfirm = () => { if (!targetStage) return onConfirm(targetStage, notes.trim() || undefined) } const currentLabel = stages.find((s) => s.id === currentStage)?.label ?? currentStage if (!open) return null return (
Current Stage
{currentLabel}