import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog' import { Button } from '@/components/ui/button' import { X, Check } from 'lucide-react' import { useState, useRef, useEffect } from 'react' interface RenameRepoDialogProps { isOpen: boolean currentName: string derivedName: string onClose: () => void onSave: (name: string | null) => void } export function RenameRepoDialog({ isOpen, currentName, derivedName, onClose, onSave, }: RenameRepoDialogProps) { const [editName, setEditName] = useState(currentName) const inputRef = useRef(null) useEffect(() => { if (isOpen) { setEditName(currentName) } }, [isOpen, currentName]) const handleSubmit = (e: React.FormEvent) => { e.preventDefault() const trimmed = editName.trim() onSave(trimmed.length > 0 ? trimmed : null) onClose() } const handleCancel = () => { setEditName(currentName) onClose() } return ( Rename repository
setEditName(e.target.value)} placeholder={derivedName} className="text-base font-semibold bg-background border border-border rounded-md px-3 py-2.5 pr-10 outline-none w-full focus:border-primary focus:ring-2 focus:ring-primary/20" autoFocus /> {editName && ( )}
) }