import * as Popover from '@radix-ui/react-popover'; import { memo } from 'react'; import { Link } from 'react-router-dom'; import { WorldIcon } from '@shared/icons'; import { Image } from '@shared/image'; import { NIP05 } from '@shared/nip05'; import { formatCreatedAt } from '@utils/createdAt'; import { useProfile } from '@utils/hooks/useProfile'; import { displayNpub } from '@utils/shortenKey'; export const User = memo(function User({ pubkey, time, variant = 'default', embedProfile, }: { pubkey: string; time?: number; variant?: 'default' | 'simple' | 'mention' | 'repost' | 'chat' | 'large' | 'thread'; embedProfile?: string; }) { const { status, user } = useProfile(pubkey, embedProfile); const createdAt = time ? formatCreatedAt(time, variant === 'chat') : 0; if (status === 'loading') { if (variant === 'mention') { return (
{user?.name || user?.display_name}
{user?.about || user?.bio || 'No bio'}
{user.website}
) : null}{user?.nip05 || user?.username || displayNpub(pubkey, 16)}
{user?.about}