Hide toggle "Show external call data" when data is not available (#2158)

Fixes #2103
This commit is contained in:
tom goriunov
2024-08-12 18:07:53 +02:00
committed by GitHub
parent 09dc718cea
commit 7b9511d179
2 changed files with 11 additions and 9 deletions
+5 -4
View File
@@ -23,21 +23,22 @@ const UserOpDecodedCallData = ({ data }: Props) => {
return null;
}
const toggler = data.call_data ? (
const toggler = data.call_data && data.execute_call_data ? (
<UserOpCallDataSwitch
onChange={ handleSwitchChange }
initialValue={ !data.execute_call_data }
isDisabled={ !data.execute_call_data }
initialValue={ false }
ml={{ base: 3, lg: 'auto' }}
/>
) : null;
const labelText = data.call_data && !data.execute_call_data ? 'External call data' : 'Call data';
return (
<>
<DetailsInfoItem.Label
hint="Data that’s passed to the sender for execution"
>
Call data
{ labelText }
</DetailsInfoItem.Label>
<DetailsInfoItem.Value>
<RawInputData hex={ callData } rightSlot={ toggler }/>
+6 -5
View File
@@ -23,21 +23,22 @@ const UserOpDecodedCallData = ({ data }: Props) => {
return null;
}
const toggler = data.decoded_call_data ? (
const toggler = data.decoded_call_data && data.decoded_execute_call_data ? (
<UserOpCallDataSwitch
onChange={ handleSwitchChange }
initialValue={ !data.decoded_execute_call_data }
isDisabled={ !data.decoded_execute_call_data }
initialValue={ false }
ml={{ base: 0, lg: 'auto' }}
/>
) : null;
const labelText = data.call_data && !data.execute_call_data ? 'Decoded external call data' : 'Decoded call data';
return (
<>
<DetailsInfoItem.Label
hint="Decoded call data"
hint={ labelText }
>
Decoded call data
{ labelText }
</DetailsInfoItem.Label>
<DetailsInfoItem.Value
flexDir={{ base: 'column', lg: 'row' }}