uniq
This commit is contained in:
parent
ee09bae19f
commit
ece0b4b6ac
@ -6,19 +6,8 @@ import {
|
|||||||
SectionTitle,
|
SectionTitle,
|
||||||
SectionContent,
|
SectionContent,
|
||||||
} from "@/containers/PageSection";
|
} from "@/containers/PageSection";
|
||||||
import LiveBadge from "@/components/Badges/LiveBadge";
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { RiArrowRightLine } from "react-icons/ri";
|
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 useEvents from "@/lib/hooks/useEvents";
|
||||||
import { Event } from "nostr-tools";
|
import { Event } from "nostr-tools";
|
||||||
import KindLoading from "@/components/KindCard/loading";
|
import KindLoading from "@/components/KindCard/loading";
|
||||||
@ -34,11 +23,11 @@ export default function FeaturedLists() {
|
|||||||
filter: {
|
filter: {
|
||||||
kinds: [30001 as NDKKind],
|
kinds: [30001 as NDKKind],
|
||||||
authors: NOTABLE_ACCOUNTS.map((a) => nip19.decode(a).data.toString()),
|
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(
|
.filter(
|
||||||
(a) =>
|
(a) =>
|
||||||
!!getTagValues("image", a.tags) ?? !!getTagValues("picture", a.tags),
|
!!getTagValues("image", a.tags) ?? !!getTagValues("picture", a.tags),
|
||||||
|
@ -5,8 +5,9 @@ import Link from "next/link";
|
|||||||
import Spinner from "@/components/spinner";
|
import Spinner from "@/components/spinner";
|
||||||
import { Event } from "nostr-tools";
|
import { Event } from "nostr-tools";
|
||||||
import useEvents from "@/lib/hooks/useEvents";
|
import useEvents from "@/lib/hooks/useEvents";
|
||||||
import NDK, { NDKEvent, type NDKFilter } from "@nostr-dev-kit/ndk";
|
|
||||||
import ListCard from "@/components/ListCard";
|
import ListCard from "@/components/ListCard";
|
||||||
|
import { uniqBy } from "ramda";
|
||||||
|
import { getTagValues } from "@/lib/nostr/utils";
|
||||||
|
|
||||||
type SubscriptionsProps = {
|
type SubscriptionsProps = {
|
||||||
pubkey: string;
|
pubkey: string;
|
||||||
@ -41,7 +42,7 @@ export default function Subscriptions({
|
|||||||
if (link) {
|
if (link) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{events.map((e) => {
|
{uniqBy((e) => !!getTagValues("d", e.tags), events).map((e) => {
|
||||||
return (
|
return (
|
||||||
<Link href={`/list/${e.encode()}`}>
|
<Link href={`/list/${e.encode()}`}>
|
||||||
<ListCard key={e.id} event={e} />;
|
<ListCard key={e.id} event={e} />;
|
||||||
@ -53,7 +54,7 @@ export default function Subscriptions({
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{events.map((e) => {
|
{uniqBy((e) => !!getTagValues("d", e.tags), events).map((e) => {
|
||||||
return <ListCard key={e.id} event={e} />;
|
return <ListCard key={e.id} event={e} />;
|
||||||
})}
|
})}
|
||||||
</>
|
</>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user