From 26cb64bdcc76aff9a261cce063c133b99f076b09 Mon Sep 17 00:00:00 2001 From: chihlasm Date: Sat, 7 Mar 2026 12:17:34 -0500 Subject: [PATCH] fix: AI Assist panel sits below topbar with slide-in animation - Panel now uses top:56px to sit below the app shell topbar instead of covering it (matches the main-content grid cell area) - Added slideInRight CSS animation for smooth drawer entrance - Editor pages use dynamic paddingRight via PANEL_WIDTH constant - ChatTab upgraded: markdown rendering, CopilotPanel-style message bubbles, auto-focus input, Shift+Enter hint - All borders use --glass-border for consistent glassmorphism Co-Authored-By: Claude Opus 4.6 --- frontend/src/components/editor-ai/ChatTab.tsx | 50 ++++++++++++------- .../components/editor-ai/EditorAIPanel.tsx | 28 ++++++++--- .../src/components/editor-ai/NodeSummary.tsx | 4 +- frontend/src/index.css | 5 ++ frontend/src/pages/ProceduralEditorPage.tsx | 4 +- frontend/src/pages/TreeEditorPage.tsx | 4 +- 6 files changed, 65 insertions(+), 30 deletions(-) diff --git a/frontend/src/components/editor-ai/ChatTab.tsx b/frontend/src/components/editor-ai/ChatTab.tsx index a5ad067e..7849bbe2 100644 --- a/frontend/src/components/editor-ai/ChatTab.tsx +++ b/frontend/src/components/editor-ai/ChatTab.tsx @@ -1,5 +1,6 @@ import { useRef, useEffect } from 'react' -import { Send, Sparkles } from 'lucide-react' +import { Send, Sparkles, Loader2 } from 'lucide-react' +import { MarkdownContent } from '@/components/ui/MarkdownContent' import type { EditorAIChatMessage } from '@/types' interface ChatTabProps { @@ -12,11 +13,17 @@ interface ChatTabProps { 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() @@ -26,7 +33,8 @@ export function ChatTab({ messages, input, onInputChange, onSend, isLoading }: C return (
-
+ {/* Messages */} +
{messages.length === 0 && (
@@ -36,44 +44,52 @@ export function ChatTab({ messages, input, onInputChange, onSend, isLoading }: C {messages.map((msg, i) => (
-

{msg.content}

+
+ +
))} {isLoading && ( -
-
-
-
-
+
+
+
)}
-
+ + {/* Input */} +