Commit 05ca4fb4 authored by tom goriunov's avatar tom goriunov Committed by GitHub

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

Fixes #2103
parent cec56f19
......@@ -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 }/>
......
......@@ -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' }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment