Commit a19110b6 authored by tom's avatar tom

block withdrawals, blob txs and epoch rewards tabs

parent 31a8d6be
...@@ -14,6 +14,7 @@ export interface AlertProps extends Omit<ChakraAlert.RootProps, 'title'> { ...@@ -14,6 +14,7 @@ export interface AlertProps extends Omit<ChakraAlert.RootProps, 'title'> {
closable?: boolean; closable?: boolean;
onClose?: () => void; onClose?: () => void;
loading?: boolean; loading?: boolean;
showIcon?: boolean;
} }
export const Alert = React.forwardRef<HTMLDivElement, AlertProps>( export const Alert = React.forwardRef<HTMLDivElement, AlertProps>(
...@@ -27,15 +28,28 @@ export const Alert = React.forwardRef<HTMLDivElement, AlertProps>( ...@@ -27,15 +28,28 @@ export const Alert = React.forwardRef<HTMLDivElement, AlertProps>(
startElement, startElement,
endElement, endElement,
loading, loading,
showIcon = false,
...rest ...rest
} = props; } = props;
const defaultIcon = <IconSvg name="info_filled" w="100%" h="100%"/>; const defaultIcon = <IconSvg name="info_filled" w="100%" h="100%"/>;
const iconElement = (() => {
if (startElement !== undefined) {
return startElement;
}
if (!showIcon && icon === undefined) {
return null;
}
return <ChakraAlert.Indicator>{ icon || defaultIcon }</ChakraAlert.Indicator>;
})();
return ( return (
<Skeleton loading={ loading } asChild> <Skeleton loading={ loading } asChild>
<ChakraAlert.Root ref={ ref } { ...rest }> <ChakraAlert.Root ref={ ref } { ...rest }>
{ startElement !== undefined || icon !== undefined ? startElement : <ChakraAlert.Indicator>{ icon || defaultIcon }</ChakraAlert.Indicator> } { iconElement }
{ children ? ( { children ? (
<ChakraAlert.Content> <ChakraAlert.Content>
{ title && <ChakraAlert.Title>{ title }</ChakraAlert.Title> } { title && <ChakraAlert.Title>{ title }</ChakraAlert.Title> }
......
...@@ -46,7 +46,7 @@ export const SkeletonText = React.forwardRef<HTMLDivElement, SkeletonTextProps>( ...@@ -46,7 +46,7 @@ export const SkeletonText = React.forwardRef<HTMLDivElement, SkeletonTextProps>(
export const Skeleton = React.forwardRef<HTMLDivElement, ChakraSkeletonProps>( export const Skeleton = React.forwardRef<HTMLDivElement, ChakraSkeletonProps>(
function Skeleton(props, ref) { function Skeleton(props, ref) {
const { loading = false, ...rest } = props; const { loading = true, ...rest } = props;
return <ChakraSkeleton loading={ loading } { ...(loading ? { 'data-loading': true } : {}) } { ...rest } ref={ ref }/>; return <ChakraSkeleton loading={ loading } { ...(loading ? { 'data-loading': true } : {}) } { ...rest } ref={ ref }/>;
}, },
); );
...@@ -95,6 +95,14 @@ export const recipe = defineSlotRecipe({ ...@@ -95,6 +95,14 @@ export const recipe = defineSlotRecipe({
}, },
}, },
variant: {
subtle: {
root: {
color: 'alert.fg',
},
},
},
inline: { inline: {
'true': { 'true': {
root: { root: {
...@@ -134,5 +142,6 @@ export const recipe = defineSlotRecipe({ ...@@ -134,5 +142,6 @@ export const recipe = defineSlotRecipe({
status: 'neutral', status: 'neutral',
size: 'md', size: 'md',
inline: true, inline: true,
variant: 'subtle',
}, },
}); });
...@@ -17,9 +17,10 @@ export const recipe = defineSlotRecipe({ ...@@ -17,9 +17,10 @@ export const recipe = defineSlotRecipe({
textAlign: 'start', textAlign: 'start',
alignItems: 'center', alignItems: 'center',
verticalAlign: 'top', verticalAlign: 'top',
fontWeight: 'medium',
}, },
columnHeader: { columnHeader: {
fontWeight: '500', fontWeight: 'medium',
textAlign: 'start', textAlign: 'start',
}, },
}, },
......
import { Show, Hide } from '@chakra-ui/react'; import { Box } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import DataListDisplay from 'ui/shared/DataListDisplay'; import DataListDisplay from 'ui/shared/DataListDisplay';
...@@ -14,31 +14,32 @@ const TABS_HEIGHT = 88; ...@@ -14,31 +14,32 @@ const TABS_HEIGHT = 88;
const BlockWithdrawals = ({ blockWithdrawalsQuery }: Props) => { const BlockWithdrawals = ({ blockWithdrawalsQuery }: Props) => {
const content = blockWithdrawalsQuery.data?.items ? ( const content = blockWithdrawalsQuery.data?.items ? (
<> <>
<Show below="lg" ssr={ false }> <Box hideFrom="lg">
<BeaconChainWithdrawalsList <BeaconChainWithdrawalsList
items={ blockWithdrawalsQuery.data.items } items={ blockWithdrawalsQuery.data.items }
isLoading={ blockWithdrawalsQuery.isPlaceholderData } isLoading={ blockWithdrawalsQuery.isPlaceholderData }
view="block" view="block"
/> />
</Show> </Box>
<Hide below="lg" ssr={ false }> <Box hideBelow="lg">
<BeaconChainWithdrawalsTable <BeaconChainWithdrawalsTable
items={ blockWithdrawalsQuery.data.items } items={ blockWithdrawalsQuery.data.items }
isLoading={ blockWithdrawalsQuery.isPlaceholderData } isLoading={ blockWithdrawalsQuery.isPlaceholderData }
top={ blockWithdrawalsQuery.pagination.isVisible ? TABS_HEIGHT : 0 } top={ blockWithdrawalsQuery.pagination.isVisible ? TABS_HEIGHT : 0 }
view="block" view="block"
/> />
</Hide> </Box>
</> </>
) : null ; ) : null ;
return ( return (
<DataListDisplay <DataListDisplay
isError={ blockWithdrawalsQuery.isError } isError={ blockWithdrawalsQuery.isError }
items={ blockWithdrawalsQuery.data?.items } itemsNum={ blockWithdrawalsQuery.data?.items?.length }
emptyText="There are no withdrawals for this block." emptyText="There are no withdrawals for this block."
content={ content } >
/> { content }
</DataListDisplay>
); );
}; };
......
import { Box, Grid, GridItem, Text, useColorModeValue } from '@chakra-ui/react'; import { Box, Grid, GridItem, Text } from '@chakra-ui/react';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import React from 'react'; import React from 'react';
...@@ -24,8 +24,6 @@ const BlockEpochElectionRewardDetailsDesktop = ({ type, token }: Props) => { ...@@ -24,8 +24,6 @@ const BlockEpochElectionRewardDetailsDesktop = ({ type, token }: Props) => {
const router = useRouter(); const router = useRouter();
const heightOrHash = getQueryParamString(router.query.height_or_hash); const heightOrHash = getQueryParamString(router.query.height_or_hash);
const bgColor = useColorModeValue('blackAlpha.50', 'whiteAlpha.50');
const { cutRef, query } = useLazyLoadedList({ const { cutRef, query } = useLazyLoadedList({
rootRef, rootRef,
resourceName: 'block_election_rewards', resourceName: 'block_election_rewards',
...@@ -40,7 +38,7 @@ const BlockEpochElectionRewardDetailsDesktop = ({ type, token }: Props) => { ...@@ -40,7 +38,7 @@ const BlockEpochElectionRewardDetailsDesktop = ({ type, token }: Props) => {
return ( return (
<Box <Box
p={ 4 } p={ 4 }
bgColor={ bgColor } bgColor={{ _light: 'blackAlpha.50', _dark: 'whiteAlpha.50' }}
borderRadius="base" borderRadius="base"
maxH="360px" maxH="360px"
overflowY="scroll" overflowY="scroll"
......
import { Box, Flex, Text, useColorModeValue } from '@chakra-ui/react'; import { Box, Flex, Text } from '@chakra-ui/react';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import React from 'react'; import React from 'react';
...@@ -25,8 +25,6 @@ const BlockEpochElectionRewardDetailsMobile = ({ type, token }: Props) => { ...@@ -25,8 +25,6 @@ const BlockEpochElectionRewardDetailsMobile = ({ type, token }: Props) => {
const router = useRouter(); const router = useRouter();
const heightOrHash = getQueryParamString(router.query.height_or_hash); const heightOrHash = getQueryParamString(router.query.height_or_hash);
const bgColor = useColorModeValue('blackAlpha.50', 'whiteAlpha.50');
const { cutRef, query } = useLazyLoadedList({ const { cutRef, query } = useLazyLoadedList({
rootRef, rootRef,
resourceName: 'block_election_rewards', resourceName: 'block_election_rewards',
...@@ -37,7 +35,15 @@ const BlockEpochElectionRewardDetailsMobile = ({ type, token }: Props) => { ...@@ -37,7 +35,15 @@ const BlockEpochElectionRewardDetailsMobile = ({ type, token }: Props) => {
}); });
return ( return (
<Flex flexDir="column" rowGap={ 3 } p={ 4 } bgColor={ bgColor } borderRadius="base" maxH="360px" overflowY="scroll"> <Flex
flexDir="column"
rowGap={ 3 }
p={ 4 }
bgColor={{ _light: 'blackAlpha.50', _dark: 'whiteAlpha.50' }}
borderRadius="base"
maxH="360px"
overflowY="scroll"
>
{ query.data?.pages { query.data?.pages
.map((page) => page.items) .map((page) => page.items)
......
import { Box, Heading, Hide, Show, Table, Tbody, Th, Thead, Tr } from '@chakra-ui/react'; import { Box } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import type { BlockEpoch } from 'types/api/block'; import type { BlockEpoch } from 'types/api/block';
import { Heading } from 'toolkit/chakra/heading';
import { TableBody, TableColumnHeader, TableHeaderSticky, TableRoot, TableRow } from 'toolkit/chakra/table';
import BlockEpochElectionRewardsListItem from './BlockEpochElectionRewardsListItem'; import BlockEpochElectionRewardsListItem from './BlockEpochElectionRewardsListItem';
import BlockEpochElectionRewardsTableItem from './BlockEpochElectionRewardsTableItem'; import BlockEpochElectionRewardsTableItem from './BlockEpochElectionRewardsTableItem';
...@@ -14,18 +17,18 @@ interface Props { ...@@ -14,18 +17,18 @@ interface Props {
const BlockEpochElectionRewards = ({ data, isLoading }: Props) => { const BlockEpochElectionRewards = ({ data, isLoading }: Props) => {
return ( return (
<Box mt={ 8 }> <Box mt={ 8 }>
<Heading as="h4" size="sm" mb={ 3 }>Election rewards</Heading> <Heading level="3" mb={ 3 }>Election rewards</Heading>
<Hide below="lg" ssr={ false }> <Box hideBelow="lg">
<Table style={{ tableLayout: 'auto' }}> <TableRoot style={{ tableLayout: 'auto' }}>
<Thead> <TableHeaderSticky>
<Tr> <TableRow>
<Th width="24px"/> <TableColumnHeader width="24px"/>
<Th width="180px">Reward type</Th> <TableColumnHeader width="180px">Reward type</TableColumnHeader>
<Th/> <TableColumnHeader/>
<Th isNumeric>Value</Th> <TableColumnHeader isNumeric>Value</TableColumnHeader>
</Tr> </TableRow>
</Thead> </TableHeaderSticky>
<Tbody> <TableBody>
{ Object.entries(data.aggregated_election_rewards).map((entry) => { { Object.entries(data.aggregated_election_rewards).map((entry) => {
const key = entry[0] as keyof BlockEpoch['aggregated_election_rewards']; const key = entry[0] as keyof BlockEpoch['aggregated_election_rewards'];
const value = entry[1]; const value = entry[1];
...@@ -43,10 +46,10 @@ const BlockEpochElectionRewards = ({ data, isLoading }: Props) => { ...@@ -43,10 +46,10 @@ const BlockEpochElectionRewards = ({ data, isLoading }: Props) => {
/> />
); );
}) } }) }
</Tbody> </TableBody>
</Table> </TableRoot>
</Hide> </Box>
<Show below="lg" ssr={ false }> <Box hideFrom="lg">
{ Object.entries(data.aggregated_election_rewards).map((entry) => { { Object.entries(data.aggregated_election_rewards).map((entry) => {
const key = entry[0] as keyof BlockEpoch['aggregated_election_rewards']; const key = entry[0] as keyof BlockEpoch['aggregated_election_rewards'];
const value = entry[1]; const value = entry[1];
...@@ -64,7 +67,7 @@ const BlockEpochElectionRewards = ({ data, isLoading }: Props) => { ...@@ -64,7 +67,7 @@ const BlockEpochElectionRewards = ({ data, isLoading }: Props) => {
/> />
); );
}) } }) }
</Show> </Box>
</Box> </Box>
); );
}; };
......
import { Box, Flex, IconButton, useDisclosure } from '@chakra-ui/react'; import { Box, Flex } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import type { BlockEpoch, BlockEpochElectionReward } from 'types/api/block'; import type { BlockEpoch, BlockEpochElectionReward } from 'types/api/block';
import getCurrencyValue from 'lib/getCurrencyValue'; import getCurrencyValue from 'lib/getCurrencyValue';
import Skeleton from 'ui/shared/chakra/Skeleton'; import { IconButton } from 'toolkit/chakra/icon-button';
import { Skeleton } from 'toolkit/chakra/skeleton';
import { useDisclosure } from 'toolkit/hooks/useDisclosure';
import TokenEntity from 'ui/shared/entities/token/TokenEntity'; import TokenEntity from 'ui/shared/entities/token/TokenEntity';
import EpochRewardTypeTag from 'ui/shared/EpochRewardTypeTag'; import EpochRewardTypeTag from 'ui/shared/EpochRewardTypeTag';
import IconSvg from 'ui/shared/IconSvg'; import IconSvg from 'ui/shared/IconSvg';
...@@ -37,27 +39,26 @@ const BlockEpochElectionRewardsListItem = ({ data, isLoading, type }: Props) => ...@@ -37,27 +39,26 @@ const BlockEpochElectionRewardsListItem = ({ data, isLoading, type }: Props) =>
> >
<Flex my="3px" columnGap={ 3 } alignItems="center" flexWrap="wrap" rowGap={ 2 }> <Flex my="3px" columnGap={ 3 } alignItems="center" flexWrap="wrap" rowGap={ 2 }>
{ data.count ? ( { data.count ? (
<Skeleton isLoaded={ !isLoading } display="flex" borderRadius="sm"> <Skeleton loading={ isLoading } display="flex" borderRadius="sm">
<IconButton <IconButton
aria-label={ section.isOpen ? 'Collapse section' : 'Expand section' } aria-label={ section.open ? 'Collapse section' : 'Expand section' }
variant="link" variant="link"
boxSize={ 6 } boxSize={ 6 }
flexShrink={ 0 } flexShrink={ 0 }
icon={ ( >
<IconSvg <IconSvg
name="arrows/east-mini" name="arrows/east-mini"
boxSize={ 6 } boxSize={ 6 }
transform={ section.isOpen ? 'rotate(270deg)' : 'rotate(180deg)' } transform={ section.open ? 'rotate(270deg)' : 'rotate(180deg)' }
transitionDuration="faster" transitionDuration="faster"
/> />
) } </IconButton>
/>
</Skeleton> </Skeleton>
) : <Box boxSize={ 6 }/> } ) : <Box boxSize={ 6 }/> }
<EpochRewardTypeTag type={ type } isLoading={ isLoading }/> <EpochRewardTypeTag type={ type } isLoading={ isLoading }/>
<Skeleton isLoaded={ !isLoading }>{ data.count }</Skeleton> <Skeleton loading={ isLoading }>{ data.count }</Skeleton>
<Flex columnGap={ 2 } alignItems="center" ml={{ base: 9, lg: 'auto' }} w={{ base: '100%', lg: 'fit-content' }} fontWeight={ 500 }> <Flex columnGap={ 2 } alignItems="center" ml={{ base: 9, lg: 'auto' }} w={{ base: '100%', lg: 'fit-content' }} fontWeight={ 500 }>
<Skeleton isLoaded={ !isLoading }>{ valueStr }</Skeleton> <Skeleton loading={ isLoading }>{ valueStr }</Skeleton>
<TokenEntity <TokenEntity
token={ data.token } token={ data.token }
noCopy noCopy
...@@ -67,7 +68,7 @@ const BlockEpochElectionRewardsListItem = ({ data, isLoading, type }: Props) => ...@@ -67,7 +68,7 @@ const BlockEpochElectionRewardsListItem = ({ data, isLoading, type }: Props) =>
/> />
</Flex> </Flex>
</Flex> </Flex>
{ section.isOpen && ( { section.open && (
<Box mt={ 2 }> <Box mt={ 2 }>
<BlockEpochElectionRewardDetailsMobile type={ type } token={ data.token }/> <BlockEpochElectionRewardDetailsMobile type={ type } token={ data.token }/>
</Box> </Box>
......
import { Flex, IconButton, Td, Tr, useDisclosure } from '@chakra-ui/react'; import { Flex } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import type { BlockEpoch, BlockEpochElectionReward } from 'types/api/block'; import type { BlockEpoch, BlockEpochElectionReward } from 'types/api/block';
import getCurrencyValue from 'lib/getCurrencyValue'; import getCurrencyValue from 'lib/getCurrencyValue';
import Skeleton from 'ui/shared/chakra/Skeleton'; import { IconButton } from 'toolkit/chakra/icon-button';
import { Skeleton } from 'toolkit/chakra/skeleton';
import { TableCell, TableRow } from 'toolkit/chakra/table';
import { useDisclosure } from 'toolkit/hooks/useDisclosure';
import TokenEntity from 'ui/shared/entities/token/TokenEntity'; import TokenEntity from 'ui/shared/entities/token/TokenEntity';
import EpochRewardTypeTag from 'ui/shared/EpochRewardTypeTag'; import EpochRewardTypeTag from 'ui/shared/EpochRewardTypeTag';
import IconSvg from 'ui/shared/IconSvg'; import IconSvg from 'ui/shared/IconSvg';
...@@ -26,45 +29,42 @@ const BlockEpochElectionRewardsTableItem = ({ isLoading, data, type }: Props) => ...@@ -26,45 +29,42 @@ const BlockEpochElectionRewardsTableItem = ({ isLoading, data, type }: Props) =>
decimals: data.token.decimals, decimals: data.token.decimals,
}); });
const mainRowBorderColor = section.isOpen ? 'transparent' : 'border.divider'; const mainRowBorderColor = section.open ? 'transparent' : 'border.divider';
return ( return (
<> <>
<Tr <TableRow
onClick={ isLoading || !data.count ? undefined : section.onToggle } onClick={ isLoading || !data.count ? undefined : section.onToggle }
cursor={ isLoading || !data.count ? undefined : 'pointer' } cursor={ isLoading || !data.count ? undefined : 'pointer' }
> >
<Td borderColor={ mainRowBorderColor }> <TableCell borderColor={ mainRowBorderColor }>
{ Boolean(data.count) && ( { Boolean(data.count) && (
<Skeleton isLoaded={ !isLoading } display="flex" borderRadius="sm"> <Skeleton loading={ isLoading } display="flex" borderRadius="sm">
<IconButton <IconButton
aria-label={ section.isOpen ? 'Collapse section' : 'Expand section' } aria-label={ section.open ? 'Collapse section' : 'Expand section' }
variant="link" variant="link"
boxSize={ 6 } >
flexShrink={ 0 } <IconSvg
icon={ ( name="arrows/east-mini"
<IconSvg boxSize={ 6 }
name="arrows/east-mini" transform={ section.open ? 'rotate(270deg)' : 'rotate(180deg)' }
boxSize={ 6 } transitionDuration="faster"
transform={ section.isOpen ? 'rotate(270deg)' : 'rotate(180deg)' } />
transitionDuration="faster" </IconButton>
/>
) }
/>
</Skeleton> </Skeleton>
) } ) }
</Td> </TableCell>
<Td borderColor={ mainRowBorderColor }> <TableCell borderColor={ mainRowBorderColor }>
<EpochRewardTypeTag type={ type } isLoading={ isLoading }/> <EpochRewardTypeTag type={ type } isLoading={ isLoading }/>
</Td> </TableCell>
<Td borderColor={ mainRowBorderColor }> <TableCell borderColor={ mainRowBorderColor }>
<Skeleton isLoaded={ !isLoading } fontWeight={ 400 } my={ 1 }> <Skeleton loading={ isLoading } fontWeight={ 400 } my={ 1 }>
{ getRewardNumText(type, data.count) } { getRewardNumText(type, data.count) }
</Skeleton> </Skeleton>
</Td> </TableCell>
<Td borderColor={ mainRowBorderColor }> <TableCell borderColor={ mainRowBorderColor }>
<Flex columnGap={ 2 } alignItems="center" justifyContent="flex-end" my="2px"> <Flex columnGap={ 2 } alignItems="center" justifyContent="flex-end" my="2px">
<Skeleton isLoaded={ !isLoading }>{ valueStr }</Skeleton> <Skeleton loading={ isLoading }>{ valueStr }</Skeleton>
<TokenEntity <TokenEntity
token={ data.token } token={ data.token }
noCopy noCopy
...@@ -73,15 +73,15 @@ const BlockEpochElectionRewardsTableItem = ({ isLoading, data, type }: Props) => ...@@ -73,15 +73,15 @@ const BlockEpochElectionRewardsTableItem = ({ isLoading, data, type }: Props) =>
isLoading={ isLoading } isLoading={ isLoading }
/> />
</Flex> </Flex>
</Td> </TableCell>
</Tr> </TableRow>
{ section.isOpen && ( { section.open && (
<Tr> <TableRow>
<Td/> <TableCell/>
<Td colSpan={ 3 } pr={ 0 } pt={ 0 }> <TableCell colSpan={ 3 } pr={ 0 } pt={ 0 }>
<BlockEpochElectionRewardDetailsDesktop type={ type } token={ data.token }/> <BlockEpochElectionRewardDetailsDesktop type={ type } token={ data.token }/>
</Td> </TableCell>
</Tr> </TableRow>
) } ) }
</> </>
); );
......
...@@ -78,30 +78,30 @@ const BlockPageContent = () => { ...@@ -78,30 +78,30 @@ const BlockPageContent = () => {
</> </>
), ),
}, },
// config.features.dataAvailability.isEnabled && blockQuery.data?.blob_transaction_count ? config.features.dataAvailability.isEnabled && blockQuery.data?.blob_transaction_count ?
// { {
// id: 'blob_txs', id: 'blob_txs',
// title: 'Blob txns', title: 'Blob txns',
// component: ( component: (
// <TxsWithFrontendSorting query={ blockBlobTxsQuery } showBlockInfo={ false } showSocketInfo={ false }/> <TxsWithFrontendSorting query={ blockBlobTxsQuery } showBlockInfo={ false } showSocketInfo={ false }/>
// ), ),
// } : null, } : null,
// config.features.beaconChain.isEnabled && Boolean(blockQuery.data?.withdrawals_count) ? config.features.beaconChain.isEnabled && Boolean(blockQuery.data?.withdrawals_count) ?
// { {
// id: 'withdrawals', id: 'withdrawals',
// title: 'Withdrawals', title: 'Withdrawals',
// component: ( component: (
// <> <>
// { blockWithdrawalsQuery.isDegradedData && <ServiceDegradationWarning isLoading={ blockWithdrawalsQuery.isPlaceholderData } mb={ 6 }/> } { blockWithdrawalsQuery.isDegradedData && <ServiceDegradationWarning isLoading={ blockWithdrawalsQuery.isPlaceholderData } mb={ 6 }/> }
// <BlockWithdrawals blockWithdrawalsQuery={ blockWithdrawalsQuery }/> <BlockWithdrawals blockWithdrawalsQuery={ blockWithdrawalsQuery }/>
// </> </>
// ), ),
// } : null, } : null,
// blockQuery.data?.celo?.is_epoch_block ? { blockQuery.data?.celo?.is_epoch_block ? {
// id: 'epoch_rewards', id: 'epoch_rewards',
// title: 'Epoch rewards', title: 'Epoch rewards',
// component: <BlockEpochRewards heightOrHash={ heightOrHash }/>, component: <BlockEpochRewards heightOrHash={ heightOrHash }/>,
// } : null, } : null,
].filter(Boolean)), [ blockBlobTxsQuery, blockQuery, blockTxsQuery, blockWithdrawalsQuery, hasPagination, heightOrHash ]); ].filter(Boolean)), [ blockBlobTxsQuery, blockQuery, blockTxsQuery, blockWithdrawalsQuery, hasPagination, heightOrHash ]);
let pagination; let pagination;
......
import { Tooltip } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import type { EpochRewardsType } from 'types/api/block'; import type { EpochRewardsType } from 'types/api/block';
import Tag from 'ui/shared/chakra/Tag'; import { Badge } from 'toolkit/chakra/badge';
import { Tooltip } from 'toolkit/chakra/tooltip';
type Props = { type Props = {
type: EpochRewardsType; type: EpochRewardsType;
...@@ -39,10 +39,10 @@ const EpochRewardTypeTag = ({ type, isLoading }: Props) => { ...@@ -39,10 +39,10 @@ const EpochRewardTypeTag = ({ type, isLoading }: Props) => {
const { text, label, color } = TYPE_TAGS[type]; const { text, label, color } = TYPE_TAGS[type];
return ( return (
<Tooltip label={ label } maxW="322px" textAlign="center"> <Tooltip content={ label }>
<Tag colorScheme={ color } isLoading={ isLoading }> <Badge colorScheme={ color } loading={ isLoading }>
{ text } { text }
</Tag> </Badge>
</Tooltip> </Tooltip>
); );
}; };
......
...@@ -62,7 +62,6 @@ const SocketNewItemsNotice = chakra(({ children, className, url, num, alert, typ ...@@ -62,7 +62,6 @@ const SocketNewItemsNotice = chakra(({ children, className, url, num, alert, typ
px={ 4 } px={ 4 }
py="6px" py="6px"
fontSize="sm" fontSize="sm"
startElement={ null }
> >
{ alertContent } { alertContent }
</Alert> </Alert>
......
...@@ -9,8 +9,8 @@ import type { ...@@ -9,8 +9,8 @@ import type {
Erc404TotalPayload, Erc404TotalPayload,
} from 'types/api/tokenTransfer'; } from 'types/api/tokenTransfer';
import { Skeleton } from 'toolkit/chakra/skeleton';
import AddressFromTo from 'ui/shared/address/AddressFromTo'; import AddressFromTo from 'ui/shared/address/AddressFromTo';
import Skeleton from 'ui/shared/chakra/Skeleton';
import TokenTransferSnippetFiat from './TokenTransferSnippetFiat'; import TokenTransferSnippetFiat from './TokenTransferSnippetFiat';
import TokenTransferSnippetNft from './TokenTransferSnippetNft'; import TokenTransferSnippetNft from './TokenTransferSnippetNft';
...@@ -26,7 +26,7 @@ const TokenTransferSnippet = ({ data, isLoading, noAddressIcons = true }: Props) ...@@ -26,7 +26,7 @@ const TokenTransferSnippet = ({ data, isLoading, noAddressIcons = true }: Props)
const content = (() => { const content = (() => {
if (isLoading) { if (isLoading) {
return <Skeleton w="250px" h={ 6 }/>; return <Skeleton loading w="250px" h={ 6 }/>;
} }
switch (data.token?.type) { switch (data.token?.type) {
......
...@@ -10,7 +10,7 @@ const MaintenanceAlert = () => { ...@@ -10,7 +10,7 @@ const MaintenanceAlert = () => {
} }
return ( return (
<Alert status="neutral"> <Alert status="neutral" showIcon>
<Box <Box
dangerouslySetInnerHTML={{ __html: config.UI.maintenanceAlert.message }} dangerouslySetInnerHTML={{ __html: config.UI.maintenanceAlert.message }}
css={{ css={{
......
...@@ -6,7 +6,7 @@ import type { WithdrawalsItem } from 'types/api/withdrawals'; ...@@ -6,7 +6,7 @@ import type { WithdrawalsItem } from 'types/api/withdrawals';
import config from 'configs/app'; import config from 'configs/app';
import { currencyUnits } from 'lib/units'; import { currencyUnits } from 'lib/units';
import Skeleton from 'ui/shared/chakra/Skeleton'; import { Skeleton } from 'toolkit/chakra/skeleton';
import CurrencyValue from 'ui/shared/CurrencyValue'; import CurrencyValue from 'ui/shared/CurrencyValue';
import AddressEntity from 'ui/shared/entities/address/AddressEntity'; import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import BlockEntity from 'ui/shared/entities/block/BlockEntity'; import BlockEntity from 'ui/shared/entities/block/BlockEntity';
...@@ -36,12 +36,12 @@ const BeaconChainWithdrawalsListItem = ({ item, isLoading, view }: Props) => { ...@@ -36,12 +36,12 @@ const BeaconChainWithdrawalsListItem = ({ item, isLoading, view }: Props) => {
<ListItemMobileGrid.Label isLoading={ isLoading }>Index</ListItemMobileGrid.Label> <ListItemMobileGrid.Label isLoading={ isLoading }>Index</ListItemMobileGrid.Label>
<ListItemMobileGrid.Value> <ListItemMobileGrid.Value>
<Skeleton isLoaded={ !isLoading } display="inline-block">{ item.index }</Skeleton> <Skeleton loading={ isLoading } display="inline-block">{ item.index }</Skeleton>
</ListItemMobileGrid.Value> </ListItemMobileGrid.Value>
<ListItemMobileGrid.Label isLoading={ isLoading }>Validator index</ListItemMobileGrid.Label> <ListItemMobileGrid.Label isLoading={ isLoading }>Validator index</ListItemMobileGrid.Label>
<ListItemMobileGrid.Value> <ListItemMobileGrid.Value>
<Skeleton isLoaded={ !isLoading } display="inline-block">{ item.validator_index }</Skeleton> <Skeleton loading={ isLoading } display="inline-block">{ item.validator_index }</Skeleton>
</ListItemMobileGrid.Value> </ListItemMobileGrid.Value>
{ view !== 'block' && ( { view !== 'block' && (
......
import { Table, Tbody, Th, Tr } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import type { AddressWithdrawalsItem } from 'types/api/address'; import type { AddressWithdrawalsItem } from 'types/api/address';
...@@ -7,7 +6,7 @@ import type { WithdrawalsItem } from 'types/api/withdrawals'; ...@@ -7,7 +6,7 @@ import type { WithdrawalsItem } from 'types/api/withdrawals';
import config from 'configs/app'; import config from 'configs/app';
import useLazyRenderedList from 'lib/hooks/useLazyRenderedList'; import useLazyRenderedList from 'lib/hooks/useLazyRenderedList';
import { default as Thead } from 'ui/shared/TheadSticky'; import { TableBody, TableColumnHeader, TableHeaderSticky, TableRoot, TableRow } from 'toolkit/chakra/table';
import BeaconChainWithdrawalsTableItem from './BeaconChainWithdrawalsTableItem'; import BeaconChainWithdrawalsTableItem from './BeaconChainWithdrawalsTableItem';
...@@ -35,18 +34,18 @@ const BeaconChainWithdrawalsTable = ({ items, isLoading, top, view }: Props) => ...@@ -35,18 +34,18 @@ const BeaconChainWithdrawalsTable = ({ items, isLoading, top, view }: Props) =>
} }
return ( return (
<Table style={{ tableLayout: 'auto' }} minW="950px"> <TableRoot style={{ tableLayout: 'auto' }} minW="950px">
<Thead top={ top }> <TableHeaderSticky top={ top }>
<Tr> <TableRow>
<Th minW="140px">Index</Th> <TableColumnHeader minW="140px">Index</TableColumnHeader>
<Th minW="200px">Validator index</Th> <TableColumnHeader minW="200px">Validator index</TableColumnHeader>
{ view !== 'block' && <Th w="25%">Block</Th> } { view !== 'block' && <TableColumnHeader w="25%">Block</TableColumnHeader> }
{ view !== 'address' && <Th w="25%">To</Th> } { view !== 'address' && <TableColumnHeader w="25%">To</TableColumnHeader> }
{ view !== 'block' && <Th w="25%">Age</Th> } { view !== 'block' && <TableColumnHeader w="25%">Age</TableColumnHeader> }
<Th w="25%">{ `Value ${ feature.currency.symbol }` }</Th> <TableColumnHeader w="25%">{ `Value ${ feature.currency.symbol }` }</TableColumnHeader>
</Tr> </TableRow>
</Thead> </TableHeaderSticky>
<Tbody> <TableBody>
{ view === 'list' && (items as Array<WithdrawalsItem>).slice(0, renderedItemsNum).map((item, index) => ( { view === 'list' && (items as Array<WithdrawalsItem>).slice(0, renderedItemsNum).map((item, index) => (
<BeaconChainWithdrawalsTableItem key={ item.index + (isLoading ? String(index) : '') } item={ item } view="list" isLoading={ isLoading }/> <BeaconChainWithdrawalsTableItem key={ item.index + (isLoading ? String(index) : '') } item={ item } view="list" isLoading={ isLoading }/>
)) } )) }
...@@ -56,9 +55,9 @@ const BeaconChainWithdrawalsTable = ({ items, isLoading, top, view }: Props) => ...@@ -56,9 +55,9 @@ const BeaconChainWithdrawalsTable = ({ items, isLoading, top, view }: Props) =>
{ view === 'block' && (items as Array<BlockWithdrawalsItem>).slice(0, renderedItemsNum).map((item, index) => ( { view === 'block' && (items as Array<BlockWithdrawalsItem>).slice(0, renderedItemsNum).map((item, index) => (
<BeaconChainWithdrawalsTableItem key={ item.index + (isLoading ? String(index) : '') } item={ item } view="block" isLoading={ isLoading }/> <BeaconChainWithdrawalsTableItem key={ item.index + (isLoading ? String(index) : '') } item={ item } view="block" isLoading={ isLoading }/>
)) } )) }
<tr ref={ cutRef }/> <TableRow ref={ cutRef }/>
</Tbody> </TableBody>
</Table> </TableRoot>
); );
}; };
......
import { Td, Tr } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import type { AddressWithdrawalsItem } from 'types/api/address'; import type { AddressWithdrawalsItem } from 'types/api/address';
import type { BlockWithdrawalsItem } from 'types/api/block'; import type { BlockWithdrawalsItem } from 'types/api/block';
import type { WithdrawalsItem } from 'types/api/withdrawals'; import type { WithdrawalsItem } from 'types/api/withdrawals';
import Skeleton from 'ui/shared/chakra/Skeleton'; import { Skeleton } from 'toolkit/chakra/skeleton';
import { TableCell, TableRow } from 'toolkit/chakra/table';
import CurrencyValue from 'ui/shared/CurrencyValue'; import CurrencyValue from 'ui/shared/CurrencyValue';
import AddressEntity from 'ui/shared/entities/address/AddressEntity'; import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import BlockEntity from 'ui/shared/entities/block/BlockEntity'; import BlockEntity from 'ui/shared/entities/block/BlockEntity';
...@@ -24,15 +24,15 @@ type Props = ({ ...@@ -24,15 +24,15 @@ type Props = ({
const BeaconChainWithdrawalsTableItem = ({ item, view, isLoading }: Props) => { const BeaconChainWithdrawalsTableItem = ({ item, view, isLoading }: Props) => {
return ( return (
<Tr> <TableRow>
<Td verticalAlign="middle"> <TableCell verticalAlign="middle">
<Skeleton isLoaded={ !isLoading } display="inline-block">{ item.index }</Skeleton> <Skeleton loading={ isLoading } display="inline-block">{ item.index }</Skeleton>
</Td> </TableCell>
<Td verticalAlign="middle"> <TableCell verticalAlign="middle">
<Skeleton isLoaded={ !isLoading } display="inline-block">{ item.validator_index }</Skeleton> <Skeleton loading={ isLoading } display="inline-block">{ item.validator_index }</Skeleton>
</Td> </TableCell>
{ view !== 'block' && ( { view !== 'block' && (
<Td verticalAlign="middle"> <TableCell verticalAlign="middle">
<BlockEntity <BlockEntity
number={ item.block_number } number={ item.block_number }
isLoading={ isLoading } isLoading={ isLoading }
...@@ -40,31 +40,31 @@ const BeaconChainWithdrawalsTableItem = ({ item, view, isLoading }: Props) => { ...@@ -40,31 +40,31 @@ const BeaconChainWithdrawalsTableItem = ({ item, view, isLoading }: Props) => {
lineHeight={ 5 } lineHeight={ 5 }
noIcon noIcon
/> />
</Td> </TableCell>
) } ) }
{ view !== 'address' && ( { view !== 'address' && (
<Td verticalAlign="middle"> <TableCell verticalAlign="middle">
<AddressEntity <AddressEntity
address={ item.receiver } address={ item.receiver }
isLoading={ isLoading } isLoading={ isLoading }
truncation="constant" truncation="constant"
/> />
</Td> </TableCell>
) } ) }
{ view !== 'block' && ( { view !== 'block' && (
<Td verticalAlign="middle" pr={ 12 }> <TableCell verticalAlign="middle" pr={ 12 }>
<TimeAgoWithTooltip <TimeAgoWithTooltip
timestamp={ item.timestamp } timestamp={ item.timestamp }
isLoading={ isLoading } isLoading={ isLoading }
color="text_secondary" color="text_secondary"
display="inline-block" display="inline-block"
/> />
</Td> </TableCell>
) } ) }
<Td verticalAlign="middle"> <TableCell verticalAlign="middle">
<CurrencyValue value={ item.amount } isLoading={ isLoading }/> <CurrencyValue value={ item.amount } isLoading={ isLoading }/>
</Td> </TableCell>
</Tr> </TableRow>
); );
}; };
......
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