Skip to content

Commit

Permalink
fix: fix GRC721 display collector options
Browse files Browse the repository at this point in the history
  • Loading branch information
jinoosss committed Nov 14, 2024
1 parent 5acfac2 commit f1cd61b
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,17 @@ const NFTCollections: React.FC<NFTCollectionsProps> = ({
return collections?.length === 0;
}, [collections]);

const isEmptyDisplayCollections = useMemo(() => {
return collections?.filter((collection) => collection.display).length === 0;
const displayCollections = useMemo(() => {
return collections?.filter((collection) => collection.display);
}, [collections]);

const isEmptyDisplayCollections = useMemo(() => {
return displayCollections?.filter((collection) => collection.display).length === 0;
}, [displayCollections]);

const sortedCollections = useMemo(() => {
if (!Array.isArray(collections)) {
return collections;
if (!Array.isArray(displayCollections)) {
return displayCollections;
}

if (!Array.isArray(pinnedCollections)) {
Expand All @@ -69,16 +73,16 @@ const NFTCollections: React.FC<NFTCollectionsProps> = ({

const pinned = pinnedCollections
.map((packagePath) =>
collections.find((collection) => collection.packagePath === packagePath),
displayCollections.find((collection) => collection.packagePath === packagePath),
)
.filter((collection) => !!collection) as GRC721CollectionModel[];

const unpinned = collections.filter(
const unpinned = displayCollections.filter(
(collection) => !pinnedCollections.includes(collection.packagePath),
);

return [...pinned, ...unpinned];
}, [pinnedCollections, collections]);
}, [pinnedCollections, displayCollections]);

const exitsPinnedCollections = useCallback(
(collection: GRC721CollectionModel) => {
Expand Down

0 comments on commit f1cd61b

Please sign in to comment.