import "./BadgeList.css"; import { useState } from "react"; import { FormattedMessage } from "react-intl"; import { TaggedRawEvent } from "@snort/nostr"; import { ProxyImg } from "Element/ProxyImg"; import Icon from "Icons/Icon"; import Modal from "Element/Modal"; import Username from "Element/Username"; import { findTag } from "Util"; export default function BadgeList({ badges }: { badges: TaggedRawEvent[] }) { 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)} /> }} />

); })}
)} ); }