explorer
explorer copied to clipboard
feat: add new files section for Metaplex tokens
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 theMetaplexFilesCardcomponent to fetch and display files associated with Metaplex NFTs. Includes error handling and a loading state.app/address/[address]/files/page-client.tsx: Introduced theMetaplexFilesPageClientcomponent to render theMetaplexFilesCardwithin aParsedAccountRendererandSuspenseboundary. (app/address/[address]/files/page-client.tsxR1-R28)app/address/[address]/files/page.tsx: Added a wrapper component,MetaplexFilesPage, to render theMetaplexFilesPageClient. (app/address/[address]/files/page.tsxR1-R11)
Tab Configuration Updates:
app/address/[address]/layout.tsx: UpdatedTABS_LOOKUPand related logic to include the "Files" tab for Metaplex NFTs. Adjusted tab keys frommetaplexNFTtometaplexfor 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 forMetaplexFilesPageClient, 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 forMetaplexFilesPageto 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
AFTER
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 is attempting to deploy a commit to the Solana Foundation Team on Vercel.
A member of the Team first needs to authorize it.
@ngundotra can I get a review on this?
Why not show the whole metadata json in the tab, instead of just doing showing Files ?
@ngundotra we could do that as an another page. This files allows consistency with the attributes page
@ngundotra WDYT?