Skip to content

Commit 4a61683

Browse files
committed
[Dashboard] Add tokenURI section to the NFT page
1 parent 1994d9e commit 4a61683

File tree

1 file changed

+26
-1
lines changed
  • apps/dashboard/src/contract-ui/tabs/nfts/components

1 file changed

+26
-1
lines changed

apps/dashboard/src/contract-ui/tabs/nfts/components/token-id.tsx

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { WalletAddress } from "@/components/blocks/wallet-address";
44
import { Spinner } from "@/components/ui/Spinner/Spinner";
5+
import { useThirdwebClient } from "@/constants/thirdweb.client";
56
import { useDashboardRouter } from "@/lib/DashboardRouter";
67
import {
78
Box,
@@ -15,12 +16,14 @@ import {
1516
useBreakpointValue,
1617
} from "@chakra-ui/react";
1718
import { useNFTDrawerTabs } from "core-ui/nft-drawer/useNftDrawerTabs";
18-
import { ChevronLeftIcon } from "lucide-react";
19+
import { ChevronLeftIcon, ExternalLinkIcon } from "lucide-react";
20+
import Link from "next/link";
1921
import { useState } from "react";
2022
import type { ThirdwebContract } from "thirdweb";
2123
import { getNFT as getErc721NFT } from "thirdweb/extensions/erc721";
2224
import { getNFT as getErc1155NFT } from "thirdweb/extensions/erc1155";
2325
import { useReadContract } from "thirdweb/react";
26+
import { resolveScheme } from "thirdweb/storage";
2427
import { Badge, Button, Card, CodeBlock, Heading, Text } from "tw-components";
2528
import { AddressCopyButton } from "tw-components/AddressCopyButton";
2629
import { NFTMediaWithEmptyState } from "tw-components/nft-media";
@@ -65,6 +68,8 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
6568
tokenId,
6669
});
6770

71+
const client = useThirdwebClient();
72+
6873
const { data: nft, isPending } = useReadContract(
6974
isErc721 ? getErc721NFT : getErc1155NFT,
7075
{
@@ -240,6 +245,26 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
240245
</GridItem>
241246
</>
242247
)}
248+
<GridItem colSpan={4}>
249+
<Heading size="label.md">Token URI</Heading>
250+
</GridItem>
251+
<GridItem
252+
colSpan={8}
253+
className="flex flex-row items-center gap-2"
254+
>
255+
<AddressCopyButton
256+
size="xs"
257+
address={nft.tokenURI}
258+
title="Token URI"
259+
shortenAddress={true}
260+
/>
261+
<Link
262+
href={resolveScheme({ client, uri: nft.tokenURI })}
263+
target="_blank"
264+
>
265+
<ExternalLinkIcon className="size-4" />
266+
</Link>
267+
</GridItem>
243268
</SimpleGrid>
244269
</Card>
245270
{properties ? (

0 commit comments

Comments
 (0)