"use client"; import { memo, useCallback, useEffect, useRef, useState } from "react"; import { Button } from "@/components/ui/button"; import { Textarea } from "@/components/ui/textarea"; type BoardChatComposerProps = { placeholder?: string; isSending?: boolean; onSend: (content: string) => Promise; }; function BoardChatComposerImpl({ placeholder = "Message the board lead. Tag agents with @name.", isSending = false, onSend, }: BoardChatComposerProps) { const [value, setValue] = useState(""); const textareaRef = useRef(null); const shouldFocusAfterSendRef = useRef(false); useEffect(() => { if (isSending) return; if (!shouldFocusAfterSendRef.current) return; shouldFocusAfterSendRef.current = false; textareaRef.current?.focus(); }, [isSending]); const send = useCallback(async () => { if (isSending) return; const trimmed = value.trim(); if (!trimmed) return; const ok = await onSend(trimmed); shouldFocusAfterSendRef.current = true; if (ok) { setValue(""); } }, [isSending, onSend, value]); return (