Commit 4bf9bf5a authored by tom's avatar tom

withdrawals, logs and user ops tabs on address page

parent a51725d0
...@@ -55,7 +55,7 @@ const RoutedTabs = (props: Props) => { ...@@ -55,7 +55,7 @@ const RoutedTabs = (props: Props) => {
{ ...rest } { ...rest }
tabs={ tabs } tabs={ tabs }
onValueChange={ handleValueChange } onValueChange={ handleValueChange }
defaultValue={ activeTab ? getTabValue(activeTab) : undefined } defaultValue={ activeTab ? getTabValue(activeTab) : getTabValue(tabs[ 0 ]) }
/> />
); );
}; };
......
...@@ -70,11 +70,12 @@ const AddressLogs = ({ scrollRef, shouldRender = true, isQueryEnabled = true }: ...@@ -70,11 +70,12 @@ const AddressLogs = ({ scrollRef, shouldRender = true, isQueryEnabled = true }:
return ( return (
<DataListDisplay <DataListDisplay
isError={ isError } isError={ isError }
items={ data?.items } itemsNum={ data?.items?.length }
emptyText="There are no logs for this address." emptyText="There are no logs for this address."
content={ content }
actionBar={ actionBar } actionBar={ actionBar }
/> >
{ content }
</DataListDisplay>
); );
}; };
......
import { Flex, Hide, Show, Text } from '@chakra-ui/react'; import { Box, Flex, Text } from '@chakra-ui/react';
import { useQueryClient } from '@tanstack/react-query'; import { useQueryClient } from '@tanstack/react-query';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import React from 'react'; import React from 'react';
...@@ -201,7 +201,7 @@ const AddressTokenTransfers = ({ scrollRef, overloadCount = OVERLOAD_COUNT, shou ...@@ -201,7 +201,7 @@ const AddressTokenTransfers = ({ scrollRef, overloadCount = OVERLOAD_COUNT, shou
const content = data?.items ? ( const content = data?.items ? (
<> <>
<Hide below="lg" ssr={ false }> <Box hideBelow="lg">
<TokenTransferTable <TokenTransferTable
data={ data?.items } data={ data?.items }
baseAddress={ currentAddress } baseAddress={ currentAddress }
...@@ -213,8 +213,8 @@ const AddressTokenTransfers = ({ scrollRef, overloadCount = OVERLOAD_COUNT, shou ...@@ -213,8 +213,8 @@ const AddressTokenTransfers = ({ scrollRef, overloadCount = OVERLOAD_COUNT, shou
socketInfoNum={ newItemsCount } socketInfoNum={ newItemsCount }
isLoading={ isPlaceholderData } isLoading={ isPlaceholderData }
/> />
</Hide> </Box>
<Show below="lg" ssr={ false }> <Box hideFrom="lg">
{ pagination.page === 1 && !tokenFilter && ( { pagination.page === 1 && !tokenFilter && (
<SocketNewItemsNotice.Mobile <SocketNewItemsNotice.Mobile
url={ window.location.href } url={ window.location.href }
...@@ -231,7 +231,7 @@ const AddressTokenTransfers = ({ scrollRef, overloadCount = OVERLOAD_COUNT, shou ...@@ -231,7 +231,7 @@ const AddressTokenTransfers = ({ scrollRef, overloadCount = OVERLOAD_COUNT, shou
enableTimeIncrement enableTimeIncrement
isLoading={ isPlaceholderData } isLoading={ isPlaceholderData }
/> />
</Show> </Box>
</> </>
) : null; ) : null;
...@@ -280,15 +280,16 @@ const AddressTokenTransfers = ({ scrollRef, overloadCount = OVERLOAD_COUNT, shou ...@@ -280,15 +280,16 @@ const AddressTokenTransfers = ({ scrollRef, overloadCount = OVERLOAD_COUNT, shou
return ( return (
<DataListDisplay <DataListDisplay
isError={ isError } isError={ isError }
items={ data?.items } itemsNum={ data?.items?.length }
emptyText="There are no token transfers." emptyText="There are no token transfers."
filterProps={{ filterProps={{
emptyFilteredText: `Couldn${ apos }t find any token transfer that matches your query.`, emptyFilteredText: `Couldn${ apos }t find any token transfer that matches your query.`,
hasActiveFilters: Boolean(numActiveFilters), hasActiveFilters: Boolean(numActiveFilters),
}} }}
content={ content }
actionBar={ actionBar } actionBar={ actionBar }
/> >
{ content }
</DataListDisplay>
); );
}; };
......
import { Show, Hide } from '@chakra-ui/react'; import { Box } from '@chakra-ui/react';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import React from 'react'; import React from 'react';
...@@ -43,7 +43,7 @@ const AddressWithdrawals = ({ scrollRef, shouldRender = true, isQueryEnabled = t ...@@ -43,7 +43,7 @@ const AddressWithdrawals = ({ scrollRef, shouldRender = true, isQueryEnabled = t
const content = data?.items ? ( const content = data?.items ? (
<> <>
<Show below="lg" ssr={ false }> <Box hideFrom="lg">
{ data.items.map((item, index) => ( { data.items.map((item, index) => (
<BeaconChainWithdrawalsListItem <BeaconChainWithdrawalsListItem
key={ item.index + Number(isPlaceholderData ? index : '') } key={ item.index + Number(isPlaceholderData ? index : '') }
...@@ -52,15 +52,15 @@ const AddressWithdrawals = ({ scrollRef, shouldRender = true, isQueryEnabled = t ...@@ -52,15 +52,15 @@ const AddressWithdrawals = ({ scrollRef, shouldRender = true, isQueryEnabled = t
isLoading={ isPlaceholderData } isLoading={ isPlaceholderData }
/> />
)) } )) }
</Show> </Box>
<Hide below="lg" ssr={ false }> <Box hideBelow="lg">
<BeaconChainWithdrawalsTable <BeaconChainWithdrawalsTable
items={ data.items } items={ data.items }
view="address" view="address"
top={ pagination.isVisible ? ACTION_BAR_HEIGHT_DESKTOP : 0 } top={ pagination.isVisible ? ACTION_BAR_HEIGHT_DESKTOP : 0 }
isLoading={ isPlaceholderData } isLoading={ isPlaceholderData }
/> />
</Hide> </Box>
</> </>
) : null ; ) : null ;
...@@ -73,11 +73,12 @@ const AddressWithdrawals = ({ scrollRef, shouldRender = true, isQueryEnabled = t ...@@ -73,11 +73,12 @@ const AddressWithdrawals = ({ scrollRef, shouldRender = true, isQueryEnabled = t
return ( return (
<DataListDisplay <DataListDisplay
isError={ isError } isError={ isError }
items={ data?.items } itemsNum={ data?.items?.length }
emptyText="There are no withdrawals for this address." emptyText="There are no withdrawals for this address."
content={ content }
actionBar={ actionBar } actionBar={ actionBar }
/> >
{ content }
</DataListDisplay>
); );
}; };
......
...@@ -172,28 +172,28 @@ const AddressPageContent = () => { ...@@ -172,28 +172,28 @@ const AddressPageContent = () => {
// component: <AddressAccountHistory scrollRef={ tabsScrollRef } shouldRender={ !isTabsLoading } isQueryEnabled={ areQueriesEnabled }/>, // component: <AddressAccountHistory scrollRef={ tabsScrollRef } shouldRender={ !isTabsLoading } isQueryEnabled={ areQueriesEnabled }/>,
// } : // } :
// undefined, // undefined,
// config.features.userOps.isEnabled && Boolean(userOpsAccountQuery.data?.total_ops) ? config.features.userOps.isEnabled && Boolean(userOpsAccountQuery.data?.total_ops) ?
// { {
// id: 'user_ops', id: 'user_ops',
// title: 'User operations', title: 'User operations',
// count: userOpsAccountQuery.data?.total_ops, count: userOpsAccountQuery.data?.total_ops,
// component: <AddressUserOps shouldRender={ !isTabsLoading } isQueryEnabled={ areQueriesEnabled }/>, component: <AddressUserOps shouldRender={ !isTabsLoading } isQueryEnabled={ areQueriesEnabled }/>,
// } : } :
// undefined, undefined,
// config.features.beaconChain.isEnabled && addressTabsCountersQuery.data?.withdrawals_count ? config.features.beaconChain.isEnabled && addressTabsCountersQuery.data?.withdrawals_count ?
// { {
// id: 'withdrawals', id: 'withdrawals',
// title: 'Withdrawals', title: 'Withdrawals',
// count: addressTabsCountersQuery.data?.withdrawals_count, count: addressTabsCountersQuery.data?.withdrawals_count,
// component: <AddressWithdrawals scrollRef={ tabsScrollRef } shouldRender={ !isTabsLoading } isQueryEnabled={ areQueriesEnabled }/>, component: <AddressWithdrawals scrollRef={ tabsScrollRef } shouldRender={ !isTabsLoading } isQueryEnabled={ areQueriesEnabled }/>,
// } : } :
// undefined, undefined,
// { {
// id: 'token_transfers', id: 'token_transfers',
// title: 'Token transfers', title: 'Token transfers',
// count: addressTabsCountersQuery.data?.token_transfers_count, count: addressTabsCountersQuery.data?.token_transfers_count,
// component: <AddressTokenTransfers scrollRef={ tabsScrollRef } shouldRender={ !isTabsLoading } isQueryEnabled={ areQueriesEnabled }/>, component: <AddressTokenTransfers scrollRef={ tabsScrollRef } shouldRender={ !isTabsLoading } isQueryEnabled={ areQueriesEnabled }/>,
// }, },
// { // {
// id: 'tokens', // id: 'tokens',
// title: 'Tokens', // title: 'Tokens',
...@@ -226,14 +226,14 @@ const AddressPageContent = () => { ...@@ -226,14 +226,14 @@ const AddressPageContent = () => {
component: <AddressBlocksValidated scrollRef={ tabsScrollRef } shouldRender={ !isTabsLoading } isQueryEnabled={ areQueriesEnabled }/>, component: <AddressBlocksValidated scrollRef={ tabsScrollRef } shouldRender={ !isTabsLoading } isQueryEnabled={ areQueriesEnabled }/>,
} : } :
undefined, undefined,
// addressTabsCountersQuery.data?.logs_count ? addressTabsCountersQuery.data?.logs_count ?
// { {
// id: 'logs', id: 'logs',
// title: 'Logs', title: 'Logs',
// count: addressTabsCountersQuery.data?.logs_count, count: addressTabsCountersQuery.data?.logs_count,
// component: <AddressLogs scrollRef={ tabsScrollRef } shouldRender={ !isTabsLoading } isQueryEnabled={ areQueriesEnabled }/>, component: <AddressLogs scrollRef={ tabsScrollRef } shouldRender={ !isTabsLoading } isQueryEnabled={ areQueriesEnabled }/>,
// } : } :
// undefined, undefined,
// addressQuery.data?.is_contract ? { // addressQuery.data?.is_contract ? {
// id: 'contract', // id: 'contract',
......
...@@ -28,6 +28,7 @@ interface Props { ...@@ -28,6 +28,7 @@ interface Props {
as?: React.ElementType; as?: React.ElementType;
} }
// TODO @tom2drum fix truncation when loading
const HashStringShortenDynamic = ({ hash, fontWeight = '400', isTooltipDisabled, tailLength = TAIL_LENGTH, as = 'span' }: Props) => { const HashStringShortenDynamic = ({ hash, fontWeight = '400', isTooltipDisabled, tailLength = TAIL_LENGTH, as = 'span' }: Props) => {
const elementRef = useRef<HTMLSpanElement>(null); const elementRef = useRef<HTMLSpanElement>(null);
const [ displayedString, setDisplayedString ] = React.useState(hash); const [ displayedString, setDisplayedString ] = React.useState(hash);
......
import { Text, Alert, Link, chakra } from '@chakra-ui/react'; import { Text, chakra } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import { Alert } from 'toolkit/chakra/alert';
import { Link } from 'toolkit/chakra/link';
interface Props { interface Props {
className?: string; className?: string;
} }
......
...@@ -45,7 +45,7 @@ const LogDecodedInputDataHeader = ({ methodId, methodCall, isLoading, rightSlot ...@@ -45,7 +45,7 @@ const LogDecodedInputDataHeader = ({ methodId, methodCall, isLoading, rightSlot
{ rightSlot } { rightSlot }
</Flex> </Flex>
<Item label="Call" isLoading={ isLoading }> <Item label="Call" isLoading={ isLoading }>
<Skeleton loading={ isLoading } whiteSpace="pre-wrap" w="100%">{ methodCall }</Skeleton> <Skeleton loading={ isLoading } whiteSpace="pre-wrap" flexGrow={ 1 }>{ methodCall }</Skeleton>
</Item> </Item>
</VStack> </VStack>
); );
......
...@@ -14,9 +14,10 @@ const LogIndex = ({ children, isLoading, ...props }: Props) => { ...@@ -14,9 +14,10 @@ const LogIndex = ({ children, isLoading, ...props }: Props) => {
<Tooltip content="Log index"> <Tooltip content="Log index">
<Skeleton loading={ isLoading } asChild> <Skeleton loading={ isLoading } asChild>
<Center <Center
color={{ _light: 'blue.600', _dark: 'gray.50' }} color={ isLoading ? 'transparent' : { _light: 'blue.600', _dark: 'gray.50' } }
bgColor={{ _light: 'blue.50', _dark: 'gray.600' }} bgColor={ isLoading ? undefined : { _light: 'blue.50', _dark: 'gray.600' } }
borderRadius="base" borderRadius="base"
px={ 2 }
{ ...props } { ...props }
> >
{ children } { children }
......
...@@ -63,12 +63,14 @@ const LogItem = ({ address, index, topics, data, decoded, type, transaction_hash ...@@ -63,12 +63,14 @@ const LogItem = ({ address, index, topics, data, decoded, type, transaction_hash
hash={ txHash } hash={ txHash }
isLoading={ isLoading } isLoading={ isLoading }
mr={{ base: 9, lg: 4 }} mr={{ base: 9, lg: 4 }}
w="100%"
/> />
) : ( ) : (
<AddressEntity <AddressEntity
address={ address } address={ address }
isLoading={ isLoading } isLoading={ isLoading }
mr={{ base: 9, lg: 4 }} mr={{ base: 9, lg: 4 }}
w="100%"
/> />
) } ) }
{ /* api doesn't have find topic feature yet */ } { /* api doesn't have find topic feature yet */ }
......
...@@ -51,8 +51,7 @@ const BeaconChainWithdrawalsListItem = ({ item, isLoading, view }: Props) => { ...@@ -51,8 +51,7 @@ const BeaconChainWithdrawalsListItem = ({ item, isLoading, view }: Props) => {
<BlockEntity <BlockEntity
number={ item.block_number } number={ item.block_number }
isLoading={ isLoading } isLoading={ isLoading }
fontSize="sm" textStyle="sm"
lineHeight={ 5 }
/> />
</ListItemMobileGrid.Value> </ListItemMobileGrid.Value>
</> </>
......
...@@ -36,8 +36,7 @@ const BeaconChainWithdrawalsTableItem = ({ item, view, isLoading }: Props) => { ...@@ -36,8 +36,7 @@ const BeaconChainWithdrawalsTableItem = ({ item, view, isLoading }: Props) => {
<BlockEntity <BlockEntity
number={ item.block_number } number={ item.block_number }
isLoading={ isLoading } isLoading={ isLoading }
fontSize="sm" textStyle="sm"
lineHeight={ 5 }
noIcon noIcon
/> />
</TableCell> </TableCell>
......
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