Skip to content

Commit a9cb0e2

Browse files
committed
fix AI display on click
1 parent d29524a commit a9cb0e2

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

apps/remix-ide/src/app/components/bottom-bar.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ export const BottomBar = ({ plugin }: BottomBarProps) => {
6464
}
6565
setExplaining(true)
6666
try {
67-
// Check if right side panel has a hidden plugin and show it
68-
const hiddenPlugin = await plugin.call('rightSidePanel', 'getHiddenPlugin')
69-
if (hiddenPlugin) await plugin.call('rightSidePanel', 'togglePanel')
67+
// Show right side panel if it's hidden
68+
const isPanelHidden = await plugin.call('rightSidePanel', 'isPanelHidden')
69+
if (isPanelHidden) {
70+
await plugin.call('rightSidePanel', 'togglePanel')
71+
}
7072

7173
await plugin.call('menuicons', 'select', 'remixaiassistant')
7274
await new Promise((resolve) => setTimeout(resolve, 500))

libs/remix-ui/editor/src/lib/remix-ui-editor.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,9 +1017,11 @@ export const EditorUI = (props: EditorUIProps) => {
10171017
const message = intl.formatMessage({ id: 'editor.explainFunctionByAI' }, { content:context, currentFunction: currentFunction.current })
10181018
await props.plugin.call('popupPanel', 'showPopupPanel', true)
10191019
setTimeout(async () => {
1020-
// Check if right side panel has a hidden plugin and show it
1021-
const hiddenPlugin = await props.plugin.call('rightSidePanel', 'getHiddenPlugin')
1022-
if (hiddenPlugin) await props.plugin.call('rightSidePanel', 'togglePanel')
1020+
// Show right side panel if it's hidden
1021+
const isPanelHidden = await props.plugin.call('rightSidePanel', 'isPanelHidden')
1022+
if (isPanelHidden) {
1023+
await props.plugin.call('rightSidePanel', 'togglePanel')
1024+
}
10231025
await props.plugin.call('remixAI' as any, 'chatPipe', 'code_explaining', message, context)
10241026
}, 500)
10251027
trackMatomoEvent<AIEvent>({ category: 'ai', action: 'remixAI', name: 'explainFunction', isClick: true })
@@ -1044,9 +1046,11 @@ export const EditorUI = (props: EditorUIProps) => {
10441046

10451047
await props.plugin.call('popupPanel', 'showPopupPanel', true)
10461048
setTimeout(async () => {
1047-
// Check if right side panel has a hidden plugin and show it
1048-
const hiddenPlugin = await props.plugin.call('rightSidePanel', 'getHiddenPlugin')
1049-
if (hiddenPlugin) await props.plugin.call('rightSidePanel', 'togglePanel')
1049+
// Show right side panel if it's hidden
1050+
const isPanelHidden = await props.plugin.call('rightSidePanel', 'isPanelHidden')
1051+
if (isPanelHidden) {
1052+
await props.plugin.call('rightSidePanel', 'togglePanel')
1053+
}
10501054
await props.plugin.call('remixAI' as any, 'chatPipe', 'code_explaining', selectedCode, content, pipeMessage)
10511055
}, 500)
10521056
trackMatomoEvent<AIEvent>({ category: 'ai', action: 'remixAI', name: 'explainFunction', isClick: true })

0 commit comments

Comments
 (0)