-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add metadata tab to NFT details page
- Loading branch information
Showing
6 changed files
with
82 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add NFT feature |
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
37 changes: 37 additions & 0 deletions
37
src/app/pages/NFTInstanceDashboardPage/NftMetadataCard.tsx
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,37 @@ | ||
import { FC } from 'react' | ||
import { useTranslation } from 'react-i18next' | ||
import Card from '@mui/material/Card' | ||
import CardContent from '@mui/material/CardContent' | ||
import { Runtime, useGetRuntimeEvmTokensAddressNftsId } from '../../../oasis-nexus/api' | ||
import { LinkableDiv } from '../../components/PageLayout/LinkableDiv' | ||
import { CardEmptyState } from './../AccountDetailsPage/CardEmptyState' | ||
import { NftDashboardContext } from '../NFTInstanceDashboardPage' | ||
import { JsonCodeDisplay } from '../../components/CodeDisplay' | ||
|
||
export const nftMetadataId = 'metadata' | ||
|
||
export const NftMetadataCard: FC<NftDashboardContext> = ({ scope, address, instanceId }) => { | ||
const { t } = useTranslation() | ||
const { data, isFetched } = useGetRuntimeEvmTokensAddressNftsId( | ||
scope.network, | ||
scope.layer as Runtime, | ||
address, | ||
instanceId, | ||
) | ||
const metadata = data?.data?.metadata | ||
|
||
return ( | ||
<Card> | ||
{isFetched && !metadata && <CardEmptyState label={t('nft.noMetadata')} />} | ||
<> | ||
{metadata && ( | ||
<CardContent> | ||
<LinkableDiv id={nftMetadataId}> | ||
<JsonCodeDisplay data={metadata} label={t('nft.metadata')} /> | ||
</LinkableDiv> | ||
</CardContent> | ||
)} | ||
</> | ||
</Card> | ||
) | ||
} |
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