From 9ce0de1b74eb0c482281cd5d1202aacd253b2a9c Mon Sep 17 00:00:00 2001 From: kase <82421539+kaseLunt@users.noreply.github.com> Date: Fri, 8 Mar 2024 13:42:49 -0700 Subject: [PATCH] change order of NFTs (#346) --- .../src/components/StudentProgress/index.jsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/base-docs/src/components/StudentProgress/index.jsx b/apps/base-docs/src/components/StudentProgress/index.jsx index 711ca51c7e..3082918294 100644 --- a/apps/base-docs/src/components/StudentProgress/index.jsx +++ b/apps/base-docs/src/components/StudentProgress/index.jsx @@ -43,10 +43,21 @@ export default function StudentProgress() { ); }; + // Function to render the NFT cards in the desired order (imports after 'inheritance' and before 'errors') const renderNFTs = () => { - const NFTs = Object.keys(nftData).map((nftNum) => { + // Get the sorted NFT keys, excluding key '19' imports + const sortedNFTKeys = Object.keys(nftData) + .filter((key) => key !== '19') + .sort((a, b) => a - b); + + // Find the index of key '8' and insert key '19' after it + const index = sortedNFTKeys.findIndex((key) => key === '8'); + sortedNFTKeys.splice(index + 1, 0, '19'); + + // Map over the sorted NFT keys and render the NFT cards + const NFTs = sortedNFTKeys.map((nftNum) => { const nft = nftData[nftNum]; - + return ( ); }); - + return NFTs; };