apply custom tooltip to run-tab

pull/3037/head
Joseph Izang 2 years ago
parent 9a1e6e63c0
commit 8cb07c10af
  1. 28
      libs/remix-ui/run-tab/src/lib/components/account.tsx
  2. 90
      libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx
  3. 211
      libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx
  4. 15
      libs/remix-ui/run-tab/src/lib/components/deployButton.tsx
  5. 14
      libs/remix-ui/run-tab/src/lib/components/deployInput.tsx
  6. 31
      libs/remix-ui/run-tab/src/lib/components/environment.tsx
  7. 15
      libs/remix-ui/run-tab/src/lib/components/gasPrice.tsx
  8. 26
      libs/remix-ui/run-tab/src/lib/components/instanceContainerUI.tsx
  9. 13
      libs/remix-ui/run-tab/src/lib/components/multiDeployInput.tsx
  10. 71
      libs/remix-ui/run-tab/src/lib/components/recorderCardUI.tsx
  11. 51
      libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx
  12. 20
      libs/remix-ui/run-tab/src/lib/components/value.tsx

@ -3,7 +3,7 @@ import React, { useEffect, useState, useRef } from 'react'
import { CopyToClipboard } from '@remix-ui/clipboard' import { CopyToClipboard } from '@remix-ui/clipboard'
import { AccountProps } from '../types' import { AccountProps } from '../types'
import { PassphrasePrompt } from './passphrase' import { PassphrasePrompt } from './passphrase'
import { OverlayTrigger, Tooltip } from 'react-bootstrap' import { CustomTooltip } from '@remix-ui/helper'
export function AccountUI (props: AccountProps) { export function AccountUI (props: AccountProps) {
const { selectedAccount, loadedAccounts } = props.accounts const { selectedAccount, loadedAccounts } = props.accounts
@ -151,15 +151,16 @@ export function AccountUI (props: AccountProps) {
<div className="udapp_crow"> <div className="udapp_crow">
<label className="udapp_settingsLabel"> <label className="udapp_settingsLabel">
Account Account
<OverlayTrigger placement={'top-start'} overlay={ <CustomTooltip
<Tooltip className="text-wrap" id="remixPlusWrapperTooltip"> placement={'top-start'}
<span>{plusOpt.title}</span> tooltipClasses="text-wrap"
</Tooltip> tooltipId="remixPlusWrapperTooltip"
}> tooltipText={plusOpt.title}
>
<span id="remixRunPlusWraper"> <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={`fas fa-plus-circle udapp_icon ${plusOpt.classList}`} aria-hidden="true" onClick={newAccount}></i>
</span> </span>
</OverlayTrigger> </CustomTooltip>
</label> </label>
<div className="udapp_account"> <div className="udapp_account">
<select id="txorigin" data-id="runTabSelectAccount" name="txorigin" className="form-control udapp_select custom-select pr-4" value={selectedAccount} onChange={(e) => { props.setAccount(e.target.value) }}> <select id="txorigin" data-id="runTabSelectAccount" name="txorigin" className="form-control udapp_select custom-select pr-4" value={selectedAccount} onChange={(e) => { props.setAccount(e.target.value) }}>
@ -168,13 +169,14 @@ export function AccountUI (props: AccountProps) {
} }
</select> </select>
<div style={{ marginLeft: -5 }}><CopyToClipboard tip='Copy account to clipboard' content={selectedAccount} direction='top' /></div> <div style={{ marginLeft: -5 }}><CopyToClipboard tip='Copy account to clipboard' content={selectedAccount} direction='top' /></div>
<OverlayTrigger placement={'top-start'} overlay={ <CustomTooltip
<Tooltip className="text-nowrap" id="remixSignMsgTooltip"> placement={'top-start'}
<span>{"Sign a message using this account"}</span> tooltipClasses="text-nowrap"
</Tooltip> tooltipId="remixSignMsgTooltip"
}> tooltipText={"Sign a message using this account"}
>
<i id="remixRunSignMsg" data-id="settingsRemixRunSignMsg" className="mx-1 fas fa-edit udapp_icon" aria-hidden="true" onClick={signMessage}></i> <i id="remixRunSignMsg" data-id="settingsRemixRunSignMsg" className="mx-1 fas fa-edit udapp_icon" aria-hidden="true" onClick={signMessage}></i>
</OverlayTrigger> </CustomTooltip>
</div> </div>
</div> </div>
) )

@ -2,10 +2,9 @@
import React, { useEffect, useRef, useState } from 'react' import React, { useEffect, useRef, useState } from 'react'
import { ContractDropdownProps, DeployMode } from '../types' import { ContractDropdownProps, DeployMode } from '../types'
import { ContractData, FuncABI } from '@remix-project/core-plugin' import { ContractData, FuncABI } from '@remix-project/core-plugin'
import { OverlayTrigger, Tooltip } from 'react-bootstrap' // eslint-disable-line
import * as ethJSUtil from 'ethereumjs-util' import * as ethJSUtil from 'ethereumjs-util'
import { ContractGUI } from './contractGUI' import { ContractGUI } from './contractGUI'
import { deployWithProxyMsg, upgradeWithProxyMsg } from '@remix-ui/helper' import { CustomTooltip, deployWithProxyMsg, upgradeWithProxyMsg } from '@remix-ui/helper'
const _paq = window._paq = window._paq || [] const _paq = window._paq = window._paq || []
export function ContractDropdownUI(props: ContractDropdownProps) { export function ContractDropdownUI(props: ContractDropdownProps) {
@ -259,41 +258,37 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
<div className="d-flex">{compilerName && compilerName !== '' && <label style={{ maxHeight: '0.6rem', lineHeight: '1rem' }} data-id="udappCompiledBy">(Compiled by <span className="text-capitalize"> {compilerName}</span>)</label>}</div> <div className="d-flex">{compilerName && compilerName !== '' && <label style={{ maxHeight: '0.6rem', lineHeight: '1rem' }} data-id="udappCompiledBy">(Compiled by <span className="text-capitalize"> {compilerName}</span>)</label>}</div>
</div> </div>
{props.remixdActivated ? {props.remixdActivated ?
<OverlayTrigger placement={'right'} overlay={ (<CustomTooltip
<Tooltip className="text-nowrap" id="info-sync-compiled-contract"> placement={'right'}
<div>Click here to import contracts compiled from an external framework.</div> tooltipClasses="text-wrap"
<div>This action is enabled when Remix is connected to an external framework (hardhat, truffle, foundry) through remixd.</div> tooltipId="info-sync-compiled-contract"
</Tooltip> tooltipText="Click here to import contracts compiled from an external framework.
}> This action is enabled when Remix is connected to an external framework (hardhat, truffle, foundry) through remixd."
>
<button className="btn d-flex py-0" onClick={_ => { <button className="btn d-flex py-0" onClick={_ => {
props.syncContracts() props.syncContracts()
_paq.push(['trackEvent', 'udapp', 'syncContracts', compilationSource ? compilationSource : 'compilationSourceNotYetSet']) _paq.push(['trackEvent', 'udapp', 'syncContracts', compilationSource ? compilationSource : 'compilationSourceNotYetSet'])
}}> }}>
<i style={{ cursor: 'pointer' }} className="fa fa-refresh mr-2 mt-2" aria-hidden="true"></i> <i style={{ cursor: 'pointer' }} className="fa fa-refresh mr-2 mt-2" aria-hidden="true"></i>
</button> </button>
</OverlayTrigger> </CustomTooltip>)
: null} : null}
</div> </div>
<div className="udapp_subcontainer"> <div className="udapp_subcontainer">
<OverlayTrigger <CustomTooltip
placement={"right"} placement={"right"}
overlay={ tooltipClasses="text-nowrap"
<Tooltip tooltipId="remixUdappContractNamesTooltip"
className="text-nowrap" tooltipText={contractOptions.title}
id="remixUdappContractNamesTooltip" >
> <select ref={contractsRef} value={currentContract} onChange={handleContractChange} className="udapp_contractNames custom-select" disabled={contractOptions.disabled} style={{ display: loadType === 'abi' && !isContractFile(currentFile) ? 'none' : 'block' }}>
<span>{contractOptions.title}</span> {(contractList[currentFile] || []).map((contract, index) => {
</Tooltip> return <option key={index} value={contract.alias}>
} {contract.alias} - {contract.file}
> </option>
<select ref={contractsRef} value={currentContract} onChange={handleContractChange} className="udapp_contractNames custom-select" disabled={contractOptions.disabled} style={{ display: loadType === 'abi' && !isContractFile(currentFile) ? 'none' : 'block' }}> })}
{(contractList[currentFile] || []).map((contract, index) => { </select>
return <option key={index} value={contract.alias}> </CustomTooltip>
{contract.alias} - {contract.file}
</option>
})}
</select>
</OverlayTrigger>
<span className="py-1" style={{ display: abiLabel.display }}>{abiLabel.content}</span> <span className="py-1" style={{ display: abiLabel.display }}>{abiLabel.content}</span>
</div> </div>
<div> <div>
@ -323,11 +318,12 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
onChange={handleCheckedIPFS} onChange={handleCheckedIPFS}
checked={props.ipfsCheckedState} checked={props.ipfsCheckedState}
/> />
<OverlayTrigger placement={'right'} overlay={ <CustomTooltip
<Tooltip className="text-wrap" id="remixIpfsUdappTooltip"> placement={'right'}
<span>Publishing the source code and metadata to IPFS facilitates source code verification <br />using Sourcify and will greatly foster contract adoption (auditing, debugging, calling it, etc...)</span> tooltipClasses="text-wrap"
</Tooltip> tooltipId="remixIpfsUdappTooltip"
}> tooltipText="Publishing the source code and metadata to IPFS facilitates source code verification using Sourcify and will greatly foster contract adoption (auditing, debugging, calling it, etc...)"
>
<label <label
htmlFor="deployAndRunPublishToIPFS" htmlFor="deployAndRunPublishToIPFS"
data-id="contractDropdownIpfsCheckboxLabel" data-id="contractDropdownIpfsCheckboxLabel"
@ -335,35 +331,37 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
> >
Publish to IPFS Publish to IPFS
</label> </label>
</OverlayTrigger> </CustomTooltip>
</div> </div>
</div> : '' </div> : ''
} }
</div> </div>
<div className="udapp_orLabel mt-2" style={{ display: loadType === 'abi' && !isContractFile(currentFile) ? 'none' : 'block' }}>or</div> <div className="udapp_orLabel mt-2" style={{ display: loadType === 'abi' && !isContractFile(currentFile) ? 'none' : 'block' }}>or</div>
<div className="udapp_button udapp_atAddressSect "> <div className="udapp_button udapp_atAddressSect ">
<OverlayTrigger placement={'top-end'} overlay={ <CustomTooltip
<Tooltip className="text-wrap" id="runAndDeployAddresstooltip"> placement={'top-end'}
<span>{atAddressOptions.title}</span> tooltipClasses="text-wrap"
</Tooltip> tooltipId="runAndDeployAddresstooltip"
}> tooltipText={atAddressOptions.title}
>
<div id="runAndDeployAtAdressButtonContainer" onClick={loadFromAddress} data-title={atAddressOptions.title}> <div id="runAndDeployAtAdressButtonContainer" onClick={loadFromAddress} data-title={atAddressOptions.title}>
<button className="udapp_atAddress btn btn-sm btn-info" id="runAndDeployAtAdressButton" disabled={atAddressOptions.disabled} style={{ pointerEvents: 'none' }} onClick={loadFromAddress} data-title={atAddressOptions.title} <button className="udapp_atAddress btn btn-sm btn-info" id="runAndDeployAtAdressButton" disabled={atAddressOptions.disabled} style={{ pointerEvents: 'none' }} onClick={loadFromAddress} data-title={atAddressOptions.title}
>At Address</button> >At Address</button>
</div> </div>
</OverlayTrigger> </CustomTooltip>
<OverlayTrigger placement={'top-end'} overlay={ <CustomTooltip
<Tooltip className="text-wrap" id="runAndDeployAddressInputtooltip"> placement={'top-end'}
<span>{"address of contract"}</span> tooltipClasses="text-wrap"
</Tooltip> tooltipId="runAndDeployAddressInputtooltip"
}> tooltipText={"address of contract"}
>
<input <input
ref={atAddressValue} ref={atAddressValue}
className="udapp_input udapp_ataddressinput ataddressinput form-control" className="udapp_input udapp_ataddressinput ataddressinput form-control"
placeholder="Load contract from Address" placeholder="Load contract from Address"
onChange={atAddressChanged} onChange={atAddressChanged}
/> />
</OverlayTrigger> </CustomTooltip>
</div> </div>
</div> </div>
</div> </div>

@ -5,6 +5,7 @@ import Web3 from 'web3'
import { ContractGUIProps } from '../types' import { ContractGUIProps } from '../types'
import { CopyToClipboard } from '@remix-ui/clipboard' import { CopyToClipboard } from '@remix-ui/clipboard'
import { OverlayTrigger, Tooltip } from 'react-bootstrap' import { OverlayTrigger, Tooltip } from 'react-bootstrap'
import { CustomTooltip } from '@remix-ui/helper'
const txFormat = remixLib.execution.txFormat const txFormat = remixLib.execution.txFormat
const txHelper = remixLib.execution.txHelper const txHelper = remixLib.execution.txHelper
@ -269,16 +270,11 @@ export function ContractGUI (props: ContractGUIProps) {
className="udapp_contractActionsContainerSingle pt-2" className="udapp_contractActionsContainerSingle pt-2"
style={{ display: toggleContainer ? "none" : "flex" }} style={{ display: toggleContainer ? "none" : "flex" }}
> >
<OverlayTrigger <CustomTooltip
placement={"right-start"} placement={"right-start"}
overlay={ tooltipClasses="text-wrap"
<Tooltip tooltipId="remixUdappInstanceButtonTooltip"
className="text-wrap" tooltipText={buttonOptions.title}
id="remixUdappInstanceButtonTooltip"
>
<span>{buttonOptions.title}</span>
</Tooltip>
}
> >
<button <button
onClick={handleActionClick} onClick={handleActionClick}
@ -288,19 +284,13 @@ export function ContractGUI (props: ContractGUIProps) {
> >
{title} {title}
</button> </button>
</OverlayTrigger> </CustomTooltip>
<OverlayTrigger <CustomTooltip
placement={"right"} placement={"right"}
overlay={ tooltipClasses="text-nowrap"
<Tooltip className="text-nowrap" id="remixContractGuiTooltip"> tooltipId="remixContractGuiTooltip"
<span> tooltipText={props.funcABI.type === "fallback" ||props.funcABI.type === "receive" ? `'(${props.funcABI.type}')`
{props.funcABI.type === "fallback" || : props.inputs}
props.funcABI.type === "receive"
? `'(${props.funcABI.type}')`
: props.inputs}
</span>
</Tooltip>
}
> >
<input <input
className="form-control" className="form-control"
@ -329,19 +319,26 @@ export function ContractGUI (props: ContractGUIProps) {
: "visible", : "visible",
}} }}
/> />
</OverlayTrigger> </CustomTooltip>
<i <CustomTooltip
className="fas fa-angle-down udapp_methCaret" tooltipText={title}
onClick={switchMethodViewOn} tooltipClasses="text-nowrap"
title={title} placement="bottom"
style={{ tooltipId="switchMethodViewOnTooltip"
visibility: !( >
props.funcABI.inputs && props.funcABI.inputs.length > 0 <i
) className="fas fa-angle-down udapp_methCaret"
? "hidden" onClick={switchMethodViewOn}
: "visible", title={title}
}} style={{
></i> visibility: !(
props.funcABI.inputs && props.funcABI.inputs.length > 0
)
? "hidden"
: "visible",
}}
></i>
</CustomTooltip>
</div> </div>
<div <div
className="udapp_contractActionsContainerMulti" className="udapp_contractActionsContainerMulti"
@ -359,13 +356,11 @@ export function ContractGUI (props: ContractGUIProps) {
return ( return (
<div className="udapp_multiArg" key={index}> <div className="udapp_multiArg" key={index}>
<label htmlFor={inp.name}> {inp.name}: </label> <label htmlFor={inp.name}> {inp.name}: </label>
<OverlayTrigger <CustomTooltip
placement="left-end" placement="left-end"
overlay={ tooltipId="udappContractActionsTooltip"
<Tooltip id="udappContractActionsTooltip" className="text-nowrap"> tooltipClasses="text-nowrap"
<span>{inp.name}</span> tooltipText={inp.name}
</Tooltip>
}
> >
<input <input
ref={(el) => { ref={(el) => {
@ -375,7 +370,7 @@ export function ContractGUI (props: ContractGUIProps) {
placeholder={inp.type} placeholder={inp.type}
data-id={`multiParamManagerInput${inp.name}`} data-id={`multiParamManagerInput${inp.name}`}
/> />
</OverlayTrigger> </CustomTooltip>
</div> </div>
); );
})} })}
@ -411,16 +406,11 @@ export function ContractGUI (props: ContractGUIProps) {
<label htmlFor="copyParameters">Parameters</label> <label htmlFor="copyParameters">Parameters</label>
</button> </button>
</CopyToClipboard> </CopyToClipboard>
<OverlayTrigger <CustomTooltip
placement={"right"} placement={"right"}
overlay={ tooltipClasses="text-nowrap"
<Tooltip tooltipId="remixUdappInstanceButtonTooltip"
className="text-nowrap" tooltipText={buttonOptions.title}
id="remixUdappInstanceButtonTooltip"
>
<span>{buttonOptions.title}</span>
</Tooltip>
}
> >
<button <button
type="button" type="button"
@ -430,7 +420,7 @@ export function ContractGUI (props: ContractGUIProps) {
> >
{buttonOptions.content} {buttonOptions.content}
</button> </button>
</OverlayTrigger> </CustomTooltip>
</div> </div>
</div> </div>
</div> </div>
@ -446,14 +436,20 @@ export function ContractGUI (props: ContractGUIProps) {
onChange={(e) => handleDeployProxySelect(e.target.checked)} onChange={(e) => handleDeployProxySelect(e.target.checked)}
checked={deployState.deploy} checked={deployState.deploy}
/> />
<label <CustomTooltip
htmlFor="deployWithProxy" tooltipText="An ERC1967 proxy contract will be deployed along with the selected implementation contract."
data-id="contractGUIDeployWithProxyLabel" placement={"right"}
className="m-0 form-check-label custom-control-label udapp_checkboxAlign" tooltipClasses="text-nowrap"
title="An ERC1967 proxy contract will be deployed along with the selected implementation contract." tooltipId="deployWithProxyTooltip"
> >
Deploy with Proxy <label
</label> htmlFor="deployWithProxy"
data-id="contractGUIDeployWithProxyLabel"
className="m-0 form-check-label custom-control-label udapp_checkboxAlign"
>
Deploy with Proxy
</label>
</CustomTooltip>
</div> </div>
<div> <div>
{props.initializerOptions && {props.initializerOptions &&
@ -489,15 +485,21 @@ export function ContractGUI (props: ContractGUIProps) {
{" "} {" "}
{inp.name}:{" "} {inp.name}:{" "}
</label> </label>
<input <CustomTooltip
ref={(el) => { tooltipText={inp.name}
initializeFields.current[index] = el; tooltipClasses="text-wrap"
}} tooltipId="initializeFieldsTooltip"
style={{ height: 32 }} placement="right"
className="form-control udapp_input" >
placeholder={inp.type} <input
title={inp.name} ref={(el) => {
/> initializeFields.current[index] = el;
}}
style={{ height: 32 }}
className="form-control udapp_input"
placeholder={inp.type}
/>
</CustomTooltip>
</div> </div>
); );
})} })}
@ -514,14 +516,20 @@ export function ContractGUI (props: ContractGUIProps) {
onChange={(e) => handleUpgradeImpSelect(e.target.checked)} onChange={(e) => handleUpgradeImpSelect(e.target.checked)}
checked={deployState.upgrade} checked={deployState.upgrade}
/> />
<label <CustomTooltip
htmlFor="upgradeImplementation" tooltipText="The implementation contract will be deployed and then the proxy contract will be updated with new implementation's address."
data-id="contractGUIUpgradeImplementationLabel" tooltipClasses="text-wrap"
className="m-0 form-check-label custom-control-label udapp_checkboxAlign" tooltipId="upgradeImplementationTooltip"
title="The implementation contract will be deployed and then the proxy contract will be updated with new implementation's address." placement="right"
> >
Upgrade with Proxy <label
</label> htmlFor="upgradeImplementation"
data-id="contractGUIUpgradeImplementationLabel"
className="m-0 form-check-label custom-control-label udapp_checkboxAlign"
>
Upgrade with Proxy
</label>
</CustomTooltip>
</div> </div>
<span onClick={handleToggleUpgradeImp}> <span onClick={handleToggleUpgradeImp}>
<i <i
@ -549,25 +557,52 @@ export function ContractGUI (props: ContractGUIProps) {
onChange={handleUseLastProxySelect} onChange={handleUseLastProxySelect}
checked={useLastProxy} checked={useLastProxy}
/> />
<label <CustomTooltip
htmlFor="proxyAddress" tooltipText="Select this option to use the last deployed ERC1967 contract on the current network."
data-id="contractGUIProxyAddressLabel" tooltipId="proxyAddressTooltip"
className="m-0 form-check-label custom-control-label udapp_checkboxAlign" placement="auto"
title="Select this option to use the last deployed ERC1967 contract on the current network." tooltipClasses="text-wrap"
style={{ fontSize: 12 }}
> >
Use last deployed ERC1967 contract <label
</label> htmlFor="proxyAddress"
data-id="contractGUIProxyAddressLabel"
className="m-0 form-check-label custom-control-label udapp_checkboxAlign"
style={{ fontSize: 12 }}
>
Use last deployed ERC1967 contract
</label>
</CustomTooltip>
</div> </div>
{ {
!useLastProxy ? !useLastProxy ?
<div className="mb-2"> <div className="mb-2">
<label className='mt-2 text-left d-block'>Proxy Address: </label> <label className="mt-2 text-left d-block">
<input style={{ height: 32 }} className="form-control udapp_input" data-id="ERC1967AddressInput" placeholder='proxy address' title='Enter previously deployed proxy address on the selected network' onChange={handleSetProxyAddress} onBlur={() => validateProxyAddress(proxyAddress) } /> Proxy Address:{" "}
{ proxyAddressError && <span className='text-lowercase' data-id="errorMsgProxyAddress" style={{ fontSize: '.8em' }}>{ proxyAddressError }</span> } </label>
</div> : <CustomTooltip
<span className='text-capitalize' data-id="lastDeployedERC1967Address" style={{ fontSize: '.8em' }}>{ proxyAddress || proxyAddressError }</span> tooltipText="Enter previously deployed proxy address on the selected network"
} placement="left"
tooltipId="ERC1967AddressInputTooltip"
tooltipClasses="text-nowrap"
>
<input
style={{ height: 32 }}
className="form-control udapp_input"
data-id="ERC1967AddressInput"
placeholder="proxy address"
onChange={handleSetProxyAddress}
/>
</CustomTooltip>
</div>
: (
<span
className="text-capitalize"
data-id="lastDeployedERC1967Address"
style={{ fontSize: ".8em" }}
>
{proxyAddress || "No proxy address available"}
</span>
)}
</div> </div>
</div> </div>
</> </>

@ -1,6 +1,7 @@
import React, { useState } from 'react' import React, { useState } from 'react'
import { DeployButtonProps } from '../types' import { DeployButtonProps } from '../types'
import { ButtonGroup, Dropdown, OverlayTrigger, Tooltip } from 'react-bootstrap' import { ButtonGroup, Dropdown } from 'react-bootstrap'
import { CustomTooltip } from '@remix-ui/helper'
export function DeployButton (props: DeployButtonProps) { export function DeployButton (props: DeployButtonProps) {
const [showOptions, setShowOptions] = useState<boolean>(false) const [showOptions, setShowOptions] = useState<boolean>(false)
@ -24,18 +25,16 @@ export function DeployButton (props: DeployButtonProps) {
} }
</Dropdown.Menu> </Dropdown.Menu>
</Dropdown> : </Dropdown> :
<OverlayTrigger <CustomTooltip
placement="right-start" placement="right-start"
overlay={ tooltipId="deployButtonTooltip"
<Tooltip id="deployButtonTooltip" className="text-nowrap"> tooltipClasses="text-nowrap"
<span>{props.buttonOptions.title}</span> tooltipText={props.buttonOptions.title}
</Tooltip>
}
> >
<button onClick={props.handleActionClick} className={`udapp_instanceButton ${props.buttonOptions.widthClass} btn btn-sm ${props.buttonOptions.classList}`} data-id={props.buttonOptions.dataId}> <button onClick={props.handleActionClick} className={`udapp_instanceButton ${props.buttonOptions.widthClass} btn btn-sm ${props.buttonOptions.classList}`} data-id={props.buttonOptions.dataId}>
Deploy Deploy
</button> </button>
</OverlayTrigger> </CustomTooltip>
} }
</> </>
) )

@ -1,5 +1,5 @@
import { CustomTooltip } from '@remix-ui/helper'
import React from 'react' import React from 'react'
import { OverlayTrigger, Tooltip } from 'react-bootstrap'
import { DeployInputProps } from '../types' import { DeployInputProps } from '../types'
import { DeployButton } from './deployButton' import { DeployButton } from './deployButton'
@ -7,13 +7,11 @@ export function DeployInput (props: DeployInputProps) {
return ( return (
<div className="udapp_contractActionsContainerSingle pt-2" style={{ display: 'flex' }}> <div className="udapp_contractActionsContainerSingle pt-2" style={{ display: 'flex' }}>
<DeployButton buttonOptions={props.buttonOptions} selectedIndex={props.selectedIndex} setSelectedIndex={props.setSelectedIndex} handleActionClick={props.handleActionClick} deployOptions={props.deployOptions} /> <DeployButton buttonOptions={props.buttonOptions} selectedIndex={props.selectedIndex} setSelectedIndex={props.setSelectedIndex} handleActionClick={props.handleActionClick} deployOptions={props.deployOptions} />
<OverlayTrigger <CustomTooltip
placement="right-start" placement="right-start"
overlay={ tooltipId="deployInputTooltip"
<Tooltip id="deployInputTooltip" className="text-nowrap"> tooltipClasses="text-nowrap"
<span>{props.funcABI.type === 'fallback' || props.funcABI.type === 'receive' ? `'(${props.funcABI.type}')` : props.inputs}</span> tooltipText={props.funcABI.type === 'fallback' || props.funcABI.type === 'receive' ? `'(${props.funcABI.type}')` : props.inputs}
</Tooltip>
}
> >
<input <input
className="form-control" className="form-control"
@ -24,7 +22,7 @@ export function DeployInput (props: DeployInputProps) {
ref={props.basicInputRef} ref={props.basicInputRef}
style={{ visibility: !props.inputs ? 'hidden' : 'visible' }} style={{ visibility: !props.inputs ? 'hidden' : 'visible' }}
/> />
</OverlayTrigger> </CustomTooltip>
</div> </div>
) )
} }

@ -2,8 +2,7 @@
import React from 'react' import React from 'react'
import { EnvironmentProps } from '../types' import { EnvironmentProps } from '../types'
import { Dropdown } from 'react-bootstrap' import { Dropdown } from 'react-bootstrap'
import { CustomMenu, CustomToggle } from '@remix-ui/helper' import { CustomMenu, CustomToggle, CustomTooltip } from '@remix-ui/helper'
import { OverlayTrigger, Tooltip } from 'react-bootstrap' // eslint-disable-line
export function EnvironmentUI (props: EnvironmentProps) { export function EnvironmentUI (props: EnvironmentProps) {
@ -29,13 +28,10 @@ export function EnvironmentUI (props: EnvironmentProps) {
return ( return (
<div className="udapp_crow"> <div className="udapp_crow">
<label id="selectExEnv" className="udapp_settingsLabel"> <label id="selectExEnv" className="udapp_settingsLabel">
Environment <OverlayTrigger placement={'right'} overlay={ Environment <CustomTooltip placement={'right'} tooltipClasses="text-nowrap" tooltipId="info-recorder"
<Tooltip className="text-nowrap" id="info-recorder"> tooltipText="Open chainlist and add a new provider for the chain you want to interact to.">
<span>Open chainlist and add a new provider for the chain you want to interact to.</span> <a href='https://chainlist.org/' target='_blank'><i style={{ fontSize: 'medium' }} className={'ml-2 fad fa-plug'} aria-hidden="true"></i></a>
</Tooltip> </CustomTooltip>
}>
<a href='https://chainlist.org/' target='_blank'><i style={{ fontSize: 'medium' }} className={'ml-2 fad fa-plug'} aria-hidden="true"></i></a>
</OverlayTrigger>
</label> </label>
<div className="udapp_environment"> <div className="udapp_environment">
@ -43,13 +39,9 @@ export function EnvironmentUI (props: EnvironmentProps) {
<Dropdown.Toggle as={CustomToggle} id="dropdown-custom-components" className="btn btn-light btn-block w-100 d-inline-block border border-dark form-control" icon={null}> <Dropdown.Toggle as={CustomToggle} id="dropdown-custom-components" className="btn btn-light btn-block w-100 d-inline-block border border-dark form-control" icon={null}>
{ isL2(currentProvider) && 'L2 - '} { isL2(currentProvider) && 'L2 - '}
{ currentProvider && currentProvider.content } { currentProvider && currentProvider.content }
{ currentProvider && bridges[currentProvider.value] && <OverlayTrigger placement={'right'} overlay={ { currentProvider && bridges[currentProvider.value] && <CustomTooltip placement={'right'} tooltipClasses="text-nowrap" tooltipId="info-recorder" tooltipText="Click to open a bridge for converting L1 mainnet ETH to the selected network currency.">
<Tooltip className="text-nowrap" id="info-recorder">
<span>Click to open a bridge for converting L1 mainnet ETH to the selected network currency.</span>
</Tooltip>
}>
<i style={{ fontSize: 'medium' }} className={'ml-2 fal fa-plug'} aria-hidden="true" onClick={() => { window.open(bridges[currentProvider.value], '_blank') }}></i> <i style={{ fontSize: 'medium' }} className={'ml-2 fal fa-plug'} aria-hidden="true" onClick={() => { window.open(bridges[currentProvider.value], '_blank') }}></i>
</OverlayTrigger>} </CustomTooltip>}
</Dropdown.Toggle> </Dropdown.Toggle>
<Dropdown.Menu as={CustomMenu} className='w-100 custom-dropdown-items' data-id="custom-dropdown-items" > <Dropdown.Menu as={CustomMenu} className='w-100 custom-dropdown-items' data-id="custom-dropdown-items" >
{ {
@ -67,13 +59,10 @@ export function EnvironmentUI (props: EnvironmentProps) {
} }
</Dropdown.Menu> </Dropdown.Menu>
</Dropdown> </Dropdown>
<OverlayTrigger placement={'bottom-start'} overlay={ <CustomTooltip placement={'bottom-start'} tooltipClasses="text-wrap" tooltipId="runAndDeployAddresstooltip"
<Tooltip className="text-wrap" id="runAndDeployAddresstooltip"> tooltipText={"Click for docs about Environment"}>
<span>{"Click for docs about Environment"}</span>
</Tooltip>
}>
<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> <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>
</OverlayTrigger> </CustomTooltip>
</div> </div>
</div> </div>
) )

@ -1,6 +1,6 @@
// eslint-disable-next-line no-use-before-define // eslint-disable-next-line no-use-before-define
import { CustomTooltip } from '@remix-ui/helper'
import React from 'react' import React from 'react'
import { OverlayTrigger, Tooltip } from 'react-bootstrap'
import { GasPriceProps } from '../types' import { GasPriceProps } from '../types'
export function GasPriceUI (props: GasPriceProps) { export function GasPriceUI (props: GasPriceProps) {
@ -11,13 +11,14 @@ export function GasPriceUI (props: GasPriceProps) {
return ( return (
<div className="udapp_crow"> <div className="udapp_crow">
<label className="udapp_settingsLabel">Gas limit</label> <label className="udapp_settingsLabel">Gas limit</label>
<OverlayTrigger placement={'right-end'} overlay={ <CustomTooltip
<Tooltip className="text-nowrap" id="remixGasPriceTooltip"> placement={'right-end'}
<span>{"The default gas limit is 3M. Adjust as needed."}</span> tooltipClasses="text-nowrap"
</Tooltip> tooltipId="remixGasPriceTooltip"
}> tooltipText={"The default gas limit is 3M. Adjust as needed."}
>
<input type="number" className="form-control udapp_gasNval udapp_col2" id="gasLimit" value={props.gasLimit} onChange={handleGasLimit} /> <input type="number" className="form-control udapp_gasNval udapp_col2" id="gasLimit" value={props.gasLimit} onChange={handleGasLimit} />
</OverlayTrigger> </CustomTooltip>
</div> </div>
) )
} }

@ -1,6 +1,6 @@
// eslint-disable-next-line no-use-before-define // eslint-disable-next-line no-use-before-define
import { CustomTooltip } from '@remix-ui/helper'
import React from 'react' import React from 'react'
import { OverlayTrigger, Tooltip } from 'react-bootstrap'
import { InstanceContainerProps } from '../types' import { InstanceContainerProps } from '../types'
import { UniversalDappUI } from './universalDappUI' import { UniversalDappUI } from './universalDappUI'
@ -14,31 +14,27 @@ export function InstanceContainerUI (props: InstanceContainerProps) {
return ( return (
<div className="udapp_instanceContainer mt-3 border-0 list-group-item"> <div className="udapp_instanceContainer mt-3 border-0 list-group-item">
<div className="d-flex justify-content-between align-items-center pl-2 mb-2"> <div className="d-flex justify-content-between align-items-center pl-2 mb-2">
<OverlayTrigger <CustomTooltip
placement="top-start" placement="top-start"
overlay={ tooltipClasses="text-nowrap"
<Tooltip className="text-nowrap" id="deployAndRunClearInstancesTooltip"> tooltipId="deployAndRunClearInstancesTooltip"
<span>{"Autogenerated generic user interfaces for interaction with deployed contracts"}</span> tooltipText={"Autogenerated generic user interfaces for interaction with deployed contracts"}
</Tooltip>
}
> >
<label className="udapp_deployedContracts"> <label className="udapp_deployedContracts">
Deployed Contracts Deployed Contracts
</label> </label>
</OverlayTrigger> </CustomTooltip>
{ instanceList.length > 0 { instanceList.length > 0
? ( ? (
<OverlayTrigger <CustomTooltip
placement="right" placement="right"
overlay={ tooltipClasses="text-nowrap"
<Tooltip className="text-nowrap" id="deployAndRunClearInstancesTooltip"> tooltipId="deployAndRunClearInstancesTooltip"
<span>{"Clear instances list and reset recorder"}</span> tooltipText={"Clear instances list and reset recorder"}
</Tooltip>
}
> >
<i className="mr-2 udapp_icon far fa-trash-alt" data-id="deployAndRunClearInstances" onClick={clearInstance} aria-hidden="true"> <i className="mr-2 udapp_icon far fa-trash-alt" data-id="deployAndRunClearInstances" onClick={clearInstance} aria-hidden="true">
</i> </i>
</OverlayTrigger> </CustomTooltip>
) : null ) : null
} }
</div> </div>

@ -1,3 +1,4 @@
import { CustomTooltip } from '@remix-ui/helper'
import React, { useRef, useState } from 'react' import React, { useRef, useState } from 'react'
import { OverlayTrigger, Tooltip } from 'react-bootstrap' import { OverlayTrigger, Tooltip } from 'react-bootstrap'
import { MultiDeployInputProps } from '../types' import { MultiDeployInputProps } from '../types'
@ -17,16 +18,14 @@ export function MultiDeployInput(props: MultiDeployInputProps) {
return ( return (
<div className="udapp_multiArg" key={index}> <div className="udapp_multiArg" key={index}>
<label htmlFor={inp.name}> {inp.name}: </label> <label htmlFor={inp.name}> {inp.name}: </label>
<OverlayTrigger <CustomTooltip
placement="left-end" placement="left-end"
overlay={ tooltipId="udappMultiArgTooltip"
<Tooltip id="udappMultiArgTooltip" className="text-nowrap"> tooltipClasses="text-nowrap"
<span>{inp.name}</span> tooltipText={inp.name}
</Tooltip>
}
> >
<input ref={el => { multiFields.current[index] = el }} className="form-control" placeholder={inp.type} data-id={`multiParamManagerInput${inp.name}`} /> <input ref={el => { multiFields.current[index] = el }} className="form-control" placeholder={inp.type} data-id={`multiParamManagerInput${inp.name}`} />
</OverlayTrigger> </CustomTooltip>
</div>) </div>)
})} })}
</div> </div>

@ -2,6 +2,7 @@
import React, {useRef, useState, useEffect} from 'react' import React, {useRef, useState, useEffect} from 'react'
import { RecorderProps } from '../types' import { RecorderProps } from '../types'
import { OverlayTrigger, Tooltip } from 'react-bootstrap' // eslint-disable-line import { OverlayTrigger, Tooltip } from 'react-bootstrap' // eslint-disable-line
import { CustomTooltip } from '@remix-ui/helper'
export function RecorderUI (props: RecorderProps) { export function RecorderUI (props: RecorderProps) {
const inputLive = useRef<HTMLInputElement>() const inputLive = useRef<HTMLInputElement>()
@ -31,21 +32,22 @@ export function RecorderUI (props: RecorderProps) {
<div className="udapp_recorderSection d-flex justify-content-between" onClick={toggleClass}> <div className="udapp_recorderSection d-flex justify-content-between" onClick={toggleClass}>
<div className="d-flex justify-content-center align-items-center"> <div className="d-flex justify-content-center align-items-center">
<label className="mt-1 udapp_recorderSectionLabel">Transactions recorded</label> <label className="mt-1 udapp_recorderSectionLabel">Transactions recorded</label>
<OverlayTrigger placement={'right'} overlay={ <CustomTooltip
<Tooltip className="text-nowrap" id="recordedTransactionsCounttooltip"> placement={'right'}
<span>{'The number of recorded transactions'}</span> tooltipClasses="text-nowrap"
</Tooltip> tooltipId="recordedTransactionsCounttooltip"
}> tooltipText={'The number of recorded transactions'}
>
<div className="ml-2 badge badge-pill badge-primary text-center" data-title="The number of recorded transactions">{props.count}</div> <div className="ml-2 badge badge-pill badge-primary text-center" data-title="The number of recorded transactions">{props.count}</div>
</OverlayTrigger> </CustomTooltip>
<OverlayTrigger placement={'right'} overlay={ <CustomTooltip
<Tooltip className="text-nowrap" id="info-recorder"> placement={'right'}
<span>Save transactions (deployed contracts and function executions) and replay them in another environment. <br/> e.g Transactions created in Remix VM can be replayed in the Injected Provider. tooltipClasses="text-wrap"
</span> tooltipId="info-recorder"
</Tooltip> tooltipText="Save transactions (deployed contracts and function executions) and replay them in another environment e.g Transactions created in Remix VM can be replayed in the Injected Provider."
}> >
<i style={{ fontSize: 'medium' }} className={'ml-2 fal fa-info-circle align-self-center'} aria-hidden="true"></i> <i style={{ fontSize: 'medium' }} className={'ml-2 fal fa-info-circle align-self-center'} aria-hidden="true"></i>
</OverlayTrigger> </CustomTooltip>
</div> </div>
<div className="p-3"> <div className="p-3">
<span data-id='udappRecorderTitleExpander' onClick={toggleClass}> <span data-id='udappRecorderTitleExpander' onClick={toggleClass}>
@ -56,43 +58,44 @@ export function RecorderUI (props: RecorderProps) {
<div className={`flex-column ${toggleExpander ? "d-flex" : "d-none"}`}> <div className={`flex-column ${toggleExpander ? "d-flex" : "d-none"}`}>
<div className="mb-1 mt-1 fmt-2 custom-control custom-checkbox mb-1"> <div className="mb-1 mt-1 fmt-2 custom-control custom-checkbox mb-1">
<input ref={inputLive} type="checkbox" id="livemode-recorder" className="custom-control-input custom-select" name="input-livemode"/> <input ref={inputLive} type="checkbox" id="livemode-recorder" className="custom-control-input custom-select" name="input-livemode"/>
<OverlayTrigger placement={'right'} overlay={ <CustomTooltip
<Tooltip className="text-nowrap" id="tooltip-livemode-recorder"> placement={'right'}
<span>If contracts are updated after recording transactions, checking this box<br/>will run recorded transactions with the latest copy of the compiled contracts</span> tooltipClasses="text-wrap"
</Tooltip> tooltipId="tooltip-livemode-recorder"
}> tooltipText="If contracts are updated after recording transactions, checking this box will run recorded transactions with the latest copy of the compiled contracts"
<label className="form-check-label custom-control-label" data-id="runtabLivemodeInput" htmlFor="livemode-recorder">Run transactions using the latest compilation result</label> >
</OverlayTrigger> <label className="form-check-label custom-control-label" data-id="runtabLivemodeInput" htmlFor="livemode-recorder">Run transactions using the latest compilation result</label>
</CustomTooltip>
</div> </div>
<div className="mb-1 mt-1 udapp_transactionActions"> <div className="mb-1 mt-1 udapp_transactionActions">
<OverlayTrigger placement={'bottom-start'} overlay={ <CustomTooltip
<Tooltip className="text-nowrap" id="remixUdappTransactionSavetooltip"> placement={'bottom-start'}
<span> tooltipClasses="text-nowrap"
{ tooltipId="remixUdappTransactionSavetooltip"
tooltipText={
props.count === 0 ? 'No transactions to save' props.count === 0 ? 'No transactions to save'
: props.count === 1 ? `Save ${props.count} transaction as scenario file` : props.count === 1 ? `Save ${props.count} transaction as scenario file`
: `Save ${props.count} transactions as scenario file` : `Save ${props.count} transactions as scenario file`
} }
</span> >
</Tooltip>
}>
<span> <span>
<button className="btn btn-sm btn-info savetransaction udapp_recorder" disabled={props.count === 0 ? true: false} onClick={triggerRecordButton} style={{ pointerEvents: props.count === 0 ? 'none' : 'auto' }}> <button className="btn btn-sm btn-info savetransaction udapp_recorder" disabled={props.count === 0 ? true: false} onClick={triggerRecordButton} style={{ pointerEvents: props.count === 0 ? 'none' : 'auto' }}>
Save Save
</button> </button>
</span> </span>
</OverlayTrigger> </CustomTooltip>
<OverlayTrigger placement={'right'} overlay={ <CustomTooltip
<Tooltip className="text-nowrap" id="tooltip-run-recorder"> placement={'right'}
<span>Run transaction(s) from the current scenario file</span> tooltipClasses="text-nowrap"
</Tooltip> tooltipId="tooltip-run-recorder"
}> tooltipText="Run transaction(s) from the current scenario file"
>
<span> <span>
<button className="btn btn-sm btn-info runtransaction udapp_runTxs" data-id="runtransaction" disabled={enableRunButton} onClick={handleClickRunButton} style={{ pointerEvents: enableRunButton ? 'none' : 'auto' }}> <button className="btn btn-sm btn-info runtransaction udapp_runTxs" data-id="runtransaction" disabled={enableRunButton} onClick={handleClickRunButton} style={{ pointerEvents: enableRunButton ? 'none' : 'auto' }}>
Run Run
</button> </button>
</span> </span>
</OverlayTrigger> </CustomTooltip>
</div> </div>
</div> </div>
</div> </div>

@ -7,9 +7,8 @@ import * as remixLib from '@remix-project/remix-lib'
import * as ethJSUtil from 'ethereumjs-util' import * as ethJSUtil from 'ethereumjs-util'
import { ContractGUI } from './contractGUI' import { ContractGUI } from './contractGUI'
import { TreeView, TreeViewItem } from '@remix-ui/tree-view' import { TreeView, TreeViewItem } from '@remix-ui/tree-view'
import { OverlayTrigger, Tooltip } from 'react-bootstrap' // eslint-disable-line
import { BN } from 'ethereumjs-util' import { BN } from 'ethereumjs-util'
import { is0XPrefixed, isHexadecimal, isNumeric, shortenAddress } from '@remix-ui/helper' import { CustomTooltip, is0XPrefixed, isHexadecimal, isNumeric, shortenAddress } from '@remix-ui/helper'
const txHelper = remixLib.execution.txHelper const txHelper = remixLib.execution.txHelper
@ -244,13 +243,11 @@ export function UniversalDappUI (props: UdappProps) {
</button> </button>
</div> </div>
</div> </div>
<OverlayTrigger <CustomTooltip
placement="right" placement="right"
overlay={ tooltipClasses="text-nowrap"
<Tooltip className="text-nowrap" id="udapp_udappCloseTooltip"> tooltipId="udapp_udappCloseTooltip"
<span>{'Remove from the list'}</span> tooltipText="Remove from the list"
</Tooltip>
}
> >
<button <button
className="udapp_udappClose mr-1 p-1 btn btn-secondary align-items-center" className="udapp_udappClose mr-1 p-1 btn btn-secondary align-items-center"
@ -259,7 +256,7 @@ export function UniversalDappUI (props: UdappProps) {
> >
<i className="udapp_closeIcon fas fa-times" aria-hidden="true"></i> <i className="udapp_closeIcon fas fa-times" aria-hidden="true"></i>
</button> </button>
</OverlayTrigger> </CustomTooltip>
</div> </div>
<div <div
className="udapp_cActionsWrapper" className="udapp_cActionsWrapper"
@ -335,13 +332,11 @@ export function UniversalDappUI (props: UdappProps) {
<div className="py-2 border-top d-flex justify-content-start flex-grow-1"> <div className="py-2 border-top d-flex justify-content-start flex-grow-1">
Low level interactions Low level interactions
</div> </div>
<OverlayTrigger <CustomTooltip
placement={"bottom-end"} placement={"bottom-end"}
overlay={ tooltipClasses="text-wrap"
<Tooltip className="text-wrap" id="receiveEthDocstoolTip"> tooltipId="receiveEthDocstoolTip"
<span>{"check out docs for using 'receive'/'fallback'"}</span> tooltipText={"check out docs for using 'receive'/'fallback'"}
</Tooltip>
}
> >
<a <a
href="https://solidity.readthedocs.io/en/v0.6.2/contracts.html#receive-ether-function" href="https://solidity.readthedocs.io/en/v0.6.2/contracts.html#receive-ether-function"
@ -350,32 +345,28 @@ export function UniversalDappUI (props: UdappProps) {
> >
<i aria-hidden="true" className="fas fa-info my-2 mr-1"></i> <i aria-hidden="true" className="fas fa-info my-2 mr-1"></i>
</a> </a>
</OverlayTrigger> </CustomTooltip>
</div> </div>
<div className="d-flex flex-column align-items-start"> <div className="d-flex flex-column align-items-start">
<label className="">CALLDATA</label> <label className="">CALLDATA</label>
<div className="d-flex justify-content-end w-100 align-items-center"> <div className="d-flex justify-content-end w-100 align-items-center">
<OverlayTrigger <CustomTooltip
placement="bottom" placement="bottom"
overlay={ tooltipClasses="text-nowrap"
<Tooltip className="text-nowrap" id="deployAndRunLLTxCalldataInputTooltip"> tooltipId="deployAndRunLLTxCalldataInputTooltip"
<span>{"The Calldata to send to fallback function of the contract."}</span> tooltipText="The Calldata to send to fallback function of the contract."
</Tooltip>
}
> >
<input <input
id="deployAndRunLLTxCalldata" id="deployAndRunLLTxCalldata"
onChange={handleCalldataChange} onChange={handleCalldataChange}
className="udapp_calldataInput form-control" className="udapp_calldataInput form-control"
/> />
</OverlayTrigger> </CustomTooltip>
<OverlayTrigger <CustomTooltip
placement="right" placement="right"
overlay={ tooltipClasses="text-nowrap"
<Tooltip className="text-nowrap" id="deployAndRunLLTxCalldataTooltip"> tooltipId="deployAndRunLLTxCalldataTooltip"
<span>Send data to contract.</span> tooltipText="Send data to contract."
</Tooltip>
}
> >
<button <button
id="deployAndRunLLTxSendTransaction" id="deployAndRunLLTxSendTransaction"
@ -385,7 +376,7 @@ export function UniversalDappUI (props: UdappProps) {
> >
Transact Transact
</button> </button>
</OverlayTrigger> </CustomTooltip>
</div> </div>
</div> </div>
<div> <div>

@ -1,9 +1,8 @@
// eslint-disable-next-line no-use-before-define // eslint-disable-next-line no-use-before-define
import React, { useEffect, useRef, useState } from 'react' import React, { useEffect, useRef, useState } from 'react'
import { BN } from 'ethereumjs-util' import { BN } from 'ethereumjs-util'
import { isNumeric } from '@remix-ui/helper' import { CustomTooltip, isNumeric } from '@remix-ui/helper'
import { ValueProps } from '../types' import { ValueProps } from '../types'
import { OverlayTrigger, Tooltip } from 'react-bootstrap'
export function ValueUI (props: ValueProps) { export function ValueUI (props: ValueProps) {
const [sendValue, setSendValue] = useState<string>(props.sendValue) const [sendValue, setSendValue] = useState<string>(props.sendValue)
@ -50,11 +49,12 @@ export function ValueUI (props: ValueProps) {
<div className="udapp_crow"> <div className="udapp_crow">
<label className="udapp_settingsLabel" data-id="remixDRValueLabel">Value</label> <label className="udapp_settingsLabel" data-id="remixDRValueLabel">Value</label>
<div className="udapp_gasValueContainer"> <div className="udapp_gasValueContainer">
<OverlayTrigger placement={'top-start'} overlay={ <CustomTooltip
<Tooltip className="text-nowrap" id="remixValueTooltip"> placement={'top-start'}
<span>{"Enter an amount and choose its unit"}</span> tooltipClasses="text-nowrap"
</Tooltip> tooltipId="remixValueTooltip"
}> tooltipText="Enter an amount and choose its unit"
>
<input <input
ref={inputValue} ref={inputValue}
type="number" type="number"
@ -68,8 +68,10 @@ export function ValueUI (props: ValueProps) {
onChange={validateValue} onChange={validateValue}
value={props.sendValue} value={props.sendValue}
/> />
</OverlayTrigger> </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') }}>
<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="wei" value='wei'>Wei</option>
<option data-unit="gwei" value="gwei">Gwei</option> <option data-unit="gwei" value="gwei">Gwei</option>
<option data-unit="finney" value="finney">Finney</option> <option data-unit="finney" value="finney">Finney</option>

Loading…
Cancel
Save