From ece0b4b6acfb2c72d25dd255bf4ce37eb1d83fe0 Mon Sep 17 00:00:00 2001 From: zmeyer44 Date: Wed, 18 Oct 2023 15:39:43 -0400 Subject: [PATCH] uniq --- app/(app)/app/_sections/FeaturedLists.tsx | 15 ++------------- containers/Subscriptions/index.tsx | 7 ++++--- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/app/(app)/app/_sections/FeaturedLists.tsx b/app/(app)/app/_sections/FeaturedLists.tsx index 2970d81..ea784d2 100644 --- a/app/(app)/app/_sections/FeaturedLists.tsx +++ b/app/(app)/app/_sections/FeaturedLists.tsx @@ -6,19 +6,8 @@ import { SectionTitle, SectionContent, } from "@/containers/PageSection"; -import LiveBadge from "@/components/Badges/LiveBadge"; import { Button } from "@/components/ui/button"; import { RiArrowRightLine } from "react-icons/ri"; -import { - Card, - CardContent, - CardDescription, - CardTitle, -} from "@/components/ui/card"; -import Image from "next/image"; -import { cn, formatNumber, getTwoLetters } from "@/lib/utils"; -import { Badge } from "@/components/ui/badge"; -import { AspectRatio } from "@/components/ui/aspect-ratio"; import useEvents from "@/lib/hooks/useEvents"; import { Event } from "nostr-tools"; import KindLoading from "@/components/KindCard/loading"; @@ -34,11 +23,11 @@ export default function FeaturedLists() { filter: { kinds: [30001 as NDKKind], authors: NOTABLE_ACCOUNTS.map((a) => nip19.decode(a).data.toString()), - limit: 50, + limit: 60, }, }); - const processedEvents = events + const processedEvents = uniqBy((e) => getTagValues("d", e.tags), events) .filter( (a) => !!getTagValues("image", a.tags) ?? !!getTagValues("picture", a.tags), diff --git a/containers/Subscriptions/index.tsx b/containers/Subscriptions/index.tsx index 555ea88..ec7f5cb 100644 --- a/containers/Subscriptions/index.tsx +++ b/containers/Subscriptions/index.tsx @@ -5,8 +5,9 @@ import Link from "next/link"; import Spinner from "@/components/spinner"; import { Event } from "nostr-tools"; import useEvents from "@/lib/hooks/useEvents"; -import NDK, { NDKEvent, type NDKFilter } from "@nostr-dev-kit/ndk"; import ListCard from "@/components/ListCard"; +import { uniqBy } from "ramda"; +import { getTagValues } from "@/lib/nostr/utils"; type SubscriptionsProps = { pubkey: string; @@ -41,7 +42,7 @@ export default function Subscriptions({ if (link) { return ( <> - {events.map((e) => { + {uniqBy((e) => !!getTagValues("d", e.tags), events).map((e) => { return ( ; @@ -53,7 +54,7 @@ export default function Subscriptions({ } return ( <> - {events.map((e) => { + {uniqBy((e) => !!getTagValues("d", e.tags), events).map((e) => { return ; })}