Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/home/LatestTxsItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const LatestTxsItem = ({ tx, isLoading }: Props) => {
<TxType types={ tx.transaction_types } isLoading={ isLoading }/>
<TxStatus status={ tx.status } errorText={ tx.status === 'error' ? tx.result : undefined } isLoading={ isLoading }/>
<TxWatchListTags tx={ tx } isLoading={ isLoading }/>
{ protocolTag && <EntityTag data={ protocolTag } isLoading={ isLoading } minW="0"/> }
{ protocolTag && <EntityTag data={ protocolTag } isLoading={ isLoading } minW="0" noColors/> }
</HStack>
<Flex
alignItems="center"
Expand Down
2 changes: 1 addition & 1 deletion ui/home/LatestTxsItemMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const LatestTxsItem = ({ tx, isLoading }: Props) => {
<TxType types={ tx.transaction_types } isLoading={ isLoading }/>
<TxStatus status={ tx.status } errorText={ tx.status === 'error' ? tx.result : undefined } isLoading={ isLoading }/>
<TxWatchListTags tx={ tx } isLoading={ isLoading }/>
{ protocolTag && <EntityTag data={ protocolTag } isLoading={ isLoading } minW="0"/> }
{ protocolTag && <EntityTag data={ protocolTag } isLoading={ isLoading } minW="0" noColors/> }
</HStack>
<TxAdditionalInfo tx={ tx } isMobile isLoading={ isLoading }/>
</Flex>
Expand Down
1 change: 1 addition & 0 deletions ui/hotContracts/HotContractsListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const HotContractsListItem = ({ data, isLoading, exchangeRate }: Props) => {
<EntityTags
isLoading={ isLoading }
tags={ protocolTags }
noColors
/>
) }
<HStack>
Expand Down
1 change: 1 addition & 0 deletions ui/hotContracts/HotContractsTableItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const HotContractsTableItem = ({
isLoading={ isLoading }
tags={ protocolTags }
mt="10px"
noColors
/>
) }
</TableCell>
Expand Down
2 changes: 1 addition & 1 deletion ui/searchResults/SearchResultEntityTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const SearchResultEntityTag = ({ metadata, searchTerm, addressHash, ...rest }: P
return (
<Tag
{ ...rest }
startElement={ <EntityTagIcon data={ metadata } ignoreColor/> }
startElement={ <EntityTagIcon data={ metadata } noColors/> }
>
<span dangerouslySetInnerHTML={{ __html: highlightText(name, searchTerm) }}/>
</Tag>
Expand Down
11 changes: 6 additions & 5 deletions ui/shared/EntityTags/EntityTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ interface Props extends HTMLChakraProps<'span'> {
addressHash?: string;
isLoading?: boolean;
noLink?: boolean;
noColors?: boolean;
}

const EntityTag = ({ data, addressHash, isLoading, noLink, ...rest }: Props) => {
const EntityTag = ({ data, addressHash, isLoading, noLink, noColors, ...rest }: Props) => {
const multichainContext = useMultichainContext();

const linkParams = !noLink ? getTagLinkParams(data, multichainContext) : undefined;
const hasLink = Boolean(linkParams);
const iconColor = data.meta?.textColor ?? 'icon.secondary';
const iconColor = (!noColors && data.meta?.textColor) || 'icon.secondary';

const handleLinkClick = React.useCallback(() => {
if (!linkParams?.href) {
Expand Down Expand Up @@ -62,9 +63,9 @@ const EntityTag = ({ data, addressHash, isLoading, noLink, ...rest }: Props) =>
{ ...rest }
>
<Tag
bg={ data.meta?.bgColor }
color={ data.meta?.textColor }
startElement={ <EntityTagIcon data={ data }/> }
bg={ !noColors ? data.meta?.bgColor : undefined }
color={ !noColors ? data.meta?.textColor : undefined }
startElement={ <EntityTagIcon data={ data } noColors={ noColors }/> }
truncated
endElement={ linkParams?.type === 'external' ? <LinkExternalIcon color={ iconColor }/> : null }
endElementProps={ linkParams?.type === 'external' ? { ml: -1 } : undefined }
Expand Down
8 changes: 4 additions & 4 deletions ui/shared/EntityTags/EntityTagIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import IconSvg from 'ui/shared/IconSvg';

interface Props {
data: EntityTag;
ignoreColor?: boolean;
noColors?: boolean;
}

const EntityTagIcon = ({ data, ignoreColor }: Props) => {
const EntityTagIcon = ({ data, noColors }: Props) => {

const iconColor = data.meta?.textColor && !ignoreColor ? data.meta.textColor : 'icon.secondary';
const iconColor = (!noColors && data.meta?.textColor) || 'icon.secondary';

if (data.meta?.tagIcon) {
if (data.meta?.tagIcon && !noColors) {
return <Image boxSize={ 3 } src={ data.meta.tagIcon } alt={ `${ data.name } icon` }/>;
}

Expand Down
17 changes: 14 additions & 3 deletions ui/shared/EntityTags/EntityTags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ interface Props {
tags: Array<TEntityTag>;
addressHash?: string;
isLoading?: boolean;
noColors?: boolean;
}

const EntityTags = ({ tags, addressHash, className, isLoading }: Props) => {
const EntityTags = ({ tags, addressHash, className, isLoading, noColors }: Props) => {
const isMobile = useIsMobile();
const visibleNum = isMobile ? 2 : 3;

Expand Down Expand Up @@ -51,6 +52,7 @@ const EntityTags = ({ tags, addressHash, className, isLoading }: Props) => {
addressHash={ addressHash }
isLoading={ isLoading }
maxW={ tagMaxW }
noColors={ noColors }
/>
)) }
{ metaSuitesPlaceholder }
Expand All @@ -63,7 +65,7 @@ const EntityTags = ({ tags, addressHash, className, isLoading }: Props) => {
<PopoverContent maxW="300px" w="fit-content">
<PopoverBody>
<Flex columnGap={ 2 } rowGap={ 2 } flexWrap="wrap">
{ tags.slice(visibleNum).map((tag) => <EntityTag key={ tag.slug } data={ tag } addressHash={ addressHash }/>) }
{ tags.slice(visibleNum).map((tag) => <EntityTag key={ tag.slug } data={ tag } addressHash={ addressHash } noColors={ noColors }/>) }
</Flex>
</PopoverBody>
</PopoverContent>
Expand All @@ -74,7 +76,16 @@ const EntityTags = ({ tags, addressHash, className, isLoading }: Props) => {

return (
<>
{ tags.map((tag) => <EntityTag key={ tag.slug } data={ tag } addressHash={ addressHash } isLoading={ isLoading } maxW={ tagMaxW }/>) }
{ tags.map((tag) => (
<EntityTag
key={ tag.slug }
data={ tag }
addressHash={ addressHash }
isLoading={ isLoading }
maxW={ tagMaxW }
noColors={ noColors }
/>
)) }
{ metaSuitesPlaceholder }
</>
);
Expand Down
4 changes: 2 additions & 2 deletions ui/txs/TxsListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const TxsListItem = ({
}: Props) => {
const dataTo = tx.to ? tx.to : tx.created_contract;

const protocolTag = tx.to?.metadata?.tags?.find(tag => tag.tagType === 'protocol');
const protocolTag = tx.to?.hash !== currentAddress && tx.to?.metadata?.tags?.find(tag => tag.tagType === 'protocol');

return (
<ListItemMobile display="block" width="100%" animation={ animation } key={ tx.hash }>
Expand All @@ -67,7 +67,7 @@ const TxsListItem = ({
}
<TxStatus status={ tx.status } errorText={ tx.status === 'error' ? tx.result : undefined } isLoading={ isLoading }/>
<TxWatchListTags tx={ tx } isLoading={ isLoading }/>
{ protocolTag && <EntityTag data={ protocolTag } isLoading={ isLoading }/> }
{ protocolTag && <EntityTag data={ protocolTag } isLoading={ isLoading } noColors/> }
</HStack>
<TxAdditionalInfo tx={ tx } isMobile isLoading={ isLoading }/>
</Flex>
Expand Down
4 changes: 2 additions & 2 deletions ui/txs/TxsTableItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const TxsTableItem = ({
}: Props) => {
const dataTo = tx.to ? tx.to : tx.created_contract;

const protocolTag = tx.to?.metadata?.tags?.find(tag => tag.tagType === 'protocol');
const protocolTag = tx.to?.hash !== currentAddress && tx.to?.metadata?.tags?.find(tag => tag.tagType === 'protocol');

return (
<TableRow key={ tx.hash } animation={ animation }>
Expand Down Expand Up @@ -103,7 +103,7 @@ const TxsTableItem = ({
<span>{ tx.method }</span>
</Badge>
) }
{ protocolTag && <EntityTag data={ protocolTag } isLoading={ isLoading } maxW="100%"/> }
{ protocolTag && <EntityTag data={ protocolTag } isLoading={ isLoading } maxW="100%" noColors/> }
</VStack>
</TableCell>
{ showBlockInfo && (
Expand Down
Loading