Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ function _Collectibles({
const groupedCollectibles = useMemo(
() =>
getGroupedCollectibles(
data?.wallet?.nfts?.edges.map((e) => e.node) ?? []
(data?.wallet?.nfts?.edges.map((e) => e.node) ?? []).sort((a, b) =>
a.address.localeCompare(b.address)
)
),
[data]
);
Expand Down
16 changes: 11 additions & 5 deletions packages/data-components/src/components/Collectibles/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function getGroupedCollectibles(
.reduce<CollectibleGroup[]>((acc, curr) => {
acc.push({
collection: curr[0],
data: curr[1],
data: curr[1].sort((a, b) => a.address.localeCompare(b.address)),
whitelisted: curr[1][0].whitelisted,
});
return acc;
Expand All @@ -46,10 +46,16 @@ export function getGroupedCollectibles(
else if (b.collection === "Mad Lads") return 1;
else if (a.collection === "Tensorians") return -1;
else if (b.collection === "Tensorians") return 1;
else if (a.whitelisted && b.whitelisted)
return b.data.length - a.data.length;
else if (a.whitelisted) return -1;
else if (a.whitelisted && b.whitelisted) {
if (b.data.length !== a.data.length) {
return b.data.length - a.data.length;
}
return a.collection.localeCompare(b.collection);
} else if (a.whitelisted) return -1;
else if (b.whitelisted) return 1;
return b.data.length - a.data.length;
if (b.data.length !== a.data.length) {
return b.data.length - a.data.length;
}
return a.collection.localeCompare(b.collection);
});
}