From bc339f93eb83ffa7f59b9de440c9699bfd9fd561 Mon Sep 17 00:00:00 2001 From: Jean Ribeiro Date: Sat, 25 May 2024 15:37:11 -0300 Subject: [PATCH] fix: remvoe hidden/scam nfts in collections --- .../components/CollectionDetails.svelte | 2 +- .../components/CollectionsGalleryItem.svelte | 2 +- .../views/CollectionsGalleryView.svelte | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/desktop/views/dashboard/collectibles/components/CollectionDetails.svelte b/packages/desktop/views/dashboard/collectibles/components/CollectionDetails.svelte index 91324eb7ac..9983cdd2ee 100644 --- a/packages/desktop/views/dashboard/collectibles/components/CollectionDetails.svelte +++ b/packages/desktop/views/dashboard/collectibles/components/CollectionDetails.svelte @@ -5,7 +5,7 @@ export let collectionId: string - $: nfts = $ownedNfts.filter((nft) => nft.collectionId === collectionId) + $: nfts = $ownedNfts.filter((nft) => nft.collectionId === collectionId && !nft.hidden && !nft.isScam) onDestroy(() => { $selectedCollectionId = undefined diff --git a/packages/desktop/views/dashboard/collectibles/components/CollectionsGalleryItem.svelte b/packages/desktop/views/dashboard/collectibles/components/CollectionsGalleryItem.svelte index 734d87613e..c49a2d2d6c 100644 --- a/packages/desktop/views/dashboard/collectibles/components/CollectionsGalleryItem.svelte +++ b/packages/desktop/views/dashboard/collectibles/components/CollectionsGalleryItem.svelte @@ -14,7 +14,7 @@ } $: collection = $persistedCollections[collectionId] - $: nfts = $ownedNfts.filter((nft) => nft.collectionId === collectionId) + $: nfts = $ownedNfts.filter((nft) => nft.collectionId === collectionId && !nft.hidden && !nft.isScam) {#if collection && nfts.length > 0} diff --git a/packages/desktop/views/dashboard/collectibles/views/CollectionsGalleryView.svelte b/packages/desktop/views/dashboard/collectibles/views/CollectionsGalleryView.svelte index 8c56975489..6abe2b9c17 100644 --- a/packages/desktop/views/dashboard/collectibles/views/CollectionsGalleryView.svelte +++ b/packages/desktop/views/dashboard/collectibles/views/CollectionsGalleryView.svelte @@ -11,17 +11,18 @@ let queriedCollectionsIds: string[] = [] - $: collectionsIds = new Set( - $ownedNfts - ?.map((nft) => nft.collectionId) - .filter((collectionId) => collectionId && $persistedCollections[collectionId]) - ) + $: collectionsIds = $ownedNfts?.reduce((set, nft) => { + if (!nft.hidden && !nft.isScam && nft.collectionId && $persistedCollections[nft.collectionId]) { + set.add(nft.collectionId) + } + return set + }, new Set()) $: $collectionsSearchTerm, collectionsIds, setQueriedCollectionsIds() function setQueriedCollectionsIds(): void { queriedCollectionsIds = Array.from(collectionsIds) - .filter((collectionId) => isVisibleCollection($persistedCollections[collectionId])) + ?.filter((collectionId) => isVisibleCollection($persistedCollections[collectionId])) .sort((collectionId1, collectionId2) => $persistedCollections[collectionId1]?.name .toLowerCase()