"use client"; import { useState } from "react"; import Image from "next/image"; import { Button } from "@/components/ui/button"; import SubscriptionCard from "@/components/SubscriptionCard"; import { HiCheckBadge } from "react-icons/hi2"; import Tabs from "@/components/Tabs"; import useProfile from "@/lib/hooks/useProfile"; import { getTwoLetters, truncateText } from "@/lib/utils"; import { nip19 } from "nostr-tools"; import useEvents from "@/lib/hooks/useEvents"; import Spinner from "@/components/spinner"; import { getTagValues } from "@/lib/nostr/utils"; const demo = [ { id: "1", title: "BTC Radio", description: "BTC Radio is the best fuking show ever. you should sub to it. now", picture: "https://assets.whop.com/cdn-cgi/image/width=1080/https://assets.whop.com/images/images/51602.original.png?1693358530", tags: ["music", "crypto", "art"], }, ]; export default function ListPage({ params: { naddr }, }: { params: { naddr: string; }; }) { const [activeTab, setActiveTab] = useState("feed"); const { type, data } = nip19.decode(naddr); console.log("PASSED", naddr, data); if (type !== "naddr") { throw new Error("Invalid list"); } const { identifier, kind, pubkey } = data; const { profile } = useProfile(pubkey); const { events } = useEvents({ filter: { authors: [pubkey], kinds: [kind], ["#d"]: [identifier], limit: 1, }, }); const event = events[0]; if (!event) { return (
); } const title = getTagValues("title", event.tags) ?? getTagValues("name", event.tags) ?? "Untitled"; const image = getTagValues("image", event.tags) ?? getTagValues("picture", event.tags) ?? getTagValues("benner", event.tags); const description = getTagValues("description", event.tags); return (
{!!profile?.banner && ( banner )}
{profile?.image ? ( profile picture ) : (
)}

{title}

{!!profile?.nip05 && ( )}
{!!profile?.name &&

{profile.name}

} {!!profile?.name && !!profile.nip05 && ( <>
ยท

{profile.nip05}

)}
{!!description && (

{description}

)}
{demo.map((e) => ( ))}
setActiveTab(t.name)} />
); }