import { useRef, useEffect } from 'react' import { Send, Sparkles, Loader2 } from 'lucide-react' import { MarkdownContent } from '@/components/ui/MarkdownContent' import type { EditorAIChatMessage } from '@/types' interface ChatTabProps { messages: EditorAIChatMessage[] input: string onInputChange: (value: string) => void onSend: () => void isLoading: boolean } export function ChatTab({ messages, input, onInputChange, onSend, isLoading }: ChatTabProps) { const messagesEndRef = useRef(null) const inputRef = useRef(null) useEffect(() => { messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' }) }, [messages]) // Focus input when panel mounts useEffect(() => { requestAnimationFrame(() => inputRef.current?.focus()) }, []) const handleKeyDown = (e: React.KeyboardEvent) => { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault() if (input.trim() && !isLoading) onSend() } } return (
{/* Messages */}
{messages.length === 0 && (

Ask me to help build your flow

)} {messages.map((msg, i) => (
))} {isLoading && (
)}
{/* Input */}