import { useState, useRef, useEffect } from "react"; import { useBoardStore } from "@/stores/board-store"; interface AddCardInputProps { columnId: string; onClose: () => void; } export function AddCardInput({ columnId, onClose }: AddCardInputProps) { const [value, setValue] = useState(""); const textareaRef = useRef(null); const addCard = useBoardStore((s) => s.addCard); useEffect(() => { textareaRef.current?.focus(); }, []); function handleSubmit() { const trimmed = value.trim(); if (trimmed) { addCard(columnId, trimmed); setValue(""); // Keep the input open for quick multi-add textareaRef.current?.focus(); } } function handleKeyDown(e: React.KeyboardEvent) { if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); handleSubmit(); } else if (e.key === "Escape") { onClose(); } } return (