forked from blockscout/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Public tags: display name tags for addresses (blockscout#1877)
* refactor EntityTags component to work with metadata API format * hook for API metadata info query * make EntityTag component * make EntityTag component * display custom tag colors and sort tags by ordinal field * add tag popover * refactoring * display name tag in the lists * add mixpanel event and disable link for protocol and generic tags * adjust demo ENVs * tests * fix tests * change actionURL to tagUrl
- Loading branch information
1 parent
88cc2b1
commit bcd5e13
Showing
44 changed files
with
565 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export default function makePrettyLink(url: string | undefined): { url: string; domain: string } | undefined { | ||
try { | ||
const urlObj = new URL(url ?? ''); | ||
return { | ||
url: urlObj.href, | ||
domain: urlObj.hostname, | ||
}; | ||
} catch (error) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,63 @@ | ||
import type { AddressMetadataInfo, AddressMetadataTag } from 'types/api/addressMetadata'; | ||
/* eslint-disable max-len */ | ||
import type { AddressMetadataTagApi } from 'types/api/addressMetadata'; | ||
|
||
import { hash } from '../address/address'; | ||
|
||
export const nameTag1: AddressMetadataTag = { | ||
slug: 'ethermineru', | ||
name: 'Ethermine.ru', | ||
export const nameTag: AddressMetadataTagApi = { | ||
slug: 'quack-quack', | ||
name: 'Quack quack', | ||
tagType: 'name', | ||
ordinal: 0, | ||
ordinal: 99, | ||
meta: null, | ||
}; | ||
|
||
export const genericTag1: AddressMetadataTag = { | ||
slug: 'ethermine.ru', | ||
name: 'Ethermine.ru', | ||
export const customNameTag: AddressMetadataTagApi = { | ||
slug: 'unicorn-uproar', | ||
name: 'Unicorn Uproar', | ||
tagType: 'name', | ||
ordinal: 777, | ||
meta: { | ||
tagUrl: 'https://example.com', | ||
bgColor: 'linear-gradient(45deg, deeppink, deepskyblue)', | ||
textColor: '#FFFFFF', | ||
}, | ||
}; | ||
|
||
export const genericTag: AddressMetadataTagApi = { | ||
slug: 'duck-owner', | ||
name: 'duck owner 🦆', | ||
tagType: 'generic', | ||
ordinal: 0, | ||
meta: null, | ||
ordinal: 55, | ||
meta: { | ||
bgColor: 'rgba(255,243,12,90%)', | ||
}, | ||
}; | ||
|
||
export const protocolTag1: AddressMetadataTag = { | ||
export const infoTagWithLink: AddressMetadataTagApi = { | ||
slug: 'goosegang', | ||
name: 'GooseGanG GooseGanG GooseGanG GooseGanG GooseGanG GooseGanG GooseGanG', | ||
tagType: 'classifier', | ||
ordinal: 11, | ||
meta: { | ||
tagUrl: 'https://example.com', | ||
}, | ||
}; | ||
|
||
export const tagWithTooltip: AddressMetadataTagApi = { | ||
slug: 'blockscout-heroes', | ||
name: 'BlockscoutHeroes', | ||
tagType: 'classifier', | ||
ordinal: 42, | ||
meta: { | ||
tooltipDescription: 'The Blockscout team, EVM blockchain aficionados, illuminate Ethereum networks with unparalleled insight and prowess, leading the way in blockchain exploration! 🚀🔎', | ||
tooltipIcon: 'https://localhost:3100/icon.svg', | ||
tooltipTitle: 'Blockscout team member', | ||
tooltipUrl: 'https://blockscout.com', | ||
}, | ||
}; | ||
|
||
export const protocolTag: AddressMetadataTagApi = { | ||
slug: 'aerodrome', | ||
name: 'Aerodrome', | ||
tagType: 'protocol', | ||
ordinal: 0, | ||
meta: null, | ||
}; | ||
|
||
export const baseInfo: AddressMetadataInfo = { | ||
addresses: { | ||
[hash]: { | ||
tags: [ nameTag1, genericTag1, protocolTag1 ], | ||
reputation: null, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-53 Bytes
(100%)
ui/pages/__screenshots__/Token.pw.tsx_default_bridged-token-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.