From a57caf034aeee374e43238024a4675cd602de3f0 Mon Sep 17 00:00:00 2001 From: zmeyer44 Date: Thu, 2 Nov 2023 10:58:29 -0400 Subject: [PATCH] better upcoming events filtering --- .../explore/_sections/UpcomingEvents.tsx | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/app/(app)/explore/_sections/UpcomingEvents.tsx b/app/(app)/explore/_sections/UpcomingEvents.tsx index 6a8fc54..a1ce08f 100644 --- a/app/(app)/explore/_sections/UpcomingEvents.tsx +++ b/app/(app)/explore/_sections/UpcomingEvents.tsx @@ -13,12 +13,10 @@ import CalendarEventCard, { import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; import Link from "next/link"; import useEvents from "@/lib/hooks/useEvents"; -import { Event } from "nostr-tools"; -import KindLoading from "@/components/KindCard/loading"; -import { nip19 } from "nostr-tools"; import { getTagValues, getTagsValues } from "@/lib/nostr/utils"; import { type NDKKind } from "@nostr-dev-kit/ndk"; import { uniqBy } from "ramda"; +import { unixTimeNowInSeconds } from "@/lib/nostr/dates"; export default function UpcomingEventsSection() { const { events } = useEvents({ @@ -49,24 +47,33 @@ export default function UpcomingEventsSection() {
Upcoming Events
- + + +
{processedEvents?.length ? ( - processedEvents.slice(0, 6).map((e, idx) => { - return ( - - - - ); - }) + processedEvents + .filter( + (e) => + parseInt(getTagValues("start", e.tags) ?? "0") > + unixTimeNowInSeconds(), + ) + .slice(0, 8) + .map((e, idx) => { + return ( + + + + ); + }) ) : ( <>