cursor pointer of enabled AtAddress btn

pull/5370/head
lianahus 1 year ago committed by Aniket
parent f7c5299de0
commit 31b477ee21
  1. 45
      libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx

@ -16,14 +16,14 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
content: string
}>({
display: '',
content: ''
content: '',
})
const [atAddressOptions, setAtAddressOptions] = useState<{
title: string | JSX.Element
disabled: boolean
}>({
title: <FormattedMessage id="udapp.atAddressOptionsTitle1" />,
disabled: true
disabled: true,
})
const [loadedAddress, setLoadedAddress] = useState<string>('')
const [contractOptions, setContractOptions] = useState<{
@ -31,7 +31,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
disabled: boolean
}>({
title: <FormattedMessage id="udapp.contractOptionsTitle1" />,
disabled: true
disabled: true,
})
const [loadedContractData, setLoadedContractData] = useState<ContractData>(null)
const [constructorInterface, setConstructorInterface] = useState<FuncABI>(null)
@ -50,7 +50,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
enableAtAddress(false)
setAbiLabel({
display: 'none',
content: 'ABI file selected'
content: 'ABI file selected',
})
}, [])
@ -71,19 +71,19 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
if (/.(.abi)$/.exec(currentFile) && '' !== atAddressValue.current.value) {
setAbiLabel({
display: 'block',
content: currentFile
content: currentFile,
})
enableAtAddress(true)
} else if (isContractFile(currentFile)) {
setAbiLabel({
display: 'none',
content: ''
content: '',
})
if (!currentContract) enableAtAddress(false)
} else {
setAbiLabel({
display: 'none',
content: ''
content: '',
})
if (!currentContract) enableAtAddress(false)
}
@ -150,7 +150,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
<span className="text-start">
<FormattedMessage id="udapp.atAddressOptionsTitle2" values={{ br: <br /> }} />
</span>
)
),
})
} else {
setAtAddressOptions({
@ -161,7 +161,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
<span className="text-start">
<FormattedMessage id="udapp.atAddressOptionsTitle4" values={{ br: <br /> }} />
</span>
)
),
})
}
}
@ -170,7 +170,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
if (enable) {
setContractOptions({
disabled: false,
title: <FormattedMessage id="udapp.contractOptionsTitle2" />
title: <FormattedMessage id="udapp.contractOptionsTitle2" />,
})
} else {
setContractOptions({
@ -182,7 +182,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
<span className="text-start">
<FormattedMessage id="udapp.contractOptionsTitle4" values={{ br: <br /> }} />
</span>
)
),
})
}
}
@ -289,7 +289,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
setCompilerName(contract.compilerName)
setContractOptions({
disabled: false,
title: <FormattedMessage id="udapp.contractOptionsTitle2" />
title: <FormattedMessage id="udapp.contractOptionsTitle2" />,
})
}
})
@ -297,7 +297,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
setCompilerName('')
setContractOptions({
title: <FormattedMessage id="udapp.contractOptionsTitle1" />,
disabled: true
disabled: true,
})
}
}
@ -323,7 +323,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
<a href="https://eips.ethereum.org/EIPS/eip-55" target="_blank" rel="noreferrer">
EIP-55
</a>
)
),
}}
/>
</span>
@ -343,7 +343,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
<a href="https://eips.ethereum.org/EIPS/eip-170" target="_blank" rel="noreferrer">
eip-170
</a>
)
),
}}
/>
</div>
@ -358,7 +358,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
<a href="https://eips.ethereum.org/EIPS/eip-3860" target="_blank" rel="noreferrer">
eip-3860
</a>
)
),
}}
/>
</div>
@ -383,7 +383,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
<FormattedMessage
id="udapp.compiledBy"
values={{
compilerName: <span className="text-capitalize">{compilerName}</span>
compilerName: <span className="text-capitalize">{compilerName}</span>,
}}
/>
</label>
@ -423,7 +423,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
disabled={contractOptions.disabled}
style={{
display: loadType === 'abi' && !isContractFile(currentFile) ? 'none' : 'block',
pointerEvents: contractOptions.disabled ? 'none' : 'auto'
pointerEvents: contractOptions.disabled ? 'none' : 'auto',
}}
>
<option value="" disabled hidden>
@ -509,7 +509,12 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
<div className="pt-2 d-flex flex-column sudapp_button udapp_atAddressSect">
<div className="d-flex flex-row">
<CustomTooltip placement={'top-end'} tooltipClasses="text-wrap text-left" tooltipId="runAndDeployAddresstooltip" tooltipText={atAddressOptions.title}>
<div id="runAndDeployAtAdressButtonContainer" onClick={loadFromAddress} data-title={atAddressOptions.title}>
<div
style={!atAddressOptions.disabled ? { cursor: 'pointer' } : { cursor: 'default' }}
id="runAndDeployAtAdressButtonContainer"
onClick={loadFromAddress}
data-title={atAddressOptions.title}
>
<button
className="udapp_atAddress btn-sm py-2 btn-primary"
id="runAndDeployAtAdressButton"
@ -532,7 +537,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
ref={atAddressValue}
className={(!addressIsValid ? 'border border-danger' : 'border-0') + ' h-100 udapp_input udapp_ataddressinput ataddressinput form-control'}
placeholder={intl.formatMessage({
id: 'udapp.loadContractFromAddress'
id: 'udapp.loadContractFromAddress',
})}
onChange={atAddressChanged}
/>

Loading…
Cancel
Save