Merge branch 'master' into ai_setting

pull/4787/head
STetsing 6 months ago committed by GitHub
commit 7d1e738322
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      apps/remix-ide/src/app/components/vertical-icons.tsx
  2. 7
      apps/remix-ide/src/app/tabs/locales/en/remixUiTabs.json
  3. 8
      apps/remix-ide/src/app/tabs/locales/en/udapp.json
  4. 16
      libs/remix-ui/run-tab/src/lib/components/account.tsx
  5. 13
      libs/remix-ui/run-tab/src/lib/components/environment.tsx
  6. 26
      libs/remix-ui/run-tab/src/lib/components/gasLimit.tsx
  7. 51
      libs/remix-ui/run-tab/src/lib/components/value.tsx
  8. 18
      libs/remix-ui/settings/src/lib/remix-ui-settings.tsx
  9. 169
      libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx

@ -73,7 +73,10 @@ export class VerticalIcons extends Plugin {
Object.keys(this.icons).map((o) => {
this.icons[o].active = false
})
this.icons[name].active = true
if (this.icons[name]) {
this.icons[name].active = true
}
this.renderComponent()
})
}

@ -1,12 +1,13 @@
{
"remixUiTabs.tooltipText1": "Run script (CTRL + SHIFT + S)",
"remixUiTabs.tooltipText2": "Compile CTRL + S",
"remixUiTabs.tooltipText3": "Select .sol or .yul file to compile or a .ts or .js file and run it",
"remixUiTabs.tooltipText4": "Select .sol file to use AI tools [BETA]",
"remixUiTabs.tooltipText3": "Select .sol or .yul file to compile OR a .ts or .js file to run",
"remixUiTabs.tooltipText4": "To explain a contract, choose a .sol file",
"remixUiTabs.tooltipText5": "Explain the contract(s) in current file [BETA]",
"remixUiTabs.tooltipText6": "Enable Remix AI Copilot [BETA]",
"remixUiTabs.tooltipText7": "Disable Remix AI Copilot [BETA]",
"remixUiTabs.tooltipText8": "Remix AI Tools Documentation [BETA]",
"remixUiTabs.tooltipText8": "Remix AI Tools Documentation",
"remixUiTabs.tooltipTextDisabledCopilot": "To use Remix AI Copilot, choose a .sol file",
"remixUiTabs.zoomOut": "Zoom out",
"remixUiTabs.zoomIn": "Zoom in"
}

@ -9,7 +9,7 @@
"udapp._comment_value.tsx": "libs/remix-ui/run-tab/src/lib/components/value.tsx",
"udapp.value": "Value",
"udapp.tooltipText5": "Enter an amount and choose its unit",
"udapp.tooltipText5": "Enter an amount to be sent with transaction and choose its unit",
"udapp._comment_contractDropdownUI.tsx": "libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx",
"udapp.contract": "Contract",
@ -50,15 +50,15 @@
"udapp.hash": "hash",
"udapp.signature": "signature",
"udapp.injectedTitle": "Unfortunately it's not possible to create an account using injected provider. Please create the account directly from your provider (i.e metamask or other of the same type).",
"udapp.createNewAccount": "Create a new account",
"udapp.createNewAccount": "Create new account",
"udapp.web3Title": "Creating an account is possible only in Personal mode. Please go to Settings to enable it.",
"udapp.defaultTitle": "Unfortunately it's not possible to create an account using an external wallet ({selectExEnv}).",
"udapp.text1": "Please provide a Passphrase for the account creation",
"udapp.tooltipText1": "Account list is empty, please make sure the current provider is properly connected to remix",
"udapp.modalTitle1": "Passphrase to sign a message",
"udapp.modalMessage1": "Enter your passphrase for this account to sign the message",
"udapp.copyAccount": "Copy account to clipboard",
"udapp.signMsgUsingAccount": "Sign a message using this account",
"udapp.copyAccount": "Copy account",
"udapp.signMsgUsingAccount": "Sign using this account",
"udapp._comment_environment.tsx": "libs/remix-ui/run-tab/src/lib/components/environment.tsx",
"udapp.environment": "Environment",

@ -200,11 +200,17 @@ export function AccountUI(props: AccountProps) {
<div className="udapp_crow">
<label className="udapp_settingsLabel">
<FormattedMessage id="udapp.account" />
<CustomTooltip placement={'top-start'} tooltipClasses="text-wrap" tooltipId="remixPlusWrapperTooltip" tooltipText={plusOpt.title}>
<CustomTooltip placement={'top'} tooltipClasses="text-wrap" tooltipId="remixPlusWrapperTooltip" tooltipText={plusOpt.title}>
<span id="remixRunPlusWraper">
<i id="remixRunPlus" className={`fas fa-plus-circle udapp_icon ${plusOpt.classList}`} aria-hidden="true" onClick={newAccount}></i>
<i id="remixRunPlus" className={`ml-2 fas fa-plus-circle udapp_icon ${plusOpt.classList}`} aria-hidden="true" onClick={newAccount}></i>
</span>
</CustomTooltip>
<CustomTooltip placement={'top'} tooltipClasses="text-nowrap" tooltipId="remixSignMsgTooltip" tooltipText={<FormattedMessage id="udapp.signMsgUsingAccount" />}>
<i id="remixRunSignMsg" data-id="settingsRemixRunSignMsg" className="ml-2 fas fa-edit udapp_icon" aria-hidden="true" onClick={signMessage}></i>
</CustomTooltip>
<span >
<CopyToClipboard className="fas fa-copy ml-2 p-0" tip={intl.formatMessage({ id: 'udapp.copyAccount' })} content={selectedAccount} direction="top" />
</span>
{props.accounts.isRequesting && <i className="fa fa-spinner fa-pulse ml-2" aria-hidden="true"></i>}
</label>
<div className="udapp_account">
@ -224,12 +230,6 @@ export function AccountUI(props: AccountProps) {
</option>
))}
</select>
<div style={{ marginLeft: -5 }}>
<CopyToClipboard tip={intl.formatMessage({ id: 'udapp.copyAccount' })} content={selectedAccount} direction="top" />
</div>
<CustomTooltip placement={'top-start'} tooltipClasses="text-nowrap" tooltipId="remixSignMsgTooltip" tooltipText={<FormattedMessage id="udapp.signMsgUsingAccount" />}>
<i id="remixRunSignMsg" data-id="settingsRemixRunSignMsg" className="mx-1 fas fa-edit udapp_icon" aria-hidden="true" onClick={signMessage}></i>
</CustomTooltip>
</div>
</div>
)

@ -26,7 +26,12 @@ export function EnvironmentUI(props: EnvironmentProps) {
<CustomTooltip placement={'right'} tooltipClasses="text-nowrap" tooltipId="info-recorder" tooltipText={<FormattedMessage id="udapp.tooltipText2" />}>
<a href="https://chainlist.org/" target="_blank">
<i style={{ fontSize: 'medium' }} className={'ml-2 fad fa-plug'} aria-hidden="true"></i>
<i className={'ml-2 fas fa-plug'} aria-hidden="true"></i>
</a>
</CustomTooltip>
<CustomTooltip placement={'right'} tooltipClasses="text-wrap" tooltipId="runAndDeployAddresstooltip" tooltipText={<FormattedMessage id="udapp.environmentDocs" />}>
<a href="https://remix-ide.readthedocs.io/en/latest/run.html#environment" target="_blank" rel="noreferrer">
<i className="udapp_infoDeployAction ml-2 fas fa-info-circle"></i>
</a>
</CustomTooltip>
</label>
@ -65,12 +70,6 @@ export function EnvironmentUI(props: EnvironmentProps) {
))}
</Dropdown.Menu>
</Dropdown>
<CustomTooltip placement={'right-start'} tooltipClasses="text-wrap" tooltipId="runAndDeployAddresstooltip" tooltipText={<FormattedMessage id="udapp.environmentDocs" />}>
<a href="https://remix-ide.readthedocs.io/en/latest/run.html#environment" target="_blank" rel="noreferrer">
<i className="udapp_infoDeployAction ml-2 fas fa-info"></i>
</a>
</CustomTooltip>
</div>
</div>
)

@ -51,7 +51,7 @@ export function GasLimitUI(props: GasPriceProps) {
<FormattedMessage id="udapp.gasLimitAuto" />
</label>
</div>
<div className="d-flex pb-1 custom-control custom-radio">
<div className="d-flex custom-control custom-radio align-items-baseline">
<input
className="custom-control-input"
type="radio"
@ -61,20 +61,20 @@ export function GasLimitUI(props: GasPriceProps) {
checked={!gasLimitAuto}
id="glManualConfig"
/>
<label className="mb-1 w-100 form-check-label custom-control-label" htmlFor="glManualConfig" data-id="glManualConfiguration">
<label className="mb-1 w-50 form-check-label custom-control-label" htmlFor="glManualConfig" data-id="glManualConfiguration">
<FormattedMessage id="udapp.gasLimitManual" />
<CustomTooltip placement={'right'} tooltipClasses="text-nowrap" tooltipId="remixGasPriceTooltip" tooltipText={<FormattedMessage id="udapp.tooltipText4" />}>
<input
type="number"
ref={inputComponent}
disabled={gasLimitAuto}
className="mt-2 form-control"
id="gasLimit"
value={props.gasLimit === 0 ? currentGasLimit.current : props.gasLimit}
onChange={handleGasLimit}
/>
</CustomTooltip>
</label>
<CustomTooltip placement={'right'} tooltipClasses="text-nowrap" tooltipId="remixGasPriceTooltip" tooltipText={<FormattedMessage id="udapp.tooltipText4" />}>
<input
type="number"
ref={inputComponent}
disabled={gasLimitAuto}
className="form-control w-100 float-right"
id="gasLimit"
value={props.gasLimit === 0 ? currentGasLimit.current : props.gasLimit}
onChange={handleGasLimit}
/>
</CustomTooltip>
</div>
</div>
</div>

@ -49,7 +49,7 @@ export function ValueUI(props: ValueProps) {
<label className="udapp_settingsLabel" data-id="remixDRValueLabel">
<FormattedMessage id="udapp.value" />
</label>
<div className="udapp_gasValueContainer">
<div className="input-group udapp_gasValueContainer">
<CustomTooltip placement={'top-start'} tooltipClasses="text-nowrap" tooltipId="remixValueTooltip" tooltipText={<FormattedMessage id="udapp.tooltipText5" />}>
<input
ref={inputValue}
@ -57,36 +57,37 @@ export function ValueUI(props: ValueProps) {
min="0"
pattern="^[0-9]"
step="1"
className="form-control udapp_gasNval udapp_col2"
className="form-control"
id="value"
data-id="dandrValue"
onChange={validateValue}
value={props.sendValue}
/>
</CustomTooltip>
<select
name="unit"
value={props.sendUnit}
className="form-control p-1 udapp_gasNvalUnit udapp_col2_2 custom-select"
id="unit"
onChange={(e) => {
props.setUnit(e.target.value as 'ether' | 'finney' | 'gwei' | 'wei')
}}
>
<option data-unit="wei" value="wei">
Wei
</option>
<option data-unit="gwei" value="gwei">
Gwei
</option>
<option data-unit="finney" value="finney">
Finney
</option>
<option data-unit="ether" value="ether">
Ether
</option>
</select>
<div className="input-group-append">
<select
name="unit"
value={props.sendUnit}
className="custom-select"
id="unit"
onChange={(e) => {
props.setUnit(e.target.value as 'ether' | 'finney' | 'gwei' | 'wei')
}}
>
<option data-unit="wei" value="wei">
Wei
</option>
<option data-unit="gwei" value="gwei">
Gwei
</option>
<option data-unit="finney" value="finney">
Finney
</option>
<option data-unit="ether" value="ether">
Ether
</option>
</select>
</div>
</div>
</div>
)

@ -1,5 +1,7 @@
import { ViewPlugin } from '@remixproject/engine-web'
import React, {useState, useRef, useReducer, useEffect, useCallback} from 'react' // eslint-disable-line
import { CustomTooltip } from '@remix-ui/helper'
const _paq = (window._paq = window._paq || [])
import { AppModal, AlertModal, ModalTypes } from '@remix-ui/app'
import { labels, textDark, textSecondary } from './constants'
@ -449,9 +451,23 @@ export const RemixUiSettings = (props: RemixUiSettingsProps) => {
const copilotSettings = () => (
<div className="border-top">
<div className="card-body pt-3 pb-2">
<h6 className="card-title">
<h6 className="card-title d-inline">
<FormattedMessage id="settings.copilot" />
</h6>
<CustomTooltip placement="bottom" tooltipId="overlay-tooltip-aiDocumentation" tooltipText={<FormattedMessage id="remixUiTabs.tooltipText8" />}>
<span
data-id="remix_ai_docs"
id="remix_ai_docs"
className="btn pl-2 pr-0 py-0 d-inline ai-docs"
role='link'
onClick={()=>{
window.open("https://remix-ide.readthedocs.io/en/latest/ai.html")
_paq.push(['trackEvent', 'ai', 'solcoder', 'documentation'])
}}
>
<i aria-hidden="true" className="fas fa-book"></i>
</span>
</CustomTooltip>
<div className="pt-2 mb-0">
<div className="text-secondary mb-0 h6">

@ -193,7 +193,7 @@ export const TabsUI = (props: TabsUIProps) => {
>
<button
data-id="play-editor"
className="btn text-success py-0"
className="btn text-success pr-0 py-0 d-flex"
disabled={!(tabsState.currentExt === 'js' || tabsState.currentExt === 'ts' || tabsState.currentExt === 'sol' || tabsState.currentExt === 'circom' || tabsState.currentExt === 'vy')}
onClick={async () => {
const path = active().substr(active().indexOf('/') + 1, active().length)
@ -213,111 +213,82 @@ export const TabsUI = (props: TabsUIProps) => {
}
}}
>
<i className="fad fa-play"></i>
<i className="fas fa-play"></i>
</button>
</CustomTooltip>
<CustomTooltip
placement="bottom"
tooltipId="overlay-tooltip-explaination"
tooltipText={
<span>
{tabsState.currentExt === 'sol'? (
<FormattedMessage id="remixUiTabs.tooltipText5" />
) : (
<FormattedMessage id="remixUiTabs.tooltipText4" />
)}
</span>
}
>
<button
data-id="explain-editor"
id='explain_btn'
className='btn py-0 text-ai px-0 d-flex'
disabled={!(tabsState.currentExt === 'sol') || explaining}
onClick={async () => {
const path = active().substr(active().indexOf('/') + 1, active().length)
const content = await props.plugin.call('fileManager', 'readFile', path)
if (tabsState.currentExt === 'sol') {
setExplaining(true)
await props.plugin.call('solcoder', 'code_explaining', content)
setExplaining(false)
_paq.push(['trackEvent', 'ai', 'solcoder', 'explain_file'])
}
}}
>
<i className={`fa-solid fa-user-robot ${explaining ? 'loadingExplanation' : ''}`}></i>
<span
className="position-relative text-ai text-sm pl-1"
style={{ fontSize: "x-small", alignSelf: "end" }}
>
AI
</span>
</button>
</CustomTooltip>
<CustomTooltip
placement="bottom"
tooltipId="overlay-tooltip-copilot"
tooltipText={
<span>
{ tabsState.currentExt === 'sol'? (
!ai_switch ? (
<FormattedMessage id="remixUiTabs.tooltipText6" />
) : (<FormattedMessage id="remixUiTabs.tooltipText7" />)
) : (
<FormattedMessage id="remixUiTabs.tooltipText4" />
)}
</span>
}
>
<button
data-id="remix_ai_switch"
id='remix_ai_switch'
className="btn ai-switch text-ai pl-2 pr-0 py-0 d-flex"
disabled={ !(tabsState.currentExt === 'sol' ) }
onClick={async () => {
await props.plugin.call('settings', 'updateCopilotChoice', !ai_switch)
setAI_switch(!ai_switch)
ai_switch ? _paq.push(['trackEvent', 'ai', 'solcoder', 'copilot_enabled']) : _paq.push(['trackEvent', 'ai', 'solcoder', 'copilot_disabled'])
}}
<div className= "d-flex border-left ml-2 align-items-center" style={{ height: "3em" }}>
<CustomTooltip
placement="bottom"
tooltipId="overlay-tooltip-explaination"
tooltipText={
<span>
{tabsState.currentExt === 'sol'? (
<FormattedMessage id="remixUiTabs.tooltipText5" />
) : (
<FormattedMessage id="remixUiTabs.tooltipText4" />
)}
</span>
}
>
<i
className={ai_switch ? "fa-solid fa-toggle-on" : "fa-solid fa-toggle-off"}
></i>
<span
className="position-relative text-ai text-sm pl-1"
style={{ fontSize: "x-small", alignSelf: "end" }}
<button
data-id="explain-editor"
id='explain_btn'
className='btn text-ai pl-2 pr-0 py-0 d-flex'
disabled={!(tabsState.currentExt === 'sol') || explaining}
onClick={async () => {
const path = active().substr(active().indexOf('/') + 1, active().length)
const content = await props.plugin.call('fileManager', 'readFile', path)
if (tabsState.currentExt === 'sol') {
setExplaining(true)
await props.plugin.call('solcoder', 'code_explaining', content)
setExplaining(false)
_paq.push(['trackEvent', 'ai', 'solcoder', 'explain_file'])
}
}}
>
AI
</span>
</button>
</CustomTooltip>
<CustomTooltip placement="bottom" tooltipId="overlay-tooltip-aiDocumentation" tooltipText={<FormattedMessage id="remixUiTabs.tooltipText8" />}>
<span
data-id="remix_ai_docs"
id="remix_ai_docs"
className="btn pl-2 pr-0 py-0 d-flex ai-docs"
role='link'
onClick={()=>{
window.open("https://remix-ide.readthedocs.io/en/latest/ai.html")
_paq.push(['trackEvent', 'ai', 'solcoder', 'documentation'])
}}
<i className={`fas fa-user-robot ${explaining ? 'loadingExplanation' : ''}`}></i>
</button>
</CustomTooltip>
<CustomTooltip
placement="bottom"
tooltipId="overlay-tooltip-copilot"
tooltipText={
<span>
{ tabsState.currentExt === 'sol'? (
!ai_switch ? (
<FormattedMessage id="remixUiTabs.tooltipText6" />
) : (<FormattedMessage id="remixUiTabs.tooltipText7" />)
) : (
<FormattedMessage id="remixUiTabs.tooltipTextDisabledCopilot" />
)}
</span>
}
>
<i className="fa-solid fa-book text-ai"></i>
<span
className="position-relative text-ai text-sm pl-1"
style={{ fontSize: "x-small", alignSelf: "end" }}
<button
data-id="remix_ai_switch"
id='remix_ai_switch'
className="btn ai-switch text-ai pl-2 pr-0 py-0 d-flex"
disabled={!(tabsState.currentExt === 'sol' )}
onClick={async () => {
await props.plugin.call('settings', 'updateCopilotChoice', !ai_switch)
setAI_switch(!ai_switch)
ai_switch ? _paq.push(['trackEvent', 'ai', 'solcoder', 'copilot_enabled']) : _paq.push(['trackEvent', 'ai', 'solcoder', 'copilot_disabled'])
}}
>
AI
</span>
</span>
</CustomTooltip>
<i className={ai_switch ? "fas fa-toggle-on fa-lg" : "fas fa-toggle-off fa-lg"}></i>
</button>
</CustomTooltip>
</div>
<CustomTooltip placement="bottom" tooltipId="overlay-tooltip-zoom-out" tooltipText={<FormattedMessage id="remixUiTabs.zoomOut" />}>
<span data-id="tabProxyZoomOut" className="btn btn-sm px-2 fas fa-search-minus text-dark" onClick={() => props.onZoomOut()}></span>
</CustomTooltip>
<CustomTooltip placement="bottom" tooltipId="overlay-tooltip-run-zoom-in" tooltipText={<FormattedMessage id="remixUiTabs.zoomIn" />}>
<span data-id="tabProxyZoomIn" className="btn btn-sm px-2 fas fa-search-plus text-dark" onClick={() => props.onZoomIn()}></span>
</CustomTooltip>
<div className= "d-flex border-left ml-2 align-items-center" style={{ height: "3em" }}>
<CustomTooltip placement="bottom" tooltipId="overlay-tooltip-zoom-out" tooltipText={<FormattedMessage id="remixUiTabs.zoomOut" />}>
<span data-id="tabProxyZoomOut" className="btn fas fa-search-minus text-dark pl-2 pr-0 py-0 d-flex" onClick={() => props.onZoomOut()}></span>
</CustomTooltip>
<CustomTooltip placement="bottom" tooltipId="overlay-tooltip-run-zoom-in" tooltipText={<FormattedMessage id="remixUiTabs.zoomIn" />}>
<span data-id="tabProxyZoomIn" className="btn fas fa-search-plus text-dark pl-2 pr-0 py-0 d-flex" onClick={() => props.onZoomIn()}></span>
</CustomTooltip>
</div>
</div>
<Tabs
className="tab-scroll"

Loading…
Cancel
Save