import * as Popover from '@radix-ui/react-popover'; import { Link } from 'react-router-dom'; import { twMerge } from 'tailwind-merge'; import { Image } from '@shared/image'; import { DEFAULT_AVATAR } from '@stores/constants'; import { formatCreatedAt } from '@utils/createdAt'; import { useProfile } from '@utils/hooks/useProfile'; import { displayNpub, shortenKey } from '@utils/shortenKey'; export function User({ pubkey, time, size, isRepost = false, isChat = false, }: { pubkey: string; time: number; size?: string; isRepost?: boolean; isChat?: boolean; }) { const { status, user } = useProfile(pubkey); const createdAt = formatCreatedAt(time, isChat); const avatarWidth = size === 'small' ? 'w-6' : 'w-11'; const avatarHeight = size === 'small' ? 'h-6' : 'h-11'; if (status === 'loading') { return (
); } return (
{user?.nip05?.toLowerCase() || user?.name || user?.display_name || shortenKey(pubkey)}
ยท {createdAt}
{pubkey}
{user?.display_name || user?.name || user?.username}
{user?.nip05 || displayNpub(pubkey, 16)}

{user?.about}

View profile Message
); }