Skip to content

Commit d59ab13

Browse files
committed
[Dashboard] Add Media URI to token page (#5088)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview This PR enhances the `TokenIdPage` component by adding a section to display the media URI of an NFT, including a button to copy the URI and a link to view it externally. ### Detailed summary - Added a conditional rendering block to display the media URI if `nft.metadata.image` exists. - Included a `GridItem` for the "Media URI" heading. - Added a `CopyTextButton` to copy the media URI. - Added a button with a link to the media URI, featuring an `ExternalLinkIcon`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 221f95b commit d59ab13

File tree

1 file changed

+30
-1
lines changed
  • apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]

1 file changed

+30
-1
lines changed

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/token-id.tsx

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
260260
tooltip="The URI of this NFT"
261261
copyIconPosition="right"
262262
/>
263-
<Button variant="ghost">
263+
<Button variant="ghost" size="sm">
264264
<Link
265265
href={resolveScheme({ client, uri: nft.tokenURI })}
266266
target="_blank"
@@ -269,6 +269,35 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
269269
</Link>
270270
</Button>
271271
</GridItem>
272+
{nft.metadata.image && (
273+
<>
274+
<GridItem colSpan={4}>
275+
<Heading size="label.md">Media URI</Heading>
276+
</GridItem>
277+
<GridItem
278+
colSpan={8}
279+
className="flex flex-row items-center gap-1"
280+
>
281+
<CopyTextButton
282+
textToCopy={nft.metadata.image}
283+
textToShow={shortenString(nft.metadata.image)}
284+
tooltip="The media URI of this NFT"
285+
copyIconPosition="right"
286+
/>
287+
<Button variant="ghost" size="sm">
288+
<Link
289+
href={resolveScheme({
290+
client,
291+
uri: nft.metadata.image,
292+
})}
293+
target="_blank"
294+
>
295+
<ExternalLinkIcon className="size-4" />
296+
</Link>
297+
</Button>
298+
</GridItem>
299+
</>
300+
)}
272301
</SimpleGrid>
273302
</Card>
274303
{properties ? (

0 commit comments

Comments
 (0)