Commit 663b9aae authored by tom's avatar tom

tags on token page and action menu on address page

parent ec4fe4e0
...@@ -170,6 +170,16 @@ const TokenPageContent = () => { ...@@ -170,6 +170,16 @@ const TokenPageContent = () => {
}; };
}, [ appProps.referrer ]); }, [ appProps.referrer ]);
const tags = [
{ label: tokenQuery.data?.type, display_name: tokenQuery.data?.type },
...(contractQuery.data?.private_tags || []),
...(contractQuery.data?.public_tags || []),
...(contractQuery.data?.watchlist_names || []),
]
.filter(Boolean)
.map((tag) => <Tag key={ tag.label }>{ tag.display_name }</Tag>);
const tagsNode = tags.length > 0 ? <Flex columnGap={ 2 }>{ tags }</Flex> : null;
return ( return (
<Page> <Page>
{ tokenQuery.isLoading ? ( { tokenQuery.isLoading ? (
...@@ -189,7 +199,7 @@ const TokenPageContent = () => { ...@@ -189,7 +199,7 @@ const TokenPageContent = () => {
additionalsLeft={ ( additionalsLeft={ (
<TokenLogo hash={ tokenQuery.data?.address } name={ tokenQuery.data?.name } boxSize={ 6 }/> <TokenLogo hash={ tokenQuery.data?.address } name={ tokenQuery.data?.name } boxSize={ 6 }/>
) } ) }
additionalsRight={ <Tag>{ tokenQuery.data?.type }</Tag> } additionalsRight={ tagsNode }
/> />
</> </>
) } ) }
......
...@@ -14,6 +14,7 @@ const AddressActions = () => { ...@@ -14,6 +14,7 @@ const AddressActions = () => {
const router = useRouter(); const router = useRouter();
const hash = getQueryParamString(router.query.hash); const hash = getQueryParamString(router.query.hash);
const isTokenPage = router.pathname === '/token/[hash]';
return ( return (
<Menu> <Menu>
...@@ -29,7 +30,7 @@ const AddressActions = () => { ...@@ -29,7 +30,7 @@ const AddressActions = () => {
</Flex> </Flex>
</MenuButton> </MenuButton>
<MenuList minWidth="180px" zIndex="popover"> <MenuList minWidth="180px" zIndex="popover">
{ 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 }/> }
<PublicTagMenuItem py={ 2 } px={ 4 } hash={ hash }/> <PublicTagMenuItem py={ 2 } px={ 4 } hash={ hash }/>
<PrivateTagMenuItem py={ 2 } px={ 4 } hash={ hash }/> <PrivateTagMenuItem py={ 2 } px={ 4 } hash={ hash }/>
</MenuList> </MenuList>
......
...@@ -11,16 +11,16 @@ import AddressFavoriteButton from 'ui/address/details/AddressFavoriteButton'; ...@@ -11,16 +11,16 @@ import AddressFavoriteButton from 'ui/address/details/AddressFavoriteButton';
import AddressQrCode from 'ui/address/details/AddressQrCode'; import AddressQrCode from 'ui/address/details/AddressQrCode';
import AddressIcon from 'ui/shared/address/AddressIcon'; import AddressIcon from 'ui/shared/address/AddressIcon';
import AddressLink from 'ui/shared/address/AddressLink'; import AddressLink from 'ui/shared/address/AddressLink';
import AddressActionsMenu from 'ui/shared/AddressActions/Menu';
import CopyToClipboard from 'ui/shared/CopyToClipboard'; import CopyToClipboard from 'ui/shared/CopyToClipboard';
interface Props { interface Props {
address: Pick<AddressParam, 'hash' | 'is_contract' | 'implementation_name' | 'watchlist_names'>; address: Pick<AddressParam, 'hash' | 'is_contract' | 'implementation_name' | 'watchlist_names'>;
token?: TokenInfo | null; token?: TokenInfo | null;
isLinkDisabled?: boolean; isLinkDisabled?: boolean;
after?: React.ReactNode;
} }
const AddressHeadingInfo = ({ address, token, isLinkDisabled, after }: Props) => { const AddressHeadingInfo = ({ address, token, isLinkDisabled }: Props) => {
const isMobile = useIsMobile(); const isMobile = useIsMobile();
return ( return (
...@@ -41,7 +41,7 @@ const AddressHeadingInfo = ({ address, token, isLinkDisabled, after }: Props) => ...@@ -41,7 +41,7 @@ const AddressHeadingInfo = ({ address, token, isLinkDisabled, after }: Props) =>
<AddressFavoriteButton hash={ address.hash } isAdded={ Boolean(address.watchlist_names?.length) } ml={ 3 }/> <AddressFavoriteButton hash={ address.hash } isAdded={ Boolean(address.watchlist_names?.length) } ml={ 3 }/>
) } ) }
<AddressQrCode hash={ address.hash } ml={ 2 }/> <AddressQrCode hash={ address.hash } ml={ 2 }/>
{ after } { appConfig.isAccountSupported && <AddressActionsMenu/> }
</Flex> </Flex>
); );
}; };
......
...@@ -5,9 +5,7 @@ import React from 'react'; ...@@ -5,9 +5,7 @@ import React from 'react';
import type { TokenInfo } from 'types/api/token'; import type { TokenInfo } from 'types/api/token';
import appConfig from 'configs/app/config';
import useApiQuery from 'lib/api/useApiQuery'; import useApiQuery from 'lib/api/useApiQuery';
import AddressActionsMenu from 'ui/shared/AddressActions/Menu';
import AddressHeadingInfo from 'ui/shared/AddressHeadingInfo'; import AddressHeadingInfo from 'ui/shared/AddressHeadingInfo';
interface Props { interface Props {
...@@ -50,7 +48,6 @@ const TokenContractInfo = ({ tokenQuery }: Props) => { ...@@ -50,7 +48,6 @@ const TokenContractInfo = ({ tokenQuery }: Props) => {
<AddressHeadingInfo <AddressHeadingInfo
address={ address } address={ address }
token={ contractQuery.data?.token } token={ contractQuery.data?.token }
after={ appConfig.isAccountSupported ? <AddressActionsMenu/> : null }
/> />
); );
}; };
......
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