Commit 6781c5e1 authored by tom's avatar tom

fix after merge

parent b6072dd4
...@@ -21,17 +21,16 @@ export const LinkExternalIcon = ({ color }: { color?: ChakraLinkProps['color'] } ...@@ -21,17 +21,16 @@ export const LinkExternalIcon = ({ color }: { color?: ChakraLinkProps['color'] }
/> />
); );
export interface LinkProps extends ChakraLinkProps { export interface LinkProps extends Pick<NextLinkProps, 'shallow' | 'prefetch' | 'scroll'>, ChakraLinkProps {
loading?: boolean; loading?: boolean;
external?: boolean; external?: boolean;
scroll?: boolean;
iconColor?: ChakraLinkProps['color']; iconColor?: ChakraLinkProps['color'];
noIcon?: boolean; noIcon?: boolean;
} }
export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>( export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
function Link(props, ref) { function Link(props, ref) {
const { external, loading, href, children, scroll = true, iconColor, noIcon, ...rest } = props; const { external, loading, href, children, scroll = true, iconColor, noIcon, shallow, prefetch = false, ...rest } = props;
if (external) { if (external) {
return ( return (
...@@ -54,7 +53,18 @@ export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>( ...@@ -54,7 +53,18 @@ export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
return ( return (
<Skeleton loading={ loading } asChild> <Skeleton loading={ loading } asChild>
<ChakraLink asChild ref={ ref } { ...rest }> <ChakraLink asChild ref={ ref } { ...rest }>
{ href ? <NextLink href={ href as NextLinkProps['href'] } scroll={ scroll }>{ children }</NextLink> : <span>{ children }</span> } { href ? (
<NextLink
href={ href as NextLinkProps['href'] }
scroll={ scroll }
shallow={ shallow }
prefetch={ prefetch }
>
{ children }
</NextLink>
) :
<span>{ children }</span>
}
</ChakraLink> </ChakraLink>
</Skeleton> </Skeleton>
); );
......
...@@ -70,6 +70,11 @@ export const recipe = defineRecipe({ ...@@ -70,6 +70,11 @@ export const recipe = defineRecipe({
color: 'link.navigation.fg.active', color: 'link.navigation.fg.active',
}, },
}, },
plain: {
_hover: {
textDecoration: 'none',
},
},
}, },
}, },
defaultVariants: { defaultVariants: {
......
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import React from 'react'; import React from 'react';
import type { RoutedTab } from 'ui/shared/Tabs/types'; import type { TabItemRegular } from 'toolkit/components/AdaptiveTabs/types';
import config from 'configs/app'; import config from 'configs/app';
import { useAppContext } from 'lib/contexts/app'; import { useAppContext } from 'lib/contexts/app';
...@@ -10,11 +10,11 @@ import getQueryParamString from 'lib/router/getQueryParamString'; ...@@ -10,11 +10,11 @@ import getQueryParamString from 'lib/router/getQueryParamString';
import { publicClient } from 'lib/web3/client'; import { publicClient } from 'lib/web3/client';
import RoutedTabs from 'toolkit/components/RoutedTabs/RoutedTabs'; import RoutedTabs from 'toolkit/components/RoutedTabs/RoutedTabs';
import RoutedTabsSkeleton from 'toolkit/components/RoutedTabs/RoutedTabsSkeleton'; import RoutedTabsSkeleton from 'toolkit/components/RoutedTabs/RoutedTabsSkeleton';
import useActiveTabFromQuery from 'toolkit/components/RoutedTabs/useActiveTabFromQuery';
import TextAd from 'ui/shared/ad/TextAd'; import TextAd from 'ui/shared/ad/TextAd';
import isCustomAppError from 'ui/shared/AppError/isCustomAppError'; import isCustomAppError from 'ui/shared/AppError/isCustomAppError';
import EntityTags from 'ui/shared/EntityTags/EntityTags'; import EntityTags from 'ui/shared/EntityTags/EntityTags';
import PageTitle from 'ui/shared/Page/PageTitle'; import PageTitle from 'ui/shared/Page/PageTitle';
import useTabIndexFromQuery from 'ui/shared/Tabs/useTabIndexFromQuery';
import TxAssetFlows from 'ui/tx/TxAssetFlows'; import TxAssetFlows from 'ui/tx/TxAssetFlows';
import TxAuthorizations from 'ui/tx/TxAuthorizations'; import TxAuthorizations from 'ui/tx/TxAuthorizations';
import TxBlobs from 'ui/tx/TxBlobs'; import TxBlobs from 'ui/tx/TxBlobs';
...@@ -42,7 +42,7 @@ const TransactionPageContent = () => { ...@@ -42,7 +42,7 @@ const TransactionPageContent = () => {
const showDegradedView = publicClient && ((isError && error.status !== 422) || isPlaceholderData) && errorUpdateCount > 0; const showDegradedView = publicClient && ((isError && error.status !== 422) || isPlaceholderData) && errorUpdateCount > 0;
const tabs: Array<RoutedTab> = (() => { const tabs: Array<TabItemRegular> = (() => {
const detailsComponent = showDegradedView ? const detailsComponent = showDegradedView ?
<TxDetailsDegraded hash={ hash } txQuery={ txQuery }/> : <TxDetailsDegraded hash={ hash } txQuery={ txQuery }/> :
<TxDetails txQuery={ txQuery }/>; <TxDetails txQuery={ txQuery }/>;
...@@ -76,7 +76,7 @@ const TransactionPageContent = () => { ...@@ -76,7 +76,7 @@ const TransactionPageContent = () => {
].filter(Boolean); ].filter(Boolean);
})(); })();
const tabIndex = useTabIndexFromQuery(tabs); const activeTab = useActiveTabFromQuery(tabs);
const tags = ( const tags = (
<EntityTags <EntityTags
...@@ -105,7 +105,7 @@ const TransactionPageContent = () => { ...@@ -105,7 +105,7 @@ const TransactionPageContent = () => {
return ( return (
<> <>
<RoutedTabsSkeleton tabs={ tabs } mt={ 6 }/> <RoutedTabsSkeleton tabs={ tabs } mt={ 6 }/>
{ tabs[tabIndex]?.component } { activeTab?.component }
</> </>
); );
} }
......
...@@ -4,6 +4,7 @@ import type { ReactNode } from 'react'; ...@@ -4,6 +4,7 @@ import type { ReactNode } from 'react';
type LinkProps = NextLinkProps & { children?: ReactNode }; type LinkProps = NextLinkProps & { children?: ReactNode };
// TODO @tom2drum remove this file in favor of toolkit/chakra/link
const Link = ({ prefetch = false, children, ...rest }: LinkProps) => { const Link = ({ prefetch = false, children, ...rest }: LinkProps) => {
return ( return (
<NextLink prefetch={ prefetch } { ...rest }> <NextLink prefetch={ prefetch } { ...rest }>
......
...@@ -126,11 +126,11 @@ const SearchBar = ({ isHomepage }: Props) => { ...@@ -126,11 +126,11 @@ const SearchBar = ({ isHomepage }: Props) => {
open={ open && (searchTerm.trim().length > 0 || recentSearchKeywords.length > 0) } open={ open && (searchTerm.trim().length > 0 || recentSearchKeywords.length > 0) }
autoFocus={ false } autoFocus={ false }
onOpenChange={ handleOpenChange } onOpenChange={ handleOpenChange }
positioning={{ offset: isMobile && !isHomepage ? { mainAxis: 46, crossAxis: 12 } : { mainAxis: 8, crossAxis: 0 } }} positioning={{ offset: isMobile && !isHomepage ? { mainAxis: 0, crossAxis: 12 } : { mainAxis: 8, crossAxis: 0 } }}
lazyMount lazyMount
closeOnInteractOutside={ false } closeOnInteractOutside={ false }
> >
<PopoverTrigger asChild={ false } w="100%"> <PopoverTrigger asChild w="100%">
<SearchBarInput <SearchBarInput
ref={ inputRef } ref={ inputRef }
onChange={ handleSearchTermChange } onChange={ handleSearchTermChange }
......
import type { HTMLChakraProps } from '@chakra-ui/react';
import { chakra, Center } from '@chakra-ui/react'; import { chakra, Center } from '@chakra-ui/react';
import { throttle } from 'es-toolkit'; import { throttle } from 'es-toolkit';
import React from 'react'; import React from 'react';
...@@ -9,7 +10,7 @@ import { Input } from 'toolkit/chakra/input'; ...@@ -9,7 +10,7 @@ import { Input } from 'toolkit/chakra/input';
import { InputGroup } from 'toolkit/chakra/input-group'; import { InputGroup } from 'toolkit/chakra/input-group';
import ClearButton from 'ui/shared/ClearButton'; import ClearButton from 'ui/shared/ClearButton';
import IconSvg from 'ui/shared/IconSvg'; import IconSvg from 'ui/shared/IconSvg';
interface Props { interface Props extends Omit<HTMLChakraProps<'form'>, 'onChange'> {
onChange: (value: string) => void; onChange: (value: string) => void;
onSubmit: (event: FormEvent<HTMLFormElement>) => void; onSubmit: (event: FormEvent<HTMLFormElement>) => void;
onBlur?: (event: FocusEvent<HTMLFormElement>) => void; onBlur?: (event: FocusEvent<HTMLFormElement>) => void;
...@@ -22,7 +23,7 @@ interface Props { ...@@ -22,7 +23,7 @@ interface Props {
} }
const SearchBarInput = ( const SearchBarInput = (
{ onChange, onSubmit, isHomepage, isSuggestOpen, onFocus, onBlur, onHide, onClear, value }: Props, { onChange, onSubmit, isHomepage, isSuggestOpen, onFocus, onBlur, onHide, onClear, value, ...rest }: Props,
ref: React.ForwardedRef<HTMLFormElement>, ref: React.ForwardedRef<HTMLFormElement>,
) => { ) => {
const innerRef = React.useRef<HTMLFormElement>(null); const innerRef = React.useRef<HTMLFormElement>(null);
...@@ -151,6 +152,7 @@ const SearchBarInput = ( ...@@ -151,6 +152,7 @@ const SearchBarInput = (
transitionProperty="transform,box-shadow,background-color,color,border-color" transitionProperty="transform,box-shadow,background-color,color,border-color"
transitionDuration="normal" transitionDuration="normal"
transitionTimingFunction="ease" transitionTimingFunction="ease"
{ ...rest }
> >
<InputGroup <InputGroup
startElement={ startElement } startElement={ startElement }
......
import { Box, Text, Tabs } from '@chakra-ui/react'; import { Box, Text } from '@chakra-ui/react';
import type { UseQueryResult } from '@tanstack/react-query'; import type { UseQueryResult } from '@tanstack/react-query';
import { throttle } from 'es-toolkit'; import { throttle } from 'es-toolkit';
import React from 'react'; import React from 'react';
...@@ -10,6 +10,7 @@ import type { ResourceError } from 'lib/api/resources'; ...@@ -10,6 +10,7 @@ import type { ResourceError } from 'lib/api/resources';
import { useSettingsContext } from 'lib/contexts/settings'; import { useSettingsContext } from 'lib/contexts/settings';
import useIsMobile from 'lib/hooks/useIsMobile'; import useIsMobile from 'lib/hooks/useIsMobile';
import * as regexp from 'lib/regexp'; import * as regexp from 'lib/regexp';
import { TabsList, TabsRoot, TabsTrigger } from 'toolkit/chakra/tabs';
import useMarketplaceApps from 'ui/marketplace/useMarketplaceApps'; import useMarketplaceApps from 'ui/marketplace/useMarketplaceApps';
import TextAd from 'ui/shared/ad/TextAd'; import TextAd from 'ui/shared/ad/TextAd';
import ContentLoader from 'ui/shared/ContentLoader'; import ContentLoader from 'ui/shared/ContentLoader';
...@@ -151,23 +152,23 @@ const SearchBarSuggest = ({ query, searchTerm, onItemClick, containerId }: Props ...@@ -151,23 +152,23 @@ const SearchBarSuggest = ({ query, searchTerm, onItemClick, containerId }: Props
<> <>
{ resultCategories.length > 1 && ( { resultCategories.length > 1 && (
<Box position="sticky" top="0" width="100%" background={{ _light: 'white', _dark: 'gray.900' }} py={ 5 } my={ -5 } ref={ tabsRef } zIndex={ 1 }> <Box position="sticky" top="0" width="100%" background={{ _light: 'white', _dark: 'gray.900' }} py={ 5 } my={ -5 } ref={ tabsRef } zIndex={ 1 }>
<Tabs.Root <TabsRoot
variant="secondary" variant="secondary"
size="sm" size="sm"
value={ currentTab } value={ currentTab }
onValueChange={ handleTabsValueChange } onValueChange={ handleTabsValueChange }
> >
<Tabs.List columnGap={ 3 } rowGap={ 2 } flexWrap="wrap"> <TabsList columnGap={ 3 } rowGap={ 2 } flexWrap="wrap">
{ resultCategories.map((cat) => ( { resultCategories.map((cat) => (
<Tabs.Trigger <TabsTrigger
key={ cat.id } key={ cat.id }
value={ cat.id } value={ cat.id }
> >
{ cat.title } { cat.title }
</Tabs.Trigger> </TabsTrigger>
)) } )) }
</Tabs.List> </TabsList>
</Tabs.Root> </TabsRoot>
</Box> </Box>
) } ) }
{ resultCategories.map((cat, index) => { { resultCategories.map((cat, index) => {
......
import { chakra, Box, Text, Flex, Tag, Grid } from '@chakra-ui/react'; import { chakra, Box, Text, Flex, Grid } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import type { ItemsProps } from './types'; import type { ItemsProps } from './types';
...@@ -7,6 +7,7 @@ import type { SearchResultAddressOrContract, SearchResultMetadataTag } from 'typ ...@@ -7,6 +7,7 @@ import type { SearchResultAddressOrContract, SearchResultMetadataTag } from 'typ
import { toBech32Address } from 'lib/address/bech32'; import { toBech32Address } from 'lib/address/bech32';
import dayjs from 'lib/date/dayjs'; import dayjs from 'lib/date/dayjs';
import highlightText from 'lib/highlightText'; import highlightText from 'lib/highlightText';
import { Tag } from 'toolkit/chakra/tag';
import ContractCertifiedLabel from 'ui/shared/ContractCertifiedLabel'; import ContractCertifiedLabel from 'ui/shared/ContractCertifiedLabel';
import * as AddressEntity from 'ui/shared/entities/address/AddressEntity'; import * as AddressEntity from 'ui/shared/entities/address/AddressEntity';
import EntityTagIcon from 'ui/shared/EntityTags/EntityTagIcon'; import EntityTagIcon from 'ui/shared/EntityTags/EntityTagIcon';
......
...@@ -4,14 +4,13 @@ import React from 'react'; ...@@ -4,14 +4,13 @@ import React from 'react';
import type { MarketplaceAppOverview } from 'types/client/marketplace'; import type { MarketplaceAppOverview } from 'types/client/marketplace';
import { route } from 'nextjs-routes';
import highlightText from 'lib/highlightText'; import highlightText from 'lib/highlightText';
import { useColorModeValue } from 'toolkit/chakra/color-mode'; import { useColorModeValue } from 'toolkit/chakra/color-mode';
import { Image } from 'toolkit/chakra/image'; import { Image } from 'toolkit/chakra/image';
import IconSvg from 'ui/shared/IconSvg'; import IconSvg from 'ui/shared/IconSvg';
// TODO @tom2drum: remove NextLink
import NextLink from 'ui/shared/NextLink';
import SearchBarSuggestItemLink from './SearchBarSuggestItemLink'; import SearchBarSuggestItemLink from './SearchBarSuggestItemLink';
interface Props { interface Props {
data: MarketplaceAppOverview; data: MarketplaceAppOverview;
...@@ -98,33 +97,14 @@ const SearchBarSuggestApp = ({ data, isMobile, searchTerm, onClick }: Props) => ...@@ -98,33 +97,14 @@ const SearchBarSuggestApp = ({ data, isMobile, searchTerm, onClick }: Props) =>
); );
})(); })();
if (data.external) {
return (
<NextLink
href={{
pathname: '/apps',
query: {
selectedAppId: data.id,
},
}}
passHref
shallow={ router.pathname === '/apps' }
legacyBehavior
>
<SearchBarSuggestItemLink onClick={ onClick }>
{ content }
</SearchBarSuggestItemLink>
</NextLink>
);
}
return ( return (
<NextLink href={{ pathname: '/apps/[id]', query: { id: data.id } }} passHref legacyBehavior> <SearchBarSuggestItemLink
<SearchBarSuggestItemLink onClick={ onClick }> onClick={ onClick }
{ content } href={ data.external ? route({ pathname: '/apps', query: { selectedAppId: data.id } }) : route({ pathname: '/apps/[id]', query: { id: data.id } }) }
</SearchBarSuggestItemLink> shallow={ data.external && router.pathname === '/apps' }
</NextLink> >
{ content }
</SearchBarSuggestItemLink>
); );
}; };
......
import type { LinkProps as NextLinkProps } from 'next/link';
import React from 'react'; import React from 'react';
import type { SearchResultItem } from 'types/client/search'; import type { SearchResultItem } from 'types/client/search';
...@@ -6,8 +5,6 @@ import type { AddressFormat } from 'types/views/address'; ...@@ -6,8 +5,6 @@ import type { AddressFormat } from 'types/views/address';
import { route } from 'nextjs-routes'; import { route } from 'nextjs-routes';
import NextLink from 'ui/shared/NextLink';
import SearchBarSuggestAddress from './SearchBarSuggestAddress'; import SearchBarSuggestAddress from './SearchBarSuggestAddress';
import SearchBarSuggestBlob from './SearchBarSuggestBlob'; import SearchBarSuggestBlob from './SearchBarSuggestBlob';
import SearchBarSuggestBlock from './SearchBarSuggestBlock'; import SearchBarSuggestBlock from './SearchBarSuggestBlock';
...@@ -115,11 +112,9 @@ const SearchBarSuggestItem = ({ data, isMobile, searchTerm, onClick, addressForm ...@@ -115,11 +112,9 @@ const SearchBarSuggestItem = ({ data, isMobile, searchTerm, onClick, addressForm
})(); })();
return ( return (
<NextLink href={ url as NextLinkProps['href'] } passHref legacyBehavior> <SearchBarSuggestItemLink onClick={ onClick } href={ url }>
<SearchBarSuggestItemLink onClick={ onClick }> { content }
{ content } </SearchBarSuggestItemLink>
</SearchBarSuggestItemLink>
</NextLink>
); );
}; };
......
import { chakra } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
type Props = { import type { LinkProps } from 'toolkit/chakra/link';
onClick: (event: React.MouseEvent<HTMLAnchorElement>) => void; import { Link } from 'toolkit/chakra/link';
href?: string;
target?: string;
children: React.ReactNode;
};
const SearchBarSuggestItemLink = React.forwardRef<HTMLAnchorElement, Props>(({ onClick, href, target, children }, ref) => { interface Props extends LinkProps {};
const SearchBarSuggestItemLink = React.forwardRef<HTMLAnchorElement, Props>(({ children, ...rest }, ref) => {
return ( return (
<chakra.a <Link
ref={ ref } ref={ ref }
py={ 3 } py={ 3 }
px={ 1 } px={ 1 }
display="flex" display="flex"
flexDir="column" flexDir="column"
alignItems="stretch"
variant="plain"
rowGap={ 2 } rowGap={ 2 }
borderColor="border.divider" borderColor="border.divider"
borderBottomWidth="1px" borderBottomWidth="1px"
...@@ -29,12 +28,10 @@ const SearchBarSuggestItemLink = React.forwardRef<HTMLAnchorElement, Props>(({ o ...@@ -29,12 +28,10 @@ const SearchBarSuggestItemLink = React.forwardRef<HTMLAnchorElement, Props>(({ o
_first={{ _first={{
mt: 2, mt: 2,
}} }}
onClick={ onClick } { ...rest }
href={ href }
target={ target }
> >
{ children } { children }
</chakra.a> </Link>
); );
}); });
......
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';
...@@ -21,22 +21,23 @@ const TxAuthorizations = ({ txQuery }: Props) => { ...@@ -21,22 +21,23 @@ const TxAuthorizations = ({ txQuery }: Props) => {
const content = ( const content = (
<> <>
<Show below="lg" ssr={ false }> <Box hideFrom="lg">
<TxAuthorizationsList data={ txQuery.data?.authorization_list } isLoading={ txQuery.isPlaceholderData }/> <TxAuthorizationsList data={ txQuery.data?.authorization_list } isLoading={ txQuery.isPlaceholderData }/>
</Show> </Box>
<Hide below="lg" ssr={ false }> <Box hideBelow="lg">
<TxAuthorizationsTable data={ txQuery.data?.authorization_list } isLoading={ txQuery.isPlaceholderData }/> <TxAuthorizationsTable data={ txQuery.data?.authorization_list } isLoading={ txQuery.isPlaceholderData }/>
</Hide> </Box>
</> </>
); );
return ( return (
<DataListDisplay <DataListDisplay
isError={ txQuery.isError } isError={ txQuery.isError }
items={ txQuery.data?.authorization_list } itemsNum={ txQuery.data?.authorization_list?.length }
emptyText="There are no authorizations for this transaction." emptyText="There are no authorizations for this transaction."
content={ content } >
/> { content }
</DataListDisplay>
); );
}; };
......
...@@ -4,7 +4,7 @@ import React from 'react'; ...@@ -4,7 +4,7 @@ import React from 'react';
import type { TxAuthorization } from 'types/api/transaction'; import type { TxAuthorization } from 'types/api/transaction';
import config from 'configs/app'; import config from 'configs/app';
import Skeleton from 'ui/shared/chakra/Skeleton'; import { Skeleton } from 'toolkit/chakra/skeleton';
import AddressEntity from 'ui/shared/entities/address/AddressEntity'; import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import ListItemMobile from 'ui/shared/ListItemMobile/ListItemMobile'; import ListItemMobile from 'ui/shared/ListItemMobile/ListItemMobile';
...@@ -15,21 +15,21 @@ interface Props extends TxAuthorization { ...@@ -15,21 +15,21 @@ interface Props extends TxAuthorization {
const TxAuthorizationsListItem = ({ address, authority, chain_id: chainId, nonce, isLoading }: Props) => { const TxAuthorizationsListItem = ({ address, authority, chain_id: chainId, nonce, isLoading }: Props) => {
return ( return (
<ListItemMobile rowGap={ 3 } fontSize="sm"> <ListItemMobile rowGap={ 3 } fontSize="sm">
<HStack spacing={ 3 } w="100%"> <HStack gap={ 3 } w="100%">
<Skeleton isLoaded={ !isLoading } fontWeight={ 500 }>Address</Skeleton> <Skeleton loading={ isLoading } fontWeight={ 500 }>Address</Skeleton>
<AddressEntity address={{ hash: address }} isLoading={ isLoading } noIcon/> <AddressEntity address={{ hash: address }} isLoading={ isLoading } noIcon/>
</HStack> </HStack>
<HStack spacing={ 3 } w="100%"> <HStack gap={ 3 } w="100%">
<Skeleton isLoaded={ !isLoading } fontWeight={ 500 }>Authority</Skeleton> <Skeleton loading={ isLoading } fontWeight={ 500 }>Authority</Skeleton>
<AddressEntity address={{ hash: authority }} isLoading={ isLoading } noIcon/> <AddressEntity address={{ hash: authority }} isLoading={ isLoading } noIcon/>
</HStack> </HStack>
<HStack spacing={ 3 }> <HStack gap={ 3 }>
<Skeleton isLoaded={ !isLoading } fontWeight={ 500 }>Chain</Skeleton> <Skeleton loading={ isLoading } fontWeight={ 500 }>Chain</Skeleton>
<Skeleton isLoaded={ !isLoading } color="text_secondary">{ chainId === Number(config.chain.id) ? 'this' : 'any' }</Skeleton> <Skeleton loading={ isLoading } color="text_secondary">{ chainId === Number(config.chain.id) ? 'this' : 'any' }</Skeleton>
</HStack> </HStack>
<HStack spacing={ 3 }> <HStack gap={ 3 }>
<Skeleton isLoaded={ !isLoading } fontWeight={ 500 }>Nonce</Skeleton> <Skeleton loading={ isLoading } fontWeight={ 500 }>Nonce</Skeleton>
<Skeleton isLoaded={ !isLoading } color="text_secondary">{ nonce }</Skeleton> <Skeleton loading={ isLoading } color="text_secondary">{ nonce }</Skeleton>
</HStack> </HStack>
</ListItemMobile> </ListItemMobile>
); );
......
import { Table, Tbody, Tr, Th } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import type { TxAuthorization } from 'types/api/transaction'; import type { TxAuthorization } from 'types/api/transaction';
import { AddressHighlightProvider } from 'lib/contexts/addressHighlight'; import { AddressHighlightProvider } from 'lib/contexts/addressHighlight';
import { default as Thead } from 'ui/shared/TheadSticky'; import { TableBody, TableColumnHeader, TableHeaderSticky, TableRoot, TableRow } from 'toolkit/chakra/table';
import TxAuthorizationsTableItem from './TxAuthorizationsTableItem'; import TxAuthorizationsTableItem from './TxAuthorizationsTableItem';
...@@ -16,21 +15,21 @@ interface Props { ...@@ -16,21 +15,21 @@ interface Props {
const TxAuthorizationsTable = ({ data, isLoading }: Props) => { const TxAuthorizationsTable = ({ data, isLoading }: Props) => {
return ( return (
<AddressHighlightProvider> <AddressHighlightProvider>
<Table> <TableRoot>
<Thead> <TableHeaderSticky>
<Tr> <TableRow>
<Th width="50%">Address</Th> <TableColumnHeader width="50%">Address</TableColumnHeader>
<Th width="50%">Authority</Th> <TableColumnHeader width="50%">Authority</TableColumnHeader>
<Th width="120px">Chain</Th> <TableColumnHeader width="120px">Chain</TableColumnHeader>
<Th width="120px" isNumeric>Nonce</Th> <TableColumnHeader width="120px" isNumeric>Nonce</TableColumnHeader>
</Tr> </TableRow>
</Thead> </TableHeaderSticky>
<Tbody> <TableBody>
{ data?.map((item, index) => ( { data?.map((item, index) => (
<TxAuthorizationsTableItem key={ item.nonce.toString() + (isLoading ? index : '') } { ...item } isLoading={ isLoading }/> <TxAuthorizationsTableItem key={ item.nonce.toString() + (isLoading ? index : '') } { ...item } isLoading={ isLoading }/>
)) } )) }
</Tbody> </TableBody>
</Table> </TableRoot>
</AddressHighlightProvider> </AddressHighlightProvider>
); );
}; };
......
import { Tr, Td } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import type { TxAuthorization } from 'types/api/transaction'; import type { TxAuthorization } from 'types/api/transaction';
import config from 'configs/app'; import config from 'configs/app';
import Skeleton from 'ui/shared/chakra/Skeleton'; import { Skeleton } from 'toolkit/chakra/skeleton';
import { TableRow, TableCell } from 'toolkit/chakra/table';
import AddressEntity from 'ui/shared/entities/address/AddressEntity'; import AddressEntity from 'ui/shared/entities/address/AddressEntity';
interface Props extends TxAuthorization { interface Props extends TxAuthorization {
...@@ -13,24 +13,24 @@ interface Props extends TxAuthorization { ...@@ -13,24 +13,24 @@ interface Props extends TxAuthorization {
const TxAuthorizationsItem = ({ address, authority, chain_id: chainId, nonce, isLoading }: Props) => { const TxAuthorizationsItem = ({ address, authority, chain_id: chainId, nonce, isLoading }: Props) => {
return ( return (
<Tr alignItems="top"> <TableRow alignItems="top">
<Td> <TableCell>
<AddressEntity address={{ hash: address }} isLoading={ isLoading } noIcon/> <AddressEntity address={{ hash: address }} isLoading={ isLoading } noIcon/>
</Td> </TableCell>
<Td verticalAlign="middle"> <TableCell verticalAlign="middle">
<AddressEntity address={{ hash: authority }} isLoading={ isLoading } noIcon/> <AddressEntity address={{ hash: authority }} isLoading={ isLoading } noIcon/>
</Td> </TableCell>
<Td verticalAlign="middle"> <TableCell verticalAlign="middle">
<Skeleton isLoaded={ !isLoading } display="inline-block"> <Skeleton loading={ isLoading } display="inline-block">
{ chainId === Number(config.chain.id) ? 'this' : 'any' } { chainId === Number(config.chain.id) ? 'this' : 'any' }
</Skeleton> </Skeleton>
</Td> </TableCell>
<Td isNumeric verticalAlign="middle"> <TableCell isNumeric verticalAlign="middle">
<Skeleton isLoaded={ !isLoading } display="inline-block"> <Skeleton loading={ isLoading } display="inline-block">
{ nonce } { nonce }
</Skeleton> </Skeleton>
</Td> </TableCell>
</Tr> </TableRow>
); );
}; };
......
...@@ -5,9 +5,9 @@ import type { ArbitrumTransactionMessageStatus, Transaction } from 'types/api/tr ...@@ -5,9 +5,9 @@ import type { ArbitrumTransactionMessageStatus, Transaction } from 'types/api/tr
import { route } from 'nextjs-routes'; import { route } from 'nextjs-routes';
import * as DetailsInfoItem from 'ui/shared/DetailsInfoItem'; import { Link } from 'toolkit/chakra/link';
import * as DetailedInfo from 'ui/shared/DetailedInfo/DetailedInfo';
import TxEntityL1 from 'ui/shared/entities/tx/TxEntityL1'; import TxEntityL1 from 'ui/shared/entities/tx/TxEntityL1';
import LinkInternal from 'ui/shared/links/LinkInternal';
import VerificationSteps from 'ui/shared/verificationSteps/VerificationSteps'; import VerificationSteps from 'ui/shared/verificationSteps/VerificationSteps';
const WITHDRAWAL_STATUS_STEPS: Array<ArbitrumTransactionMessageStatus> = [ const WITHDRAWAL_STATUS_STEPS: Array<ArbitrumTransactionMessageStatus> = [
...@@ -41,11 +41,11 @@ const TxDetailsWithdrawalStatusArbitrum = ({ data }: Props) => { ...@@ -41,11 +41,11 @@ const TxDetailsWithdrawalStatusArbitrum = ({ data }: Props) => {
return { return {
content: ( content: (
<LinkInternal <Link
href={ route({ pathname: '/txn-withdrawals', query: { q: data.hash } }) } href={ route({ pathname: '/txn-withdrawals', query: { q: data.hash } }) }
> >
{ step } { step }
</LinkInternal> </Link>
), ),
label: step, label: step,
}; };
...@@ -64,35 +64,35 @@ const TxDetailsWithdrawalStatusArbitrum = ({ data }: Props) => { ...@@ -64,35 +64,35 @@ const TxDetailsWithdrawalStatusArbitrum = ({ data }: Props) => {
if (data.arbitrum.contains_message === 'outcoming') { if (data.arbitrum.contains_message === 'outcoming') {
return ( return (
<> <>
<DetailsInfoItem.Label <DetailedInfo.ItemLabel
hint="Detailed status progress of the transaction" hint="Detailed status progress of the transaction"
> >
Withdrawal status Withdrawal status
</DetailsInfoItem.Label> </DetailedInfo.ItemLabel>
<DetailsInfoItem.Value> <DetailedInfo.ItemValue>
{ data.arbitrum.message_related_info.message_status ? ( { data.arbitrum.message_related_info.message_status ? (
<VerificationSteps <VerificationSteps
steps={ steps as unknown as Array<ArbitrumTransactionMessageStatus> } steps={ steps as unknown as Array<ArbitrumTransactionMessageStatus> }
currentStep={ data.arbitrum.message_related_info.message_status } currentStep={ data.arbitrum.message_related_info.message_status }
/> />
) : <Text variant="secondary">Could not determine</Text> } ) : <Text color="text.secondary">Could not determine</Text> }
</DetailsInfoItem.Value> </DetailedInfo.ItemValue>
</> </>
); );
} }
return ( return (
<> <>
<DetailsInfoItem.Label <DetailedInfo.ItemLabel
hint="The hash of the transaction that originated the message from the base layer" hint="The hash of the transaction that originated the message from the base layer"
> >
Originating L1 txn hash Originating L1 txn hash
</DetailsInfoItem.Label> </DetailedInfo.ItemLabel>
<DetailsInfoItem.Value> <DetailedInfo.ItemValue>
{ data.arbitrum.message_related_info.associated_l1_transaction ? { data.arbitrum.message_related_info.associated_l1_transaction ?
<TxEntityL1 hash={ data.arbitrum.message_related_info.associated_l1_transaction }/> : <TxEntityL1 hash={ data.arbitrum.message_related_info.associated_l1_transaction }/> :
<Text variant="secondary">Waiting for confirmation</Text> <Text color="text.secondary">Waiting for confirmation</Text>
} }
</DetailsInfoItem.Value> </DetailedInfo.ItemValue>
</> </>
); );
}; };
......
...@@ -5,7 +5,6 @@ import { ...@@ -5,7 +5,6 @@ import {
Spinner, Spinner,
Flex, Flex,
chakra, chakra,
HStack,
} from '@chakra-ui/react'; } from '@chakra-ui/react';
import BigNumber from 'bignumber.js'; import BigNumber from 'bignumber.js';
import React from 'react'; import React from 'react';
...@@ -90,6 +89,10 @@ const TxInfo = ({ data, isLoading, socketStatus }: Props) => { ...@@ -90,6 +89,10 @@ const TxInfo = ({ data, isLoading, socketStatus }: Props) => {
}, },
}); });
const handleCutLinkClick = React.useCallback(() => {
setIsExpanded((flag) => !flag);
}, []);
const showAssociatedL1Tx = React.useCallback(() => { const showAssociatedL1Tx = React.useCallback(() => {
setIsExpanded(true); setIsExpanded(true);
}, []); }, []);
...@@ -803,28 +806,7 @@ const TxInfo = ({ data, isLoading, socketStatus }: Props) => { ...@@ -803,28 +806,7 @@ const TxInfo = ({ data, isLoading, socketStatus }: Props) => {
<CutLinkDetails loading={ isLoading } mt={ 6 } gridColumn={{ base: undefined, lg: '1 / 3' }} isExpanded={ isExpanded } onClick={ handleCutLinkClick }> <CutLinkDetails loading={ isLoading } mt={ 6 } gridColumn={{ base: undefined, lg: '1 / 3' }} isExpanded={ isExpanded } onClick={ handleCutLinkClick }>
<GridItem colSpan={{ base: undefined, lg: 2 }} mt={{ base: 1, lg: 4 }}/> <GridItem colSpan={{ base: undefined, lg: 2 }} mt={{ base: 1, lg: 4 }}/>
{ data.arbitrum?.contains_message && data.arbitrum?.message_related_info && ( <TxDetailsWithdrawalStatusArbitrum data={ data }/>
<>
<DetailedInfo.ItemLabel
hint={ data.arbitrum.contains_message === 'incoming' ?
'The hash of the transaction that originated the message from the base layer' :
'The hash of the transaction that completed the message on the base layer'
}
>
{ data.arbitrum.contains_message === 'incoming' ? 'Originating L1 txn hash' : 'Completion L1 txn hash' }
</DetailedInfo.ItemLabel>
<DetailedInfo.ItemValue>
{ data.arbitrum.message_related_info.associated_l1_transaction ?
<TxEntityL1 hash={ data.arbitrum.message_related_info.associated_l1_transaction }/> : (
<HStack gap={ 2 }>
<Text color="text_secondary">{ data.arbitrum.message_related_info.message_status }</Text>
<Hint label={ MESSAGE_DESCRIPTIONS[data.arbitrum.message_related_info.message_status] }/>
</HStack>
)
}
</DetailedInfo.ItemValue>
</>
) }
{ (data.blob_gas_used || data.max_fee_per_blob_gas || data.blob_gas_price) && ( { (data.blob_gas_used || data.max_fee_per_blob_gas || data.blob_gas_price) && (
<> <>
...@@ -860,8 +842,6 @@ const TxInfo = ({ data, isLoading, socketStatus }: Props) => { ...@@ -860,8 +842,6 @@ const TxInfo = ({ data, isLoading, socketStatus }: Props) => {
</> </>
) } ) }
<TxDetailsWithdrawalStatusArbitrum data={ data }/>
{ (data.max_fee_per_blob_gas || data.blob_gas_price) && ( { (data.max_fee_per_blob_gas || data.blob_gas_price) && (
<> <>
<DetailedInfo.ItemLabel <DetailedInfo.ItemLabel
......
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