import { useEffect, useRef, useState } from 'react'; interface Props { onSubmit: (body: string) => Promise; onCancel: () => void; } // Composer is the inline "add a comment" box shown under a line. export function Composer({ onSubmit, onCancel }: Props) { const [text, setText] = useState(''); const [busy, setBusy] = useState(false); const ref = useRef(null); useEffect(() => { ref.current?.focus(); }, []); const submit = async () => { if (!text.trim()) return; setBusy(true); try { await onSubmit(text.trim()); setText(''); } finally { setBusy(false); } }; return (