From 820b3ab304290ae678e75a717d431063f78217b4 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Wed, 21 Sep 2022 14:29:52 +0100 Subject: [PATCH] more tooltips --- .../src/commands/addAtAddressInstance.ts | 2 +- .../src/lib/components/contractGUI.tsx | 300 +++++++++++++----- .../src/lib/components/universalDappUI.tsx | 163 +++++++--- 3 files changed, 340 insertions(+), 125 deletions(-) diff --git a/apps/remix-ide-e2e/src/commands/addAtAddressInstance.ts b/apps/remix-ide-e2e/src/commands/addAtAddressInstance.ts index 30300e8ac0..1c8c32ec75 100644 --- a/apps/remix-ide-e2e/src/commands/addAtAddressInstance.ts +++ b/apps/remix-ide-e2e/src/commands/addAtAddressInstance.ts @@ -23,7 +23,7 @@ function addInstance (browser: NightwatchBrowser, address: string, isValidFormat else if (isAbi) { browser.useXpath() .click('//button[@id="runAndDeployAtAdressButton"]') - .waitForElementPresent('[data-id="udappNotify-modal-footer-ok-react"]') + .waitForElementPresent('[data-id="udappNotify-modal-footer-ok-react"]', 5000) .execute(function () { const modal = document.querySelector('[data-id="udappNotify-modal-footer-ok-react"]') as any diff --git a/libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx b/libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx index 1001521c63..0237665932 100644 --- a/libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx @@ -234,78 +234,179 @@ export function ContractGUI (props: ContractGUIProps) { } return ( -
0) || (props.funcABI.type === 'fallback') || (props.funcABI.type === 'receive') ? 'udapp_hasArgs' : ''}`}> -
- - {buttonOptions.title} - - }> - +
0) || + props.funcABI.type === "fallback" || + props.funcABI.type === "receive" + ? "udapp_hasArgs" + : "" + }`} + > +
+ + {buttonOptions.title} + + } + > + - - {props.funcABI.type === 'fallback' || props.funcABI.type === 'receive' ? `'(${props.funcABI.type}')` : props.inputs} - - }> - 0) || (props.funcABI.type === 'fallback') || (props.funcABI.type === 'receive')) ? 'hidden' : 'visible' }} /> + + + {props.funcABI.type === "fallback" || + props.funcABI.type === "receive" + ? `'(${props.funcABI.type}')` + : props.inputs} + + + } + > + 0) || + props.funcABI.type === "fallback" || + props.funcABI.type === "receive" + ) + ? "hidden" + : "visible", + }} + /> 0) ? 'hidden' : 'visible' }}> + style={{ + visibility: !( + props.funcABI.inputs && props.funcABI.inputs.length > 0 + ) + ? "hidden" + : "visible", + }} + >
-
+
-
{title}
- +
+ {title} +
+
{props.funcABI.inputs.map((inp, index) => { return (
- { multiFields.current[index] = el }} className="form-control" placeholder={inp.type} title={inp.name} data-id={`multiParamManagerInput${inp.name}`} /> -
) + { + multiFields.current[index] = el; + }} + className="form-control" + placeholder={inp.type} + title={inp.name} + data-id={`multiParamManagerInput${inp.name}`} + /> +
+ ); })}
- + - + - + +
- { props.deployOption && (props.deployOption || []).length > 0 ? + {props.deployOption && (props.deployOption || []).length > 0 ? ( <> -
+
- { - props.initializerOptions && props.initializerOptions.initializeInputs ? + {props.initializerOptions && + props.initializerOptions.initializeInputs ? ( - - : null - } + + + ) : null}
- { - props.initializerOptions && props.initializerOptions.initializeInputs ? -
-
{ - props.initializerOptions.inputs.inputs.map((inp, index) => { - return ( -
- - { initializeFields.current[index] = el }} style={{ height: 32 }} className="form-control udapp_input" placeholder={inp.type} title={inp.name} /> -
- )}) - } -
-
: null - } -
+ {props.initializerOptions && + props.initializerOptions.initializeInputs ? ( +
+
+ {props.initializerOptions.inputs.inputs.map((inp, index) => { + return ( +
+ + { + initializeFields.current[index] = el; + }} + style={{ height: 32 }} + className="form-control udapp_input" + placeholder={inp.type} + title={inp.name} + /> +
+ ); + })} +
+
+ ) : null} +
- +
-
+
- { - !useLastProxy ? + {!useLastProxy ? (
- - -
: - { proxyAddress || 'No proxy address available' } - } + + +
+ ) : ( + + {proxyAddress || "No proxy address available"} + + )}
- : null - } + + ) : null}
- ) + ); } diff --git a/libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx b/libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx index 4c2deaebcb..10035c787c 100644 --- a/libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx @@ -7,6 +7,7 @@ import * as remixLib from '@remix-project/remix-lib' import * as ethJSUtil from 'ethereumjs-util' import { ContractGUI } from './contractGUI' import { TreeView, TreeViewItem } from '@remix-ui/tree-view' +import { OverlayTrigger, Tooltip } from 'react-bootstrap' // eslint-disable-line import { BN } from 'ethereumjs-util' import { is0XPrefixed, isHexadecimal, isNumeric, shortenAddress } from '@remix-ui/helper' @@ -210,19 +211,37 @@ export function UniversalDappUI (props: UdappProps) { } return ( -
+
- - + +
- {props.instance.name} at {shortenAddress(address)} ({props.context}) + {props.instance.name} at {shortenAddress(address)} ( + {props.context})
- +
-
+
-
- -
- { - contractABI && contractABI.map((funcABI, index) => { - if (funcABI.type !== 'function') return null - const isConstant = funcABI.constant !== undefined ? funcABI.constant : false - const lookupOnly = funcABI.stateMutability === 'view' || funcABI.stateMutability === 'pure' || isConstant - const inputs = props.getFuncABIInputs(funcABI) +
+ +
+ {contractABI && + contractABI.map((funcABI, index) => { + if (funcABI.type !== "function") return null; + const isConstant = + funcABI.constant !== undefined ? funcABI.constant : false; + const lookupOnly = + funcABI.stateMutability === "view" || + funcABI.stateMutability === "pure" || + isConstant; + const inputs = props.getFuncABIInputs(funcABI); - return
- { - runTransaction(lookupOnly, funcABI, valArray, inputsValues, index) - }} - inputs={inputs} - evmBC={evmBC} - lookupOnly={lookupOnly} - key={index} - /> -
- - { - Object.keys(props.instance.decodedResponse || {}).map((key) => { - const funcIndex = index.toString() - const response = props.instance.decodedResponse[key] + return ( +
+ { + runTransaction( + lookupOnly, + funcABI, + valArray, + inputsValues, + index + ); + }} + inputs={inputs} + evmBC={evmBC} + lookupOnly={lookupOnly} + key={index} + /> +
+ + {Object.keys(props.instance.decodedResponse || {}).map( + (key) => { + const funcIndex = index.toString(); + const response = props.instance.decodedResponse[key]; - return key === funcIndex ? Object.keys(response || {}).map((innerkey, index) => { - return renderData(props.instance.decodedResponse[key][innerkey], response, innerkey, innerkey) - }) : null - }) - } - + return key === funcIndex + ? Object.keys(response || {}).map( + (innerkey, index) => { + return renderData( + props.instance.decodedResponse[key][ + innerkey + ], + response, + innerkey, + innerkey + ); + } + ) + : null; + } + )} + +
-
- }) - } + ); + })}
- +
- +
- ) + ); }