import React, { useRef } from 'react'; import Image from 'next/image'; import { Menu } from 'primereact/menu'; import { Tooltip } from 'primereact/tooltip'; import { nip19 } from 'nostr-tools'; import { useImageProxy } from '@/hooks/useImageProxy'; import { useToast } from '@/hooks/useToast'; const UserProfileCard = ({ user }) => { const menu = useRef(null); const { showToast } = useToast(); const { returnImageProxy } = useImageProxy(); const copyToClipboard = (text) => { navigator.clipboard.writeText(text); showToast("success", "Copied", "Copied to clipboard"); }; const menuItems = [ ...(user?.privkey ? [{ label: 'Copy nsec', icon: 'pi pi-key', command: () => { const privkeyBuffer = Buffer.from(user.privkey, 'hex'); copyToClipboard(nip19.nsecEncode(privkeyBuffer)); } }] : []), { label: 'Copy npub', icon: 'pi pi-user', command: () => { if (user.pubkey) { copyToClipboard(nip19.npubEncode(user?.pubkey)); } } }, { label: 'Open Nostr Profile', icon: 'pi pi-external-link', command: () => window.open(`https://nostr.com/${nip19.npubEncode(user?.pubkey)}`, '_blank') } ]; return ( <>