diff --git a/app/(app)/app/_sections/LiveStreaming.tsx b/app/(app)/app/_sections/LiveStreaming.tsx index c01a25f..d505517 100644 --- a/app/(app)/app/_sections/LiveStreaming.tsx +++ b/app/(app)/app/_sections/LiveStreaming.tsx @@ -29,8 +29,25 @@ export default function LiveStreamingSection() { }, }); - const processedEvents = uniqBy((e) => getTagValues("title", e.tags), events); - console.log(events); + const processedEvents = uniqBy( + (e) => getTagValues("title", e.tags), + events, + ).sort((a, b) => { + const aParticipants = + getTagValues("total_participants", a.tags) ?? + getTagValues("current_participants", a.tags); + const bParticipants = + getTagValues("total_participants", b.tags) ?? + getTagValues("current_participants", b.tags); + if (aParticipants && bParticipants) { + if (parseInt(aParticipants) < parseInt(bParticipants)) { + return 1; + } else return -1; + } + if (bParticipants) return 1; + return -1; + }); + console.log(processedEvents); return (
@@ -55,6 +72,7 @@ export default function LiveStreamingSection() { const image = getTagValues("image", event.tags) as string; const title = getTagValues("title", event.tags) as string; const starts = getTagValues("starts", event.tags) as string; + const ends = getTagValues("ends", event.tags) as string; const tags = getTagsValues("t", event.tags) as string[]; const total_participants = getTagValues("total_participants", event.tags) ?? @@ -75,6 +93,7 @@ export default function LiveStreamingSection() { tags, title, starts: parseInt(starts), + ends: parseInt(ends), total_participants: total_participants ? parseInt(total_participants) : undefined, diff --git a/app/(app)/article/[key]/@30311/page.tsx b/app/(app)/article/[key]/@30311/page.tsx index d22e42a..6133fb7 100644 --- a/app/(app)/article/[key]/@30311/page.tsx +++ b/app/(app)/article/[key]/@30311/page.tsx @@ -17,9 +17,10 @@ export default function EventPage({ const { data, type } = nip19.decode(key); const { events } = useEvents({ filter: - type === "nevent" + type === "naddr" ? { - ids: [data.id], + kinds: [data.kind], + ["#d"]: [data.identifier], limit: 1, } : {}, diff --git a/app/(app)/article/[key]/layout.tsx b/app/(app)/article/[key]/layout.tsx index 179d567..7e14f22 100644 --- a/app/(app)/article/[key]/layout.tsx +++ b/app/(app)/article/[key]/layout.tsx @@ -5,6 +5,7 @@ export default function ModalLayout(props: { children: ReactElement; "1": ReactNode; "30023": ReactNode; + "30311": ReactNode; event: ReactNode; params: { key: string; @@ -13,11 +14,20 @@ export default function ModalLayout(props: { const key = props.params.key; const { data, type } = nip19.decode(key); if (type === "naddr") { - return ( -
- {props[30023]} -
- ); + const kind = data.kind; + if (kind === 30023) { + return ( +
+ {props[30023]} +
+ ); + } else if (kind === 30311) { + return ( +
+ {props[30311]} +
+ ); + } } else if (type === "note") { return (
diff --git a/components/KindCard/components/Container.tsx b/components/KindCard/components/Container.tsx index 742c646..1d04f30 100644 --- a/components/KindCard/components/Container.tsx +++ b/components/KindCard/components/Container.tsx @@ -61,7 +61,7 @@ export default function Container({ {children}
{!!contentTags?.length && ( -
+
)} diff --git a/components/VideoCard/index.tsx b/components/VideoCard/index.tsx index 195b4e4..041fbd4 100644 --- a/components/VideoCard/index.tsx +++ b/components/VideoCard/index.tsx @@ -13,6 +13,7 @@ type VideoCardProps = { title: string; tags: string[]; starts?: number; + ends?: number; status: "live" | "planned" | "ended"; ["total_participants"]?: number; }; @@ -21,6 +22,7 @@ type VideoCardProps = { export default function VideoCard({ className, card }: VideoCardProps) { const startTime = card?.starts ? new Date(card.starts * 1000) : null; + const endTime = card?.ends ? new Date(card.ends * 1000) : null; return (
{card.title}
- {startTime && ( + {!!startTime && (
{formatDate(new Date(startTime), "h:m a")} + {!!endTime && ( + <> + {" "} + -{" "} + {formatDate(new Date(endTime), "h:m a")} + + )}
)} {!!card["total_participants"] && (