diff --git a/apps/postgres-new/components/chat.tsx b/apps/postgres-new/components/chat.tsx index 65b40f75..bbe5cbd4 100644 --- a/apps/postgres-new/components/chat.tsx +++ b/apps/postgres-new/components/chat.tsx @@ -25,6 +25,7 @@ import { useApp } from './app-provider' import ChatMessage from './chat-message' import SignInButton from './sign-in-button' import { useWorkspace } from './workspace' +import { TextArea } from './ui/textarea' export function getInitialMessages(tables: TablesData): Message[] { return [ @@ -207,6 +208,19 @@ export default function Chat() { }, })) + // dynamically resize the input textarea + useEffect(() => { + if (inputRef) { + if (inputRef.current && !input) { + inputRef.current.style.height = '26px' + } else if (inputRef && inputRef.current) { + inputRef.current.style.height = 'auto' + const newHeight = inputRef.current.scrollHeight + 'px' + inputRef.current.style.height = newHeight + } + } + }, [input, inputRef]) + return (
{isDraggingOver && ( @@ -457,12 +471,13 @@ export default function Chat() { > +