diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index 3db6ed2a5ed..8f31a868bc3 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -72,7 +72,8 @@ const requiredModules = [ 'codeFormatter', 'solidityumlgen', 'contractflattener', - 'solidity-script' + 'solidity-script', + 'openaigpt' ] // dependentModules shouldn't be manually activated (e.g hardhat is activated by remixd) diff --git a/libs/remix-ui/renderer/src/lib/renderer.css b/libs/remix-ui/renderer/src/lib/renderer.css index 8de6d72419f..28b6475f574 100644 --- a/libs/remix-ui/renderer/src/lib/renderer.css +++ b/libs/remix-ui/renderer/src/lib/renderer.css @@ -40,8 +40,6 @@ .remixui_sol.success a, .remixui_sol.error a, .remixui_sol.warning a { - position: absolute; bottom: 0; right: 0; - padding: 0.25rem; } diff --git a/libs/remix-ui/renderer/src/lib/renderer.tsx b/libs/remix-ui/renderer/src/lib/renderer.tsx index ac491b28d8f..34b956ee7f5 100644 --- a/libs/remix-ui/renderer/src/lib/renderer.tsx +++ b/libs/remix-ui/renderer/src/lib/renderer.tsx @@ -2,6 +2,8 @@ import React, {useEffect, useState} from 'react' //eslint-disable-line import {CopyToClipboard} from '@remix-ui/clipboard' import {helper} from '@remix-project/remix-solidity' import './renderer.css' +const _paq = (window._paq = window._paq || []) + interface RendererProps { message: any opt?: any @@ -76,6 +78,7 @@ export const Renderer = ({message, opt = {}, plugin}: RendererProps) => { explain why the error occurred and how to fix it. ` await plugin.call('openaigpt', 'message', message) + _paq.push(['trackEvent', 'GPTSupport', 'askGPT']) } catch (err) { console.error('unable to askGtp') console.error(err) @@ -96,8 +99,12 @@ export const Renderer = ({message, opt = {}, plugin}: RendererProps) => {
- - { askGtp() }}>ASK GPT +
+ + + + { askGtp() }}>ASK GPT +
)} diff --git a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx index fe0245f766d..74b9999a2fe 100644 --- a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx +++ b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx @@ -734,9 +734,13 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { if (x.typewriter && !typeWriterIndexes.current.includes(index)) { typeWriterIndexes.current.push(index) return ( -
{ - typewrite(element, msg ? msg.toString() : null) - }} className={x.style}>
+
+ { + typewrite(element, msg ? msg.toString() : null, () => scrollToBottom() + ) + }} className={x.style}> + +
) } else { return ( @@ -751,7 +755,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { typeWriterIndexes.current.push(index) return (
{ - typewrite(element, x.message) + typewrite(element, x.message, () => scrollToBottom()) }} className={x.style}>
) } else { @@ -800,13 +804,19 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { ) } -const typewrite = (elementsRef, message) => { +const typewrite = (elementsRef, message, callback) => { (() => { let count = 0 const id = setInterval(() => { + if (!elementsRef) return count++ elementsRef.innerText = message.substr(0, count) - if (message === count) clearInterval(id) + // scroll when new line `
+ if (elementsRef.lastChild.tagName === `BR`) callback() + if (message.length === count) { + clearInterval(id) + callback() + } }, 5) })() }