Skip to content

Commit 3f72cb5

Browse files
joeizangyann300
authored andcommitted
minimize when focus is lost.
1 parent 22a9143 commit 3f72cb5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

libs/remix-ui/remix-ai-assistant/src/components/remix-ui-remix-ai-assistant.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export const RemixUiRemixAiAssistant = React.forwardRef<
5252
const modelBtnRef = useRef(null)
5353
const contextBtnRef = useRef(null)
5454
const textareaRef = useRef<HTMLTextAreaElement>(null)
55+
const aiChatRef = useRef<HTMLDivElement>(null)
5556

5657
useOnClickOutside([modelBtnRef, contextBtnRef], () => setShowAssistantOptions(false))
5758
useOnClickOutside([modelBtnRef, contextBtnRef], () => setShowContextOptions(false))
@@ -468,9 +469,17 @@ export const RemixUiRemixAiAssistant = React.forwardRef<
468469
}
469470
}, [messages])
470471

472+
const maximizePanel = async () => {
473+
await props.plugin.call('layout', 'maximisePinnedPanel')
474+
}
475+
471476
return (
472477
<div
473478
className="d-flex flex-column h-100 w-100"
479+
ref={aiChatRef}
480+
onBlur={async () => {
481+
await props.plugin.call('layout', 'resetPinnedPanel')
482+
}}
474483
>
475484
<section id="remix-ai-chat-history" className="h-83 d-flex flex-column align-items-center p-2 overflow-x-hidden" style={{ flex: 7, overflowY: 'scroll' }} ref={chatHistoryRef}>
476485
<div data-id="remix-ai-assistant-ready"></div>
@@ -506,6 +515,7 @@ export const RemixUiRemixAiAssistant = React.forwardRef<
506515
)}
507516
<PromptArea
508517
input={input}
518+
maximizePanel={maximizePanel}
509519
setInput={setInput}
510520
isStreaming={isStreaming}
511521
handleSend={handleSend}

0 commit comments

Comments
 (0)