import * as Avatar from '@radix-ui/react-avatar'; import * as HoverCard from '@radix-ui/react-hover-card'; import { minidenticon } from 'minidenticons'; import { memo } from 'react'; import ReactMarkdown from 'react-markdown'; import { Link } from 'react-router-dom'; import remarkGfm from 'remark-gfm'; import { RepostIcon, WorldIcon } from '@shared/icons'; 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' | 'avatar'; embedProfile?: string; }) { const { status, user } = useProfile(pubkey, embedProfile); const createdAt = formatCreatedAt(time, variant === 'chat'); const svgURI = 'data:image/svg+xml;utf8,' + encodeURIComponent(minidenticon(pubkey, 90, 50)); if (status === 'loading') { if (variant === 'avatar') { return (
); } if (variant === 'mention') { return ({user?.name || user?.display_name || user?.displayName}
{user?.website}
) : null}{user?.nip05 || user?.username || displayNpub(pubkey, 16)}
{user?.about}