Skip to content

Commit

Permalink
Fix tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh committed Aug 1, 2023
1 parent 5eb418d commit 9b89215
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
66 changes: 33 additions & 33 deletions src/components/batch/BatchSidebar/BatchTxItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import TxData from '@/components/transactions/TxDetails/TxData'
import { MethodDetails } from '@/components/transactions/TxDetails/TxData/DecodedData/MethodDetails'
import { TxDataRow } from '@/components/transactions/TxDetails/Summary/TxDataRow'
import { dateString } from '@/utils/formatters'
import Track from '@/components/common/Track'
import { BATCH_EVENTS } from '@/services/analytics'
import { BATCH_EVENTS, trackEvent } from '@/services/analytics'

type BatchTxItemProps = DraftBatchItem & {
id: string
Expand Down Expand Up @@ -47,51 +46,52 @@ const BatchTxItem = ({
e.stopPropagation()
if (confirm('Are you sure you want to delete this transaction?')) {
onDelete?.(id)
trackEvent(BATCH_EVENTS.BATCH_DELETE_TX)
}
},
[onDelete, id],
)

const handleExpand = () => {
trackEvent(BATCH_EVENTS.BATCH_EXPAND_TX)
}

return (
<Box display="flex" gap={2}>
<div className={css.number}>{count}</div>

<Accordion elevation={0} sx={{ flex: 1 }}>
<Track {...BATCH_EVENTS.BATCH_EXPAND_TX}>
<AccordionSummary expandIcon={<ExpandMoreIcon />} disabled={dragging} className={css.accordion}>
<Box flex={1} display="flex" alignItems="center" gap={2} py={0.4}>
{draggable && (
<SvgIcon
component={DragIcon}
inheritViewBox
fontSize="small"
className={css.dragHandle}
onClick={(e: MouseEvent) => e.stopPropagation()}
/>
)}
<Accordion elevation={0} sx={{ flex: 1 }} onChange={handleExpand}>
<AccordionSummary expandIcon={<ExpandMoreIcon />} disabled={dragging} className={css.accordion}>
<Box flex={1} display="flex" alignItems="center" gap={2} py={0.4}>
{draggable && (
<SvgIcon
component={DragIcon}
inheritViewBox
fontSize="small"
className={css.dragHandle}
onClick={(e: MouseEvent) => e.stopPropagation()}
/>
)}

<TxType tx={txSummary} />
<TxType tx={txSummary} />

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

{onDelete && (
<>
<Box className={css.separator} />
{onDelete && (
<>
<Box className={css.separator} />

<Track {...BATCH_EVENTS.BATCH_DELETE_TX}>
<ButtonBase onClick={handleDelete} sx={{ p: 0.5 }}>
<SvgIcon component={DeleteIcon} inheritViewBox fontSize="small" />
</ButtonBase>
</Track>
<ButtonBase onClick={handleDelete} sx={{ p: 0.5 }}>
<SvgIcon component={DeleteIcon} inheritViewBox fontSize="small" />
</ButtonBase>

<Box className={css.separator} mr={2} />
</>
)}
</Box>
</AccordionSummary>
</Track>
<Box className={css.separator} mr={2} />
</>
)}
</Box>
</AccordionSummary>

<AccordionDetails>
<div className={css.details}>
Expand Down
6 changes: 3 additions & 3 deletions src/store/batchSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ export const batchSlice = createSlice({
export const { setBatch, addTx, removeTx } = batchSlice.actions

const selectAllBatches = (state: RootState): BatchTxsState => {
return state[batchSlice.name]
return state[batchSlice.name] || {}
}

export const selectBatchBySafe = createSelector(
[selectAllBatches, (_, chainId: string, safeAddress: string) => [chainId, safeAddress]],
(allBatchs, [chainId, safeAddress]): DraftBatchItem[] => {
return allBatchs[chainId]?.[safeAddress] || []
(allBatches, [chainId, safeAddress]): DraftBatchItem[] => {
return allBatches[chainId]?.[safeAddress] || []
},
)

0 comments on commit 9b89215

Please sign in to comment.