Skip to content

Commit

Permalink
fix: Hide txInfo when displaying human description in batch tx (#2549)
Browse files Browse the repository at this point in the history
  • Loading branch information
usame-algan authored Sep 26, 2023
1 parent 508efd3 commit f270c7e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/batch/BatchSidebar/BatchTxItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import { MethodDetails } from '@/components/transactions/TxDetails/TxData/Decode
import { TxDataRow } from '@/components/transactions/TxDetails/Summary/TxDataRow'
import { dateString } from '@/utils/formatters'
import { BATCH_EVENTS, trackEvent } from '@/services/analytics'
import { TransactionInfoType } from '@safe-global/safe-gateway-typescript-sdk'
import useABTesting from '@/services/tracking/useAbTesting'
import { AbTest } from '@/services/tracking/abTesting'

type BatchTxItemProps = DraftBatchItem & {
id: string
Expand All @@ -30,6 +33,8 @@ const BatchTxItem = ({
dragging = false,
draggable = false,
}: BatchTxItemProps) => {
const shouldDisplayHumanDescription = useABTesting(AbTest.HUMAN_DESCRIPTION)

const txSummary = useMemo(
() => ({
timestamp,
Expand All @@ -55,6 +60,9 @@ const BatchTxItem = ({
const handleExpand = () => {
trackEvent(BATCH_EVENTS.BATCH_EXPAND_TX)
}
const displayInfo =
(!txDetails.txInfo.richDecodedInfo && txDetails.txInfo.type !== TransactionInfoType.TRANSFER) ||
!shouldDisplayHumanDescription

return (
<ListItem disablePadding sx={{ gap: 2, alignItems: 'flex-start' }}>
Expand All @@ -75,9 +83,7 @@ const BatchTxItem = ({

<TxType tx={txSummary} />

<Box flex={1}>
<TxInfo info={txDetails.txInfo} />
</Box>
<Box flex={1}>{displayInfo && <TxInfo info={txDetails.txInfo} />}</Box>

{onDelete && (
<>
Expand Down

0 comments on commit f270c7e

Please sign in to comment.