-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: visually group transactions executed in bulk in the transaction…
… history (#3772) * Group transactions in the history by transaction hash * remove commented code * create component for bulk transaction groups * layout for bulk group * fix: misalignment of txs on smaller screens * align grouped columns with non grouped columns * fix: column widths on mobile * Add unit test, wrap grouping functions * fix: lint errors * fix: untrusted txs warning placement * Use tx hash returned from backend * lint errors * remove unused function * Change layout and change explorer link * add unit test for grouping function * lodash import * fix typo * remove orange border from tx group * fix: transaction count color * change bulk group title
- Loading branch information
Showing
17 changed files
with
310 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,7 @@ describe('AppFrame', () => { | |
}, | ||
], | ||
}, | ||
txHash: null, | ||
}, | ||
conflictType: ConflictType.NONE, | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import type { ReactElement } from 'react' | ||
import { Box, Paper, SvgIcon, Typography } from '@mui/material' | ||
import type { Transaction } from '@safe-global/safe-gateway-typescript-sdk' | ||
import { isMultisigExecutionInfo } from '@/utils/transaction-guards' | ||
import ExpandableTransactionItem from '@/components/transactions/TxListItem/ExpandableTransactionItem' | ||
import BatchIcon from '@/public/images/common/batch.svg' | ||
import css from './styles.module.css' | ||
import ExplorerButton from '@/components/common/ExplorerButton' | ||
import { getBlockExplorerLink } from '@/utils/chains' | ||
import { useCurrentChain } from '@/hooks/useChains' | ||
|
||
const GroupedTxListItems = ({ | ||
groupedListItems, | ||
transactionHash, | ||
}: { | ||
groupedListItems: Transaction[] | ||
transactionHash: string | ||
}): ReactElement | null => { | ||
const chain = useCurrentChain() | ||
const explorerLink = chain && getBlockExplorerLink(chain, transactionHash)?.href | ||
if (groupedListItems.length === 0) return null | ||
|
||
return ( | ||
<Paper className={css.container}> | ||
<Box gridArea="icon"> | ||
<SvgIcon className={css.icon} component={BatchIcon} inheritViewBox fontSize="medium" /> | ||
</Box> | ||
<Box gridArea="info"> | ||
<Typography noWrap>Bulk transactions</Typography> | ||
</Box> | ||
<Box className={css.action}>{groupedListItems.length} transactions</Box> | ||
<Box className={css.hash}> | ||
<ExplorerButton href={explorerLink} isCompact={false} /> | ||
</Box> | ||
|
||
<Box gridArea="items" className={css.txItems}> | ||
{groupedListItems.map((tx) => { | ||
const nonce = isMultisigExecutionInfo(tx.transaction.executionInfo) ? tx.transaction.executionInfo.nonce : '' | ||
return ( | ||
<Box position="relative" key={tx.transaction.id}> | ||
<Box className={css.nonce}> | ||
<Typography className={css.nonce}>{nonce}</Typography> | ||
</Box> | ||
<ExpandableTransactionItem item={tx} isBulkGroup={true} /> | ||
</Box> | ||
) | ||
})} | ||
</Box> | ||
</Paper> | ||
) | ||
} | ||
|
||
export default GroupedTxListItems |
60 changes: 60 additions & 0 deletions
60
src/components/transactions/BulkTxListGroup/styles.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
.container { | ||
position: relative; | ||
padding: var(--space-2); | ||
display: grid; | ||
align-items: center; | ||
grid-template-columns: minmax(50px, 0.25fr) minmax(240px, 2fr) minmax(150px, 4fr) minmax(170px, 1fr); | ||
grid-template-areas: | ||
'icon info action hash' | ||
'nonce items items items'; | ||
} | ||
|
||
.action { | ||
margin-left: var(--space-2); | ||
grid-area: action; | ||
color: var(--color-text-secondary); | ||
} | ||
|
||
.hash { | ||
grid-area: hash; | ||
display: grid; | ||
justify-content: flex-end; | ||
} | ||
|
||
.nonce { | ||
position: absolute; | ||
left: -24px; | ||
top: var(--space-1); | ||
} | ||
|
||
.txItems { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--space-1); | ||
margin-top: var(--space-2); | ||
} | ||
|
||
.txItems :global(.MuiAccordion-root) { | ||
border-color: var(--color-border-light); | ||
} | ||
|
||
@media (max-width: 699px) { | ||
.container { | ||
grid-template-columns: minmax(30px, 0.25fr) minmax(230px, 3fr); | ||
grid-template-areas: | ||
'icon info ' | ||
'nonce action' | ||
'nonce hash ' | ||
'nonce items'; | ||
} | ||
|
||
.action { | ||
margin: 0; | ||
} | ||
.hash { | ||
justify-content: flex-start; | ||
} | ||
.nonce { | ||
left: -16px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.