import { Plus, RefreshCw } from 'lucide-react'; import { useEffect, useState } from 'react'; type NewBranchModalProps = { isOpen: boolean; currentBranch: string; isCreatingBranch: boolean; onClose: () => void; onCreateBranch: (branchName: string) => Promise; }; export default function NewBranchModal({ isOpen, currentBranch, isCreatingBranch, onClose, onCreateBranch, }: NewBranchModalProps) { const [newBranchName, setNewBranchName] = useState(''); useEffect(() => { if (!isOpen) { setNewBranchName(''); } }, [isOpen]); const handleCreateBranch = async (): Promise => { const branchName = newBranchName.trim(); if (!branchName) { return false; } try { const success = await onCreateBranch(branchName); if (success) { setNewBranchName(''); onClose(); } return success; } catch (error) { console.error('Failed to create branch:', error); return false; } }; if (!isOpen) { return null; } return (

Create New Branch

setNewBranchName(event.target.value)} onKeyDown={(event) => { if (event.key === 'Enter' && !isCreatingBranch) { void handleCreateBranch(); } }} placeholder="feature/new-feature" className="w-full px-3 py-2 border border-border rounded-xl bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/30" autoFocus />

This will create a new branch from the current branch ({currentBranch})

); }