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 = () => {
};
}, [ 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 (
<Page>
{ tokenQuery.isLoading ? (
......@@ -189,7 +199,7 @@ const TokenPageContent = () => {
additionalsLeft={ (
<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 = () => {
const router = useRouter();
const hash = getQueryParamString(router.query.hash);
const isTokenPage = router.pathname === '/token/[hash]';
return (
<Menu>
......@@ -29,7 +30,7 @@ const AddressActions = () => {
</Flex>
</MenuButton>
<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 }/>
<PrivateTagMenuItem py={ 2 } px={ 4 } hash={ hash }/>
</MenuList>
......
......@@ -11,16 +11,16 @@ import AddressFavoriteButton from 'ui/address/details/AddressFavoriteButton';
import AddressQrCode from 'ui/address/details/AddressQrCode';
import AddressIcon from 'ui/shared/address/AddressIcon';
import AddressLink from 'ui/shared/address/AddressLink';
import AddressActionsMenu from 'ui/shared/AddressActions/Menu';
import CopyToClipboard from 'ui/shared/CopyToClipboard';
interface Props {
address: Pick<AddressParam, 'hash' | 'is_contract' | 'implementation_name' | 'watchlist_names'>;
token?: TokenInfo | null;
isLinkDisabled?: boolean;
after?: React.ReactNode;
}
const AddressHeadingInfo = ({ address, token, isLinkDisabled, after }: Props) => {
const AddressHeadingInfo = ({ address, token, isLinkDisabled }: Props) => {
const isMobile = useIsMobile();
return (
......@@ -41,7 +41,7 @@ const AddressHeadingInfo = ({ address, token, isLinkDisabled, after }: Props) =>
<AddressFavoriteButton hash={ address.hash } isAdded={ Boolean(address.watchlist_names?.length) } ml={ 3 }/>
) }
<AddressQrCode hash={ address.hash } ml={ 2 }/>
{ after }
{ appConfig.isAccountSupported && <AddressActionsMenu/> }
</Flex>
);
};
......
......@@ -5,9 +5,7 @@ import React from 'react';
import type { TokenInfo } from 'types/api/token';
import appConfig from 'configs/app/config';
import useApiQuery from 'lib/api/useApiQuery';
import AddressActionsMenu from 'ui/shared/AddressActions/Menu';
import AddressHeadingInfo from 'ui/shared/AddressHeadingInfo';
interface Props {
......@@ -50,7 +48,6 @@ const TokenContractInfo = ({ tokenQuery }: Props) => {
<AddressHeadingInfo
address={ address }
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