explorer icon indicating copy to clipboard operation
explorer copied to clipboard

feat: add new files section for Metaplex tokens

Open overbit opened this issue 4 months ago • 5 comments

Description

This pull request introduces a new "Files" tab for Metaplex NFTs, adding functionality to display associated files and enhancing the user interface with new components and tests. The most important changes include creating new components for rendering Metaplex NFT files, updating the tab configuration to include the "Files" tab, and adding comprehensive tests to ensure functionality.

New Components and Functionality:

  • app/components/account/MetaplexFilesCard.tsx: Added the MetaplexFilesCard component to fetch and display files associated with Metaplex NFTs. Includes error handling and a loading state.
  • app/address/[address]/files/page-client.tsx: Introduced the MetaplexFilesPageClient component to render the MetaplexFilesCard within a ParsedAccountRenderer and Suspense boundary. (app/address/[address]/files/page-client.tsxR1-R28)
  • app/address/[address]/files/page.tsx: Added a wrapper component, MetaplexFilesPage, to render the MetaplexFilesPageClient. (app/address/[address]/files/page.tsxR1-R11)

Tab Configuration Updates:

  • app/address/[address]/layout.tsx: Updated TABS_LOOKUP and related logic to include the "Files" tab for Metaplex NFTs. Adjusted tab keys from metaplexNFT to metaplex for consistency. (app/address/[address]/layout.tsxL111-R111, app/address/[address]/layout.tsxR122-R126, app/address/[address]/layout.tsxL135-R140, app/address/[address]/layout.tsxR151-R155, app/address/[address]/layout.tsxR393, app/address/[address]/layout.tsxL446-R457)

Tests:

  • app/address/[address]/files/__tests__/page-client.test.tsx: Added unit tests for MetaplexFilesPageClient, including mock implementations for dependencies and tests for rendering behavior. (app/address/[address]/files/tests/page-client.test.tsxR1-R97)
  • app/address/[address]/files/__tests__/page.test.tsx: Added unit tests for MetaplexFilesPage to verify correct rendering and parameter passing. (app/address/[address]/files/tests/page.test.tsxR1-R41)

Type of change

  • [ ] Bug fix
  • [x] New feature
  • [ ] Protocol integration
  • [ ] Documentation update
  • [ ] Other (please describe):

Screenshots

BEFORE image

AFTER image

Testing

Manual testing was also performed on devnet, using the following token:

http://localhost:3000/address/9a1nsHmVZsAHhyoHbAvK2CbShg6FsNTkohPfTKz8MCwt/files?cluster=devnet

Related Issues

Fixes #665

Checklist

  • [x] My code follows the project's style guidelines
  • [ ] I have added tests that prove my fix/feature works
  • [x] All tests pass locally and in CI
  • [ ] I have updated documentation as needed
  • [ ] CI/CD checks pass
  • [ ] I have included screenshots for protocol screens (if applicable)
  • [ ] For security-related features, I have included links to related information

Additional Notes

overbit avatar Aug 01 '25 15:08 overbit

@overbit is attempting to deploy a commit to the Solana Foundation Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Aug 01 '25 15:08 vercel[bot]

@ngundotra can I get a review on this?

overbit avatar Aug 04 '25 08:08 overbit

Why not show the whole metadata json in the tab, instead of just doing showing Files ?

ngundotra avatar Aug 04 '25 15:08 ngundotra

@ngundotra we could do that as an another page. This files allows consistency with the attributes page

overbit avatar Aug 07 '25 10:08 overbit

@ngundotra WDYT?

overbit avatar Aug 13 '25 12:08 overbit