Commit 5a258ab0 authored by tom's avatar tom

add loading state to account menu

parent 18fe01d3
...@@ -234,7 +234,7 @@ const TokenPageContent = () => { ...@@ -234,7 +234,7 @@ const TokenPageContent = () => {
...(contractQuery.data?.watchlist_names || []), ...(contractQuery.data?.watchlist_names || []),
] ]
.filter(Boolean) .filter(Boolean)
.map((tag) => <Tag key={ tag.label }>{ tag.display_name }</Tag>); .map((tag) => <Tag key={ tag.label } isLoading={ tokenQuery.isPlaceholderData }>{ tag.display_name }</Tag>);
const tagsNode = tags.length > 0 ? <Flex columnGap={ 2 }>{ tags }</Flex> : null; const tagsNode = tags.length > 0 ? <Flex columnGap={ 2 }>{ tags }</Flex> : null;
return ( return (
......
import { Button, Menu, MenuButton, MenuList, Icon, Flex } from '@chakra-ui/react'; import { Button, Menu, MenuButton, MenuList, Icon, Flex, Skeleton } from '@chakra-ui/react';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import React from 'react'; import React from 'react';
...@@ -10,7 +10,11 @@ import PrivateTagMenuItem from './PrivateTagMenuItem'; ...@@ -10,7 +10,11 @@ import PrivateTagMenuItem from './PrivateTagMenuItem';
import PublicTagMenuItem from './PublicTagMenuItem'; import PublicTagMenuItem from './PublicTagMenuItem';
import TokenInfoMenuItem from './TokenInfoMenuItem'; import TokenInfoMenuItem from './TokenInfoMenuItem';
const AddressActions = () => { interface Props {
isLoading?: boolean;
}
const AddressActions = ({ isLoading }: Props) => {
const router = useRouter(); const router = useRouter();
const hash = getQueryParamString(router.query.hash); const hash = getQueryParamString(router.query.hash);
...@@ -18,17 +22,18 @@ const AddressActions = () => { ...@@ -18,17 +22,18 @@ const AddressActions = () => {
return ( return (
<Menu> <Menu>
<MenuButton <Skeleton isLoaded={ !isLoading } ml={ 2 }>
as={ Button } <MenuButton
size="sm" as={ Button }
variant="outline" size="sm"
ml={ 2 } variant="outline"
> >
<Flex alignItems="center"> <Flex alignItems="center">
<span>More</span> <span>More</span>
<Icon as={ iconArrow } transform="rotate(-90deg)" boxSize={ 5 } ml={ 1 }/> <Icon as={ iconArrow } transform="rotate(-90deg)" boxSize={ 5 } ml={ 1 }/>
</Flex> </Flex>
</MenuButton> </MenuButton>
</Skeleton>
<MenuList minWidth="180px" zIndex="popover"> <MenuList minWidth="180px" zIndex="popover">
{ isTokenPage && appConfig.contractInfoApi.endpoint && appConfig.adminServiceApi.endpoint && <TokenInfoMenuItem py={ 2 } px={ 4 } hash={ hash }/> } { isTokenPage && appConfig.contractInfoApi.endpoint && appConfig.adminServiceApi.endpoint && <TokenInfoMenuItem py={ 2 } px={ 4 } hash={ hash }/> }
<PrivateTagMenuItem py={ 2 } px={ 4 } hash={ hash }/> <PrivateTagMenuItem py={ 2 } px={ 4 } hash={ hash }/>
......
...@@ -43,7 +43,7 @@ const AddressHeadingInfo = ({ address, token, isLinkDisabled, isLoading }: Props ...@@ -43,7 +43,7 @@ const AddressHeadingInfo = ({ address, token, isLinkDisabled, isLoading }: Props
<AddressFavoriteButton hash={ address.hash } watchListId={ address.watchlist_address_id } ml={ 3 }/> <AddressFavoriteButton hash={ address.hash } watchListId={ address.watchlist_address_id } ml={ 3 }/>
) } ) }
<AddressQrCode hash={ address.hash } ml={ 2 } isLoading={ isLoading }/> <AddressQrCode hash={ address.hash } ml={ 2 } isLoading={ isLoading }/>
{ appConfig.isAccountSupported && <AddressActionsMenu/> } { appConfig.isAccountSupported && <AddressActionsMenu isLoading={ isLoading }/> }
</Flex> </Flex>
); );
}; };
......
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