import Image from "next/image"; import { cn, formatNumber, getTwoLetters, formatCount } from "@/lib/utils"; import { Badge } from "../ui/badge"; import { RxClock } from "react-icons/rx"; import { HiOutlineUsers } from "react-icons/hi"; import { AspectRatio } from "@/components/ui/aspect-ratio"; import { Skeleton } from "@/components/ui/skeleton"; import { type Event } from "nostr-tools"; import { formatDate } from "@/lib/utils/dates"; import { getTagValues, getTagsValues, getPrice } from "@/lib/nostr/utils"; import { nip19 } from "nostr-tools"; import useProfile from "@/lib/hooks/useProfile"; import { type NDKEvent } from "@nostr-dev-kit/ndk"; import { Card, CardContent, CardDescription, CardTitle, } from "@/components/ui/card"; import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar"; type ListCardProps = { event: NDKEvent; className?: string; }; export default function ListCard({ className, event: e }: ListCardProps) { const event = e.rawEvent() as Event; const image = getTagValues("image", event.tags) as string; const title = getTagValues("title", event.tags) ?? getTagValues("name", event.tags); const description = getTagValues("description", event.tags); const userCount = getTagsValues("p", event.tags).length; const price = getPrice(event.tags); const tags = getTagsValues("t", event.tags) as string[]; const { profile } = useProfile(e.pubkey); const npub = nip19.npubEncode(e.pubkey); return ( console.log(event.tags)} className="max-sm:border-0 max-sm:shadow-none" >
{title
{getTwoLetters({ profile, npub })}
{title} {description}
{`${userCount} subs`}
{/*
2k sats
/month
*/} {price ? ( <> {`${formatCount(price.asSats)} sats`} {!!price.frequency && (
{`per ${price.frequency}`}
)} ) : ( Free )}
); } export function ListCardLoading({ className }: { className?: string }) { return (
{/*
2k sats
/month
*/}
); }