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) => { ...@@ -23,21 +23,22 @@ const UserOpDecodedCallData = ({ data }: Props) => {
return null; return null;
} }
const toggler = data.call_data ? ( const toggler = data.call_data && data.execute_call_data ? (
<UserOpCallDataSwitch <UserOpCallDataSwitch
onChange={ handleSwitchChange } onChange={ handleSwitchChange }
initialValue={ !data.execute_call_data } initialValue={ false }
isDisabled={ !data.execute_call_data }
ml={{ base: 3, lg: 'auto' }} ml={{ base: 3, lg: 'auto' }}
/> />
) : null; ) : null;
const labelText = data.call_data && !data.execute_call_data ? 'External call data' : 'Call data';
return ( return (
<> <>
<DetailsInfoItem.Label <DetailsInfoItem.Label
hint="Data that’s passed to the sender for execution" hint="Data that’s passed to the sender for execution"
> >
Call data { labelText }
</DetailsInfoItem.Label> </DetailsInfoItem.Label>
<DetailsInfoItem.Value> <DetailsInfoItem.Value>
<RawInputData hex={ callData } rightSlot={ toggler }/> <RawInputData hex={ callData } rightSlot={ toggler }/>
......
...@@ -23,21 +23,22 @@ const UserOpDecodedCallData = ({ data }: Props) => { ...@@ -23,21 +23,22 @@ const UserOpDecodedCallData = ({ data }: Props) => {
return null; return null;
} }
const toggler = data.decoded_call_data ? ( const toggler = data.decoded_call_data && data.decoded_execute_call_data ? (
<UserOpCallDataSwitch <UserOpCallDataSwitch
onChange={ handleSwitchChange } onChange={ handleSwitchChange }
initialValue={ !data.decoded_execute_call_data } initialValue={ false }
isDisabled={ !data.decoded_execute_call_data }
ml={{ base: 0, lg: 'auto' }} ml={{ base: 0, lg: 'auto' }}
/> />
) : null; ) : null;
const labelText = data.call_data && !data.execute_call_data ? 'Decoded external call data' : 'Decoded call data';
return ( return (
<> <>
<DetailsInfoItem.Label <DetailsInfoItem.Label
hint="Decoded call data" hint={ labelText }
> >
Decoded call data { labelText }
</DetailsInfoItem.Label> </DetailsInfoItem.Label>
<DetailsInfoItem.Value <DetailsInfoItem.Value
flexDir={{ base: 'column', lg: 'row' }} 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