import { useState } from "react"; import type { TaskWithSubtasks } from "../../lib/api"; interface BranchTaskModalProps { task: TaskWithSubtasks; onBranch: (taskId: string, message: string, name?: string) => Promise; onClose: () => void; } export function BranchTaskModal({ task, onBranch, onClose, }: BranchTaskModalProps) { const [name, setName] = useState(`Branch of ${task.name}`); const [message, setMessage] = useState(""); const [submitting, setSubmitting] = useState(false); const [error, setError] = useState(null); const handleSubmit = async () => { if (!message.trim()) { setError("Message is required"); return; } setSubmitting(true); setError(null); try { await onBranch(task.id, message.trim(), name.trim() || undefined); onClose(); } catch (err) { setError(err instanceof Error ? err.message : "Failed to create branch"); } finally { setSubmitting(false); } }; return (
{/* Header */}
*

Branch Task

{/* Content */}
{/* Source task info */}

Branching From

{task.name}

Status: {task.status}

{/* Name input */}
setName(e.target.value)} placeholder="Enter branch task name..." className="w-full px-3 py-2 bg-[#0d1b2d] border border-[#3f6fb3] text-[#dbe7ff] font-mono text-sm focus:outline-none focus:border-[#75aafc]" />
{/* Message input */}