import { useState } from 'react' import { X } from 'lucide-react' import { cn } from '@/lib/utils' interface SaveSessionAsTreeModalProps { isOpen: boolean onClose: () => void onSave: (data: { tree_name?: string; description?: string; status: 'draft' | 'published' }) => Promise defaultTreeName?: string isSaving?: boolean } export function SaveSessionAsTreeModal({ isOpen, onClose, onSave, defaultTreeName, isSaving = false }: SaveSessionAsTreeModalProps) { const [treeName, setTreeName] = useState(defaultTreeName || '') const [description, setDescription] = useState('') const [status, setStatus] = useState<'draft' | 'published'>('draft') if (!isOpen) return null const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() await onSave({ tree_name: treeName.trim() || undefined, description: description.trim() || undefined, status }) } return (
{/* Header */}

Save Session as Tree

{/* Info */}

Create a new tree from this session's path. The tree will be linked to the original tree as a fork.

{/* Form */}
{/* Tree Name */}
setTreeName(e.target.value)} placeholder={defaultTreeName || "Auto-generated if left blank"} disabled={isSaving} maxLength={255} className={cn( 'w-full rounded-md border border-input bg-background px-3 py-2 text-sm', 'placeholder:text-muted-foreground', 'focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary', 'disabled:opacity-50' )} />
{/* Description */}