import "./BadgeList.css"; import { TaggedNostrEvent } from "@snort/system"; import { useState } from "react"; import { FormattedMessage } from "react-intl"; import CloseButton from "@/Components/Button/CloseButton"; import Modal from "@/Components/Modal/Modal"; import { ProxyImg } from "@/Components/ProxyImg"; import Username from "@/Components/User/Username"; import { findTag } from "@/Utils"; export default function BadgeList({ badges }: { badges: TaggedNostrEvent[] }) { const [showModal, setShowModal] = useState(false); const badgeMetadata = badges.map(b => { const thumb = findTag(b, "thumb"); const image = findTag(b, "image"); const name = findTag(b, "name"); const description = findTag(b, "description"); return { id: b.id, pubkey: b.pubkey, name, description, thumb: thumb?.length ?? 0 > 0 ? thumb : image, image, }; }); return ( <>
setShowModal(!showModal)}> {badgeMetadata.slice(0, 8).map(({ id, name, thumb }) => ( ))}
{showModal && ( setShowModal(false)}>
setShowModal(false)} />

{badgeMetadata.map(({ id, name, pubkey, description, image }) => { return (

{name}

{description}

setShowModal(false)} /> }} />

); })}
)} ); }