Commit a7d28b9a authored by isstuev's avatar isstuev

some fixes and tests

parent c5e3774e
export default function shortenString(string: string | null, charNumber = 8) { export default function shortenString(string: string | null, charNumber: number | undefined = 8) {
if (!string) { if (!string) {
return ''; return '';
} }
if (string.length <= charNumber - 1) { if (string.length <= charNumber) {
return string; return string;
} }
......
...@@ -45,7 +45,7 @@ const TxInternalsListItem = ({ ...@@ -45,7 +45,7 @@ const TxInternalsListItem = ({
hash={ txnHash } hash={ txnHash }
isLoading={ isLoading } isLoading={ isLoading }
fontWeight={ 700 } fontWeight={ 700 }
truncation="constant" truncation="constant_long"
/> />
<Skeleton isLoaded={ !isLoading } color="text_secondary" fontWeight="400" fontSize="sm"> <Skeleton isLoaded={ !isLoading } color="text_secondary" fontWeight="400" fontSize="sm">
<span>{ dayjs(timestamp).fromNow() }</span> <span>{ dayjs(timestamp).fromNow() }</span>
......
...@@ -43,6 +43,7 @@ const AddressIntTxsTableItem = ({ ...@@ -43,6 +43,7 @@ const AddressIntTxsTableItem = ({
isLoading={ isLoading } isLoading={ isLoading }
fontWeight={ 700 } fontWeight={ 700 }
noIcon noIcon
truncation="constant_long"
/> />
{ timestamp && ( { timestamp && (
<Skeleton isLoaded={ !isLoading } color="text_secondary" fontWeight="400" fontSize="sm"> <Skeleton isLoaded={ !isLoading } color="text_secondary" fontWeight="400" fontSize="sm">
......
...@@ -157,7 +157,7 @@ const AddressVerificationStepSignature = ({ address, signingMessage, contractCre ...@@ -157,7 +157,7 @@ const AddressVerificationStepSignature = ({ address, signingMessage, contractCre
} }
case 'INVALID_SIGNER_ERROR': { case 'INVALID_SIGNER_ERROR': {
const signer = shortenString(formState.errors.root.message || ''); const signer = shortenString(formState.errors.root.message || '');
const expectedSigners = [ contractCreator, contractOwner ].filter(Boolean).map(shortenString).join(', '); const expectedSigners = [ contractCreator, contractOwner ].filter(Boolean).map(s => shortenString(s)).join(', ');
return ( return (
<Box> <Box>
<span>This address </span> <span>This address </span>
......
...@@ -74,6 +74,7 @@ const LatestBlocksItem = ({ block, isLoading }: Props) => { ...@@ -74,6 +74,7 @@ const LatestBlocksItem = ({ block, isLoading }: Props) => {
isLoading={ isLoading } isLoading={ isLoading }
noIcon noIcon
noCopy noCopy
truncation="constant"
/> />
</> </>
) } ) }
......
...@@ -46,6 +46,7 @@ const LatestDepositsItem = ({ item, isLoading }: Props) => { ...@@ -46,6 +46,7 @@ const LatestDepositsItem = ({ item, isLoading }: Props) => {
hash={ item.l1_tx_hash } hash={ item.l1_tx_hash }
fontSize="sm" fontSize="sm"
lineHeight={ 5 } lineHeight={ 5 }
truncation={ isMobile ? 'constant_long' : 'dynamic' }
/> />
); );
...@@ -55,6 +56,7 @@ const LatestDepositsItem = ({ item, isLoading }: Props) => { ...@@ -55,6 +56,7 @@ const LatestDepositsItem = ({ item, isLoading }: Props) => {
hash={ item.l2_tx_hash } hash={ item.l2_tx_hash }
fontSize="sm" fontSize="sm"
lineHeight={ 5 } lineHeight={ 5 }
truncation={ isMobile ? 'constant_long' : 'dynamic' }
/> />
); );
......
...@@ -58,7 +58,7 @@ const LatestTxsItem = ({ tx, isLoading }: Props) => { ...@@ -58,7 +58,7 @@ const LatestTxsItem = ({ tx, isLoading }: Props) => {
isLoading={ isLoading } isLoading={ isLoading }
hash={ tx.hash } hash={ tx.hash }
fontWeight="700" fontWeight="700"
truncation="constant" truncation="constant_long"
/> />
{ tx.timestamp && ( { tx.timestamp && (
<Skeleton isLoaded={ !isLoading } color="text_secondary" fontWeight="400" fontSize="sm" ml={ 3 }> <Skeleton isLoaded={ !isLoading } color="text_secondary" fontWeight="400" fontSize="sm" ml={ 3 }>
......
...@@ -18,7 +18,7 @@ const NameDomainHistoryListItem = ({ isLoading, transaction_hash: transactionHas ...@@ -18,7 +18,7 @@ const NameDomainHistoryListItem = ({ isLoading, transaction_hash: transactionHas
<ListItemMobileGrid.Container> <ListItemMobileGrid.Container>
<ListItemMobileGrid.Label isLoading={ isLoading }>Txn hash</ListItemMobileGrid.Label> <ListItemMobileGrid.Label isLoading={ isLoading }>Txn hash</ListItemMobileGrid.Label>
<ListItemMobileGrid.Value> <ListItemMobileGrid.Value>
<TxEntity hash={ transactionHash } isLoading={ isLoading } fontWeight={ 500 }/> <TxEntity hash={ transactionHash } isLoading={ isLoading } fontWeight={ 500 } truncation="constant_long"/>
</ListItemMobileGrid.Value> </ListItemMobileGrid.Value>
<ListItemMobileGrid.Label isLoading={ isLoading }>Age</ListItemMobileGrid.Label> <ListItemMobileGrid.Label isLoading={ isLoading }>Age</ListItemMobileGrid.Label>
......
...@@ -17,7 +17,13 @@ const NameDomainHistoryTableItem = ({ isLoading, transaction_hash: transactionHa ...@@ -17,7 +17,13 @@ const NameDomainHistoryTableItem = ({ isLoading, transaction_hash: transactionHa
return ( return (
<Tr> <Tr>
<Td verticalAlign="middle"> <Td verticalAlign="middle">
<TxEntity hash={ transactionHash } isLoading={ isLoading } fontWeight={ 700 }/> <TxEntity
hash={ transactionHash }
isLoading={ isLoading }
fontWeight={ 700 }
noIcon
truncation="constant_long"
/>
</Td> </Td>
<Td pl={ 9 } verticalAlign="middle"> <Td pl={ 9 } verticalAlign="middle">
<Skeleton isLoaded={ !isLoading } color="text_secondary" display="inline-block"> <Skeleton isLoaded={ !isLoading } color="text_secondary" display="inline-block">
......
...@@ -67,7 +67,7 @@ const TokenTransferListItem = ({ ...@@ -67,7 +67,7 @@ const TokenTransferListItem = ({
<TxEntity <TxEntity
isLoading={ isLoading } isLoading={ isLoading }
hash={ txHash } hash={ txHash }
truncation="constant" truncation="constant_long"
fontWeight="700" fontWeight="700"
/> />
{ timestamp && ( { timestamp && (
......
...@@ -38,11 +38,11 @@ const TokenTransferTable = ({ ...@@ -38,11 +38,11 @@ const TokenTransferTable = ({
<Thead top={ top }> <Thead top={ top }>
<Tr> <Tr>
{ showTxInfo && <Th width="44px"></Th> } { showTxInfo && <Th width="44px"></Th> }
<Th width="185px">Token</Th> <Th width="200px">Token</Th>
<Th width="160px">Token ID</Th> <Th width="160px">Token ID</Th>
{ showTxInfo && <Th width="20%">Txn hash</Th> } { showTxInfo && <Th width="200px">Txn hash</Th> }
<Th width="50%">From/To</Th> <Th width="60%">From/To</Th>
<Th width="30%" isNumeric>Value</Th> <Th width="40%" isNumeric>Value</Th>
</Tr> </Tr>
</Thead> </Thead>
<Tbody> <Tbody>
......
...@@ -75,6 +75,7 @@ const TokenTransferTableItem = ({ ...@@ -75,6 +75,7 @@ const TokenTransferTableItem = ({
fontWeight={ 600 } fontWeight={ 600 }
noIcon noIcon
mt="7px" mt="7px"
truncation="constant_long"
/> />
{ timestamp && ( { timestamp && (
<Skeleton isLoaded={ !isLoading } color="text_secondary" fontWeight="400" mt="10px" display="inline-block"> <Skeleton isLoaded={ !isLoading } color="text_secondary" fontWeight="400" mt="10px" display="inline-block">
......
import type { ThemeTypings } from '@chakra-ui/react'; import type { ThemeTypings } from '@chakra-ui/react';
import { Flex, chakra, useBreakpointValue } from '@chakra-ui/react'; import { Flex, Grid, chakra, useBreakpointValue } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import type { AddressParam } from 'types/api/addressParams'; import type { AddressParam } from 'types/api/addressParams';
...@@ -55,6 +55,7 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading ...@@ -55,6 +55,7 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading
truncation="constant" truncation="constant"
maxW="calc(100% - 28px)" maxW="calc(100% - 28px)"
w="min-content" w="min-content"
/> />
</Flex> </Flex>
{ to && ( { to && (
...@@ -76,10 +77,10 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading ...@@ -76,10 +77,10 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading
} }
const isOutgoing = current === from.hash; const isOutgoing = current === from.hash;
const iconSizeWithMargins = (5 + (isOutgoing ? 4 : 2) + 3) * 4; const iconSize = 20;
return ( return (
<Flex className={ className } alignItems="center"> <Grid className={ className } alignItems="center" gridTemplateColumns={ `fit-content(100%) ${ iconSize }px fit-content(100%)` }>
<Entity <Entity
address={ from } address={ from }
isLoading={ isLoading } isLoading={ isLoading }
...@@ -88,7 +89,6 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading ...@@ -88,7 +89,6 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading
noIcon={ noIcon } noIcon={ noIcon }
tokenHash={ tokenHash } tokenHash={ tokenHash }
truncation="constant" truncation="constant"
maxW={ `calc(50% - ${ iconSizeWithMargins / 2 }px)` }
mr={ isOutgoing ? 4 : 2 } mr={ isOutgoing ? 4 : 2 }
/> />
<AddressFromToIcon <AddressFromToIcon
...@@ -104,11 +104,10 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading ...@@ -104,11 +104,10 @@ const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading
noIcon={ noIcon } noIcon={ noIcon }
tokenHash={ tokenHash } tokenHash={ tokenHash }
truncation="constant" truncation="constant"
maxW={ `calc(50% - ${ iconSizeWithMargins / 2 }px)` }
ml={ 3 } ml={ 3 }
/> />
) } ) }
</Flex> </Grid>
); );
}; };
......
...@@ -40,7 +40,7 @@ const TokenTransferListItem = ({ ...@@ -40,7 +40,7 @@ const TokenTransferListItem = ({
<TxEntity <TxEntity
isLoading={ isLoading } isLoading={ isLoading }
hash={ txHash } hash={ txHash }
truncation="constant" truncation="constant_long"
fontWeight="700" fontWeight="700"
/> />
{ timestamp && ( { timestamp && (
......
...@@ -26,15 +26,17 @@ const TokenTransferTable = ({ data, top, showSocketInfo, socketInfoAlert, socket ...@@ -26,15 +26,17 @@ const TokenTransferTable = ({ data, top, showSocketInfo, socketInfoAlert, socket
return ( return (
<AddressHighlightProvider> <AddressHighlightProvider>
<Table variant="simple" size="sm"> <Table variant="simple" size="sm" minW="950px">
<Thead top={ top }> <Thead top={ top }>
<Tr> <Tr>
<Th width={ tokenType === 'ERC-1155' ? '50%' : '75%' }>Txn hash</Th> <Th width="280px">Txn hash</Th>
<Th width="164px">Method</Th> <Th width="200px">Method</Th>
<Th width={{ lg: '200px', xl: '420px' }}>From/To</Th> <Th width={{ lg: '224px', xl: '420px' }}>From/To</Th>
{ (tokenType === 'ERC-721' || tokenType === 'ERC-1155') && <Th width="25%" isNumeric={ tokenType === 'ERC-721' }>Token ID</Th> } { (tokenType === 'ERC-721' || tokenType === 'ERC-1155') &&
<Th width={ tokenType === 'ERC-1155' ? '50%' : '100%' }>Token ID</Th>
}
{ (tokenType === 'ERC-20' || tokenType === 'ERC-1155') && ( { (tokenType === 'ERC-20' || tokenType === 'ERC-1155') && (
<Th width="25%" isNumeric> <Th width={ tokenType === 'ERC-1155' ? '50%' : '100%' } isNumeric>
<TruncatedValue value={ `Value ${ token?.symbol || '' }` } w="100%" verticalAlign="middle"/> <TruncatedValue value={ `Value ${ token?.symbol || '' }` } w="100%" verticalAlign="middle"/>
</Th> </Th>
) } ) }
......
import { Tr, Td, Grid, Skeleton, Box } from '@chakra-ui/react'; import { Tr, Td, Flex, Skeleton, Box } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import type { TokenTransfer } from 'types/api/tokenTransfer'; import type { TokenTransfer } from 'types/api/tokenTransfer';
...@@ -35,12 +35,13 @@ const TokenTransferTableItem = ({ ...@@ -35,12 +35,13 @@ const TokenTransferTableItem = ({
return ( return (
<Tr alignItems="top"> <Tr alignItems="top">
<Td> <Td>
<Grid alignItems="center" gridTemplateColumns="auto 130px" width="fit-content" py="7px"> <Flex alignItems="center" py="7px">
<TxEntity <TxEntity
hash={ txHash } hash={ txHash }
isLoading={ isLoading } isLoading={ isLoading }
fontWeight={ 600 } fontWeight={ 600 }
noIcon noIcon
truncation="constant_long"
/> />
{ timestamp && ( { timestamp && (
<Skeleton isLoaded={ !isLoading } display="inline-block" color="gray.500" fontWeight="400" ml="10px"> <Skeleton isLoaded={ !isLoading } display="inline-block" color="gray.500" fontWeight="400" ml="10px">
...@@ -49,7 +50,7 @@ const TokenTransferTableItem = ({ ...@@ -49,7 +50,7 @@ const TokenTransferTableItem = ({
</span> </span>
</Skeleton> </Skeleton>
) } ) }
</Grid> </Flex>
</Td> </Td>
<Td> <Td>
{ method ? ( { method ? (
......
...@@ -87,7 +87,6 @@ const TokensTableItem = ({ ...@@ -87,7 +87,6 @@ const TokensTableItem = ({
noIcon noIcon
fontSize="sm" fontSize="sm"
fontWeight={ 500 } fontWeight={ 500 }
truncation="constant"
/> />
<AddressAddToWallet <AddressAddToWallet
token={ token } token={ token }
......
...@@ -68,7 +68,7 @@ const TxDetailsTokenTransfer = ({ data }: Props) => { ...@@ -68,7 +68,7 @@ const TxDetailsTokenTransfer = ({ data }: Props) => {
return ( return (
<Flex <Flex
alignItems="flex-start" alignItems="flex-start"
flexWrap={{ base: 'wrap', lg: 'nowrap' }} flexWrap="wrap"
columnGap={ 2 } columnGap={ 2 }
rowGap={ 3 } rowGap={ 3 }
flexDir="row" flexDir="row"
...@@ -81,9 +81,7 @@ const TxDetailsTokenTransfer = ({ data }: Props) => { ...@@ -81,9 +81,7 @@ const TxDetailsTokenTransfer = ({ data }: Props) => {
noIcon noIcon
fontWeight="500" fontWeight="500"
/> />
<Flex flexDir="column" rowGap={ 5 } w="100%" overflow="hidden" fontWeight={ 500 }> { content }
{ content }
</Flex>
</Flex> </Flex>
); );
}; };
......
...@@ -49,11 +49,11 @@ const TxsTable = ({ ...@@ -49,11 +49,11 @@ const TxsTable = ({
<TheadSticky top={ top }> <TheadSticky top={ top }>
<Tr> <Tr>
<Th width="54px"></Th> <Th width="54px"></Th>
<Th width="22%">Txn hash</Th> <Th width="180px">Txn hash</Th>
<Th width="160px">Type</Th> <Th width="160px">Type</Th>
<Th width="20%">Method</Th> <Th width="20%">Method</Th>
{ showBlockInfo && <Th width="18%">Block</Th> } { showBlockInfo && <Th width="18%">Block</Th> }
<Th width={{ base: '224px', xl: '360px' }}>From/To</Th> <Th width="224px">From/To</Th>
{ !config.UI.views.tx.hiddenFields?.value && ( { !config.UI.views.tx.hiddenFields?.value && (
<Th width="20%" isNumeric> <Th width="20%" isNumeric>
<Link onClick={ sort('value') } display="flex" justifyContent="end"> <Link onClick={ sort('value') } display="flex" justifyContent="end">
......
...@@ -55,7 +55,7 @@ const TxsTableItem = ({ tx, showBlockInfo, currentAddress, enableTimeIncrement, ...@@ -55,7 +55,7 @@ const TxsTableItem = ({ tx, showBlockInfo, currentAddress, enableTimeIncrement,
fontWeight={ 700 } fontWeight={ 700 }
noIcon noIcon
maxW="100%" maxW="100%"
truncation="constant" truncation="constant_long"
/> />
{ tx.timestamp && <Skeleton color="text_secondary" fontWeight="400" isLoaded={ !isLoading }><span>{ timeAgo }</span></Skeleton> } { tx.timestamp && <Skeleton color="text_secondary" fontWeight="400" isLoaded={ !isLoading }><span>{ timeAgo }</span></Skeleton> }
</VStack> </VStack>
...@@ -95,7 +95,7 @@ const TxsTableItem = ({ tx, showBlockInfo, currentAddress, enableTimeIncrement, ...@@ -95,7 +95,7 @@ const TxsTableItem = ({ tx, showBlockInfo, currentAddress, enableTimeIncrement,
current={ currentAddress } current={ currentAddress }
isLoading={ isLoading } isLoading={ isLoading }
mt="2px" mt="2px"
mode={{ lg: 'compact', xl: 'long' }} mode="compact"
/> />
</Td> </Td>
{ !config.UI.views.tx.hiddenFields?.value && ( { !config.UI.views.tx.hiddenFields?.value && (
......
...@@ -53,6 +53,7 @@ const OptimisticL2WithdrawalsListItem = ({ item, isLoading }: Props) => { ...@@ -53,6 +53,7 @@ const OptimisticL2WithdrawalsListItem = ({ item, isLoading }: Props) => {
hash={ item.l2_tx_hash } hash={ item.l2_tx_hash }
fontSize="sm" fontSize="sm"
lineHeight={ 5 } lineHeight={ 5 }
truncation="constant_long"
/> />
</ListItemMobileGrid.Value> </ListItemMobileGrid.Value>
...@@ -83,6 +84,7 @@ const OptimisticL2WithdrawalsListItem = ({ item, isLoading }: Props) => { ...@@ -83,6 +84,7 @@ const OptimisticL2WithdrawalsListItem = ({ item, isLoading }: Props) => {
hash={ item.l1_tx_hash } hash={ item.l1_tx_hash }
fontSize="sm" fontSize="sm"
lineHeight={ 5 } lineHeight={ 5 }
truncation="constant_long"
/> />
</ListItemMobileGrid.Value> </ListItemMobileGrid.Value>
</> </>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment