fix: top zappers

This commit is contained in:
Alejandro Gomez 2023-06-26 15:28:06 +02:00
parent aa66e678d1
commit 8bc4c1e2ce
No known key found for this signature in database
GPG Key ID: 4DF39E566658C817

View File

@ -42,13 +42,12 @@ function totalZapped(pubkey: string, zaps: ParsedZap[]) {
function TopZappers({ zaps }: { zaps: ParsedZap[] }) {
const zappers = zaps
.map((z) => (z.anonZap ? "anon" : z.sender))
.map((p) => p as string)
.slice(0, 3);
.map((p) => p as string);
const sortedZappers = useMemo(() => {
const sorted = [...new Set([...zappers])];
sorted.sort((a, b) => totalZapped(b, zaps) - totalZapped(a, zaps));
return sorted;
return sorted.slice(0, 3);
}, [zaps, zappers]);
return (