From c5d07ce90a6b444cfe6b7a5eecfcb8f7b3152e76 Mon Sep 17 00:00:00 2001 From: chihlasm Date: Fri, 6 Mar 2026 23:31:23 -0500 Subject: [PATCH] feat: add EditorAIPanel component with Chat and Suggestions tabs Co-Authored-By: Claude Opus 4.6 --- frontend/src/components/editor-ai/ChatTab.tsx | 80 +++++++++++++++ .../components/editor-ai/EditorAIPanel.tsx | 97 +++++++++++++++++++ .../src/components/editor-ai/NodeSummary.tsx | 59 +++++++++++ .../components/editor-ai/SuggestionsTab.tsx | 50 ++++++++++ 4 files changed, 286 insertions(+) create mode 100644 frontend/src/components/editor-ai/ChatTab.tsx create mode 100644 frontend/src/components/editor-ai/EditorAIPanel.tsx create mode 100644 frontend/src/components/editor-ai/NodeSummary.tsx create mode 100644 frontend/src/components/editor-ai/SuggestionsTab.tsx diff --git a/frontend/src/components/editor-ai/ChatTab.tsx b/frontend/src/components/editor-ai/ChatTab.tsx new file mode 100644 index 00000000..a5ad067e --- /dev/null +++ b/frontend/src/components/editor-ai/ChatTab.tsx @@ -0,0 +1,80 @@ +import { useRef, useEffect } from 'react' +import { Send, Sparkles } from 'lucide-react' +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) + + useEffect(() => { + messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' }) + }, [messages]) + + const handleKeyDown = (e: React.KeyboardEvent) => { + if (e.key === 'Enter' && !e.shiftKey) { + e.preventDefault() + if (input.trim() && !isLoading) onSend() + } + } + + return ( +
+
+ {messages.length === 0 && ( +
+ +

Ask me to help build your flow

+
+ )} + {messages.map((msg, i) => ( +
+

{msg.content}

+
+ ))} + {isLoading && ( +
+
+
+
+
+
+
+ )} +
+
+
+
+