2023-10-15 22:15:49 -04:00
|
|
|
"use client";
|
2023-10-14 18:57:37 -04:00
|
|
|
import {
|
|
|
|
Section,
|
|
|
|
SectionHeader,
|
|
|
|
SectionTitle,
|
|
|
|
SectionContent,
|
|
|
|
} from "@/containers/PageSection";
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
import { RiArrowRightLine } from "react-icons/ri";
|
|
|
|
import KindCard from "@/components/KindCard";
|
2023-10-16 00:57:59 -04:00
|
|
|
import { NOTABLE_ACCOUNTS } from "@/constants";
|
2023-10-14 18:57:37 -04:00
|
|
|
import Link from "next/link";
|
2023-10-15 22:15:49 -04:00
|
|
|
import useEvents from "@/lib/hooks/useEvents";
|
|
|
|
import { Event } from "nostr-tools";
|
2023-10-16 00:28:09 -04:00
|
|
|
import KindLoading from "@/components/KindCard/loading";
|
2023-10-16 00:57:59 -04:00
|
|
|
import { nip19 } from "nostr-tools";
|
|
|
|
import { getTagValues } from "@/lib/nostr/utils";
|
2023-10-16 00:28:09 -04:00
|
|
|
|
2023-10-14 18:57:37 -04:00
|
|
|
export default function LongFormContentSection() {
|
2023-10-15 22:15:49 -04:00
|
|
|
const { events } = useEvents({
|
|
|
|
filter: {
|
|
|
|
kinds: [30023],
|
2023-10-16 00:57:59 -04:00
|
|
|
authors: NOTABLE_ACCOUNTS.map((a) => nip19.decode(a).data.toString()),
|
2023-10-15 22:15:49 -04:00
|
|
|
limit: 10,
|
|
|
|
},
|
|
|
|
});
|
2023-10-14 18:57:37 -04:00
|
|
|
return (
|
|
|
|
<Section>
|
|
|
|
<SectionHeader>
|
|
|
|
<SectionTitle>Long form content</SectionTitle>
|
|
|
|
<Button variant={"ghost"}>
|
|
|
|
View all <RiArrowRightLine className="ml-1 h-4 w-4" />
|
|
|
|
</Button>
|
|
|
|
</SectionHeader>
|
|
|
|
<SectionContent className="sm:lg-feed-cols relative mx-auto flex flex-col gap-4">
|
2023-10-16 00:28:09 -04:00
|
|
|
{events?.length ? (
|
2023-10-16 00:57:59 -04:00
|
|
|
events
|
|
|
|
.filter((e) => !!getTagValues("summary", e.tags))
|
|
|
|
.slice(0, 6)
|
|
|
|
.map((e, idx) => {
|
|
|
|
if (idx > 6) return null;
|
|
|
|
const event = e.rawEvent() as Event;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Link key={e.id} href={`/article/${e.encode()}`}>
|
|
|
|
<KindCard {...event} />
|
|
|
|
</Link>
|
|
|
|
);
|
|
|
|
})
|
2023-10-16 00:28:09 -04:00
|
|
|
) : (
|
|
|
|
<>
|
|
|
|
<KindLoading />
|
|
|
|
<KindLoading />
|
|
|
|
<KindLoading />
|
|
|
|
<KindLoading />
|
|
|
|
</>
|
|
|
|
)}
|
2023-10-14 18:57:37 -04:00
|
|
|
</SectionContent>
|
|
|
|
</Section>
|
|
|
|
);
|
|
|
|
}
|