Skip to content

Commit

Permalink
feat: add official site on erc 721/1155 pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-CY committed Nov 17, 2022
1 parent 228bd92 commit 5caa7c3
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 9 deletions.
18 changes: 14 additions & 4 deletions pages/multi-token-collection/[address].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import InventoryList, { fetchInventoryListOfCollection } from 'components/MultiT
import { client, GraphQLSchema } from 'utils'
import styles from './styles.module.scss'

type CollectionInfoProps = Omit<GraphQLSchema.MultiTokenCollectionListItem, 'id' | 'account'> | undefined
type CollectionInfoProps =
| (Omit<GraphQLSchema.MultiTokenCollectionListItem, 'id' | 'account'> & { official_site: string })
| undefined

interface InfoProps {
erc1155_udts: {
Expand All @@ -40,6 +42,7 @@ const infoQuery = gql`
token_type_count
holders_count
minted_count
official_site
}
}
}
Expand Down Expand Up @@ -111,10 +114,17 @@ const MultiTokenCollection = () => {
field: t('contract'),
content: <HashLink label={address as string} href={`/account/${address}`} />,
},

{
field: '',
content: <div data-role="placeholder" style={{ height: `1.5rem` }}></div>,
field: t('officialSite'),
content: info ? (
info.official_site ? (
<HashLink label={info.official_site} href={info.official_site} external />
) : (
'-'
)
) : (
<Skeleton animation="wave" />
),
},
]

Expand Down
19 changes: 18 additions & 1 deletion pages/nft-collection/[address].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import InventoryList, { fetchInventoryListOfCollection } from 'components/NFTInv
import { client, GraphQLSchema } from 'utils'
import styles from './styles.module.scss'

type CollectionInfoProps = Omit<GraphQLSchema.NftCollectionListItem, 'id' | 'account'> | undefined
type CollectionInfoProps =
| (Omit<GraphQLSchema.NftCollectionListItem, 'id' | 'account'> & { official_site: string })
| undefined

interface CollectionProps {
erc721_udts: {
Expand All @@ -39,6 +41,7 @@ const infoQuery = gql`
icon
holders_count
minted_count
official_site
}
}
}
Expand Down Expand Up @@ -110,6 +113,14 @@ const NftCollection = () => {
field: t('contract'),
content: <HashLink label={address as string} href={`/account/${address}`} />,
},
info?.official_site
? {
field: t('officialSite'),
content: (
<HashLink label={info.official_site} href={info.official_site} external style={{ textTransform: 'none' }} />
),
}
: null,
]

const stats: Array<{ field: string; content: React.ReactNode }> = [
Expand All @@ -121,6 +132,12 @@ const NftCollection = () => {
field: t('minted_count'),
content: isInfoLoading ? <Skeleton animation="wave" /> : (+info?.minted_count ?? 0).toLocaleString('en'),
},
info?.official_site
? {
field: '',
content: <div data-role="placeholder" style={{ height: `1.5rem` }}></div>,
}
: null,
]

const title = t(`nft-collection`)
Expand Down
3 changes: 3 additions & 0 deletions pages/nft-collection/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
& > div {
margin-bottom: 1rem;
}
dl[title=''] {
display: none;
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion public/locales/en-US/multi-token.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
"token-id": "Token ID",
"owner": "Owner",
"name": "Name",
"quantity": "Quantity"
"quantity": "Quantity",
"officialSite": "Official Site"
}
3 changes: 2 additions & 1 deletion public/locales/en-US/nft.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"erc-721": "ERC 721",
"token-id": "Token ID",
"owner": "Owner",
"name": "Name"
"name": "Name",
"officialSite": "Official Site"
}
3 changes: 2 additions & 1 deletion public/locales/zh-CN/multi-token.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
"token-id": "通证 ID",
"owner": "所属人",
"name": "名称",
"quantity": "数量"
"quantity": "数量",
"officialSite": "官方网站"
}
3 changes: 2 additions & 1 deletion public/locales/zh-CN/nft.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"erc-721": "ERC 721",
"token-id": "通证 ID",
"owner": "所属人",
"name": "名称"
"name": "名称",
"officialSite": "官方网站"
}

0 comments on commit 5caa7c3

Please sign in to comment.