import { Image } from "@shared/image"; import { RelayContext } from "@shared/relayProvider"; import { DEFAULT_AVATAR, READONLY_RELAYS } from "@stores/constants"; import { shortenKey } from "@utils/shortenKey"; import destr from "destr"; import { Author } from "nostr-relaypool"; import { useContext, useEffect, useState } from "react"; const DEFAULT_BANNER = "https://bafybeiacwit7hjmdefqggxqtgh6ht5dhth7ndptwn2msl5kpkodudsr7py.ipfs.w3s.link/banner-1.jpg"; export default function ProfileMetadata({ id }: { id: string }) { const pool: any = useContext(RelayContext); const [profile, setProfile] = useState(null); useEffect(() => { const user = new Author(pool, READONLY_RELAYS, id); user.metaData((res) => setProfile(destr(res.content)), 0); }, [id, pool]); return ( <>
user's banner
{id}

{profile?.display_name || profile?.name}

{profile?.username || (id && shortenKey(id))}
{profile?.about}
); }