"use client"; import { useEffect, useRef, useState } from "react"; type CommandConsoleProps = { isProcessing: boolean; onSubmit: (value: string) => void; }; export default function CommandConsole({ isProcessing, onSubmit, }: CommandConsoleProps) { const [value, setValue] = useState(""); const textareaRef = useRef(null); useEffect(() => { if (!textareaRef.current) return; textareaRef.current.style.height = "0px"; const nextHeight = Math.min(textareaRef.current.scrollHeight, 220); textareaRef.current.style.height = `${nextHeight}px`; }, [value]); const handleSubmit = () => { if (isProcessing) return; const trimmed = value.trim(); if (!trimmed) return; onSubmit(trimmed); setValue(""); }; return (
{ event.preventDefault(); handleSubmit(); }} >