From b535075977279300d699f50b77b972d575d231ad Mon Sep 17 00:00:00 2001 From: hsy822 Date: Wed, 22 Oct 2025 16:51:09 +0900 Subject: [PATCH 1/2] dynamically update deploy button text based on verification checkbox state --- .../src/lib/components/contractDropdownUI.tsx | 25 +++++++++----- .../src/lib/components/contractGUI.tsx | 34 ++++++++++++++----- 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx b/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx index 02ab64b6ca1..765ad7c3d86 100644 --- a/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx @@ -415,6 +415,13 @@ export function ContractDropdownUI(props: ContractDropdownProps) { evmVersion = JSON.parse(loadedContractData.metadata).settings.evmVersion } } catch (err) {} + + const deployButtonTitle = isVerifyChecked + ? intl.formatMessage({ id: 'udapp.deployAndVerify', defaultMessage: 'Deploy & Verify' }) + : intl.formatMessage({ id: 'udapp.deploy' }) + + const deployButtonWidthClass = isVerifyChecked ? 'w-auto' : 'w-50' + return (
@@ -492,7 +499,7 @@ export function ContractDropdownUI(props: ContractDropdownProps) { } > - + : {evmVersion} @@ -501,8 +508,14 @@ export function ContractDropdownUI(props: ContractDropdownProps) {
{((contractList[currentFile] && contractList[currentFile].filter((contract) => contract)) || []).length > 0 && loadedContractData && (
+ {isNetworkSupported && ( + + )} - {isNetworkSupported && ( - - )}
)}
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 64063b220ba..91fa07ae016 100644 --- a/libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx @@ -32,6 +32,7 @@ export function ContractGUI(props: ContractGUIProps) { const multiFields = useRef>([]) const initializeFields = useRef>([]) const basicInputRef = useRef() + const [baseTitleForDataId, setBaseTitleForDataId] = useState('') const intl = useIntl() useEffect(() => { @@ -42,19 +43,34 @@ export function ContractGUI(props: ContractGUIProps) { }, [props.deployOption]) useEffect(() => { + let newTitle = '' + let newBaseTitle = '' + if (props.title) { - setTitle(props.title) + newTitle = props.title } else if (props.funcABI.name) { - setTitle(props.funcABI.name) + newTitle = props.funcABI.name } else { - setTitle(props.funcABI.type === 'receive' ? '(receive)' : '(fallback)') + newTitle = props.funcABI.type === 'receive' ? '(receive)' : '(fallback)' } + + if (props.isDeploy) { + newBaseTitle = intl.formatMessage({ id: 'udapp.deploy', defaultMessage: 'Deploy' }) + } else if (props.funcABI.name) { + newBaseTitle = props.funcABI.name + } else { + newBaseTitle = props.funcABI.type === 'receive' ? '(receive)' : '(fallback)' + } + + setTitle(newTitle) + setBaseTitleForDataId(newBaseTitle) + setBasicInput('') // we have the reset the fields before resetting the previous references. basicInputRef.current.value = '' multiFields.current.filter((el) => el !== null && el !== undefined).forEach((el) => (el.value = '')) multiFields.current = [] - }, [props.title, props.funcABI]) + }, [props.title, props.funcABI, props.isDeploy, intl]) useEffect(() => { if (props.lookupOnly) { @@ -63,7 +79,7 @@ export function ContractGUI(props: ContractGUIProps) { title: title + ' - call', content: 'call', classList: 'btn-primary', - dataId: title + ' - call' + dataId: baseTitleForDataId + ' - call' }) } else if (props.funcABI.stateMutability === 'payable' || props.funcABI.payable) { // // transact. stateMutability = payable @@ -71,7 +87,7 @@ export function ContractGUI(props: ContractGUIProps) { title: title + ' - transact (payable)', content: 'transact', classList: 'btn-danger', - dataId: title + ' - transact (payable)' + dataId: baseTitleForDataId + ' - transact (payable)' }) } else { // // transact. stateMutability = nonpayable @@ -79,10 +95,10 @@ export function ContractGUI(props: ContractGUIProps) { title: title + ' - transact (not payable)', content: 'transact', classList: 'btn-warning', - dataId: title + ' - transact (not payable)' + dataId: baseTitleForDataId + ' - transact (not payable)' }) } - }, [props.lookupOnly, props.funcABI, title]) + }, [props.lookupOnly, props.funcABI, title, baseTitleForDataId]) const getEncodedCall = () => { const multiString = getMultiValsString(multiFields.current) @@ -305,7 +321,7 @@ export function ContractGUI(props: ContractGUIProps) { (props.funcABI.inputs && props.funcABI.inputs.length > 0) || props.funcABI.type === 'fallback' || props.funcABI.type === 'receive' ? 'udapp_hasArgs' : '' }`} > -
+
Date: Wed, 22 Oct 2025 18:17:19 +0900 Subject: [PATCH 2/2] add pt-2 --- libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 91fa07ae016..41e81d7d78e 100644 --- a/libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx @@ -321,7 +321,7 @@ export function ContractGUI(props: ContractGUIProps) { (props.funcABI.inputs && props.funcABI.inputs.length > 0) || props.funcABI.type === 'fallback' || props.funcABI.type === 'receive' ? 'udapp_hasArgs' : '' }`} > -
+