Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Hide txInfo when displaying human description in batch tx #2549

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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