Skip to content

Commit

Permalink
fix: inconsistent layout in dashboard pending transactions view (#4034)
Browse files Browse the repository at this point in the history
* fix: alignment in transactions view dashboard

* feat: apply truncate text default
  • Loading branch information
Shaik-Sirajuddin authored Aug 28, 2024
1 parent d4f4d6d commit f3cdeb2
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 17 deletions.
20 changes: 12 additions & 8 deletions src/components/dashboard/PendingTxs/PendingTxListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,21 @@ const PendingTx = ({ transaction }: PendingTxType): ReactElement => {
return (
<NextLink data-testid="tx-pending-item" href={url} passHref>
<Box className={css.container}>
<Box minWidth={30}>{isMultisigExecutionInfo(transaction.executionInfo) && transaction.executionInfo.nonce}</Box>
<Box className={css.innerContainer}>
<Box minWidth={30}>
{isMultisigExecutionInfo(transaction.executionInfo) && transaction.executionInfo.nonce}
</Box>

<Box minWidth={62}>
<TxType tx={transaction} />
</Box>

<TxInfo info={transaction.txInfo} />
<Box minWidth={62}>
<TxType tx={transaction} />
</Box>

<Box flexGrow={1} />
<Box minWidth={0} flexGrow={1}>
<TxInfo info={transaction.txInfo} />
</Box>
</Box>

<Box alignSelf="flex-end" display="flex" flexWrap="nowrap" alignItems="center" gap={1.5}>
<Box alignSelf="flex-start" display="flex" flexWrap="nowrap" alignItems="center" gap={1.5}>
{isMultisigExecutionInfo(transaction.executionInfo) && (
<TxConfirmations
submittedConfirmations={transaction.executionInfo.confirmationsSubmitted}
Expand Down
20 changes: 18 additions & 2 deletions src/components/dashboard/PendingTxs/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@
background-color: var(--color-background-paper);
border: 1px solid var(--color-background-paper);
border-radius: 8px;
flex-wrap: wrap;
flex-wrap: nowrap;
display: flex;
align-items: center;
gap: var(--space-2);
min-height: 50px;
}

.innerContainer {
min-width: 0;
flex-grow: 1;
width: 100%;
display: flex;
flex-wrap: nowrap;
align-items: center;
gap: var(--space-2);
}
.container:hover {
background-color: var(--color-background-light);
border-color: var(--color-secondary-light);
Expand All @@ -32,3 +40,11 @@
display: flex;
justify-content: space-between;
}

@media (max-width: 600px) {
.container {
flex-direction: column;
align-items: start;
flex-wrap: wrap;
}
}
13 changes: 7 additions & 6 deletions src/components/transactions/TxInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import {
import { ellipsis, shortenAddress } from '@/utils/formatters'
import { useCurrentChain } from '@/hooks/useChains'
import { SwapTx } from '@/features/swap/components/SwapTxInfo/SwapTx'
import { Box } from '@mui/material'
import css from './styles.module.css'

export const TransferTx = ({
info,
Expand Down Expand Up @@ -85,18 +87,18 @@ export const TransferTx = ({
}

const CustomTx = ({ info }: { info: Custom }): ReactElement => {
return <>{info.methodName}</>
return <Box className={css.txInfo}>{info.methodName}</Box>
}

const CreationTx = ({ info }: { info: Creation }): ReactElement => {
return <>Created by {shortenAddress(info.creator.value)}</>
return <Box className={css.txInfo}>Created by {shortenAddress(info.creator.value)}</Box>
}

const MultiSendTx = ({ info }: { info: MultiSend }): ReactElement => {
return (
<>
<Box className={css.txInfo}>
{info.actionCount} {`action${info.actionCount > 1 ? 's' : ''}`}
</>
</Box>
)
}

Expand All @@ -105,9 +107,8 @@ const SettingsChangeTx = ({ info }: { info: SettingsChange }): ReactElement => {
info.settingsInfo?.type === SettingsInfoType.ENABLE_MODULE ||
info.settingsInfo?.type === SettingsInfoType.DISABLE_MODULE
) {
return <>{info.settingsInfo.module.name}</>
return <Box className={css.txInfo}>{info.settingsInfo.module.name}</Box>
}

return <></>
}

Expand Down
5 changes: 5 additions & 0 deletions src/components/transactions/TxInfo/styles.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.txInfo {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
10 changes: 9 additions & 1 deletion src/features/swap/components/SwapTxInfo/SwapTx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ export const SwapTx = ({ info }: { info: Order }): ReactElement => {
}

return (
<Typography component="div" display="flex" alignItems="center" fontWeight="bold">
<Typography
component="div"
display="flex"
alignItems="center"
fontWeight="bold"
whiteSpace="nowrap"
overflow="hidden"
textOverflow="ellipsis"
>
{from}
<Typography component="span" mx={0.5}>
&nbsp;to&nbsp;
Expand Down

0 comments on commit f3cdeb2

Please sign in to comment.