import { Popover, Transition } from '@headlessui/react'; import { Fragment } from 'react'; import { Link } from 'react-router-dom'; import { Image } from '@shared/image'; import { DEFAULT_AVATAR } from '@stores/constants'; import { formatCreatedAt } from '@utils/createdAt'; import { useProfile } from '@utils/hooks/useProfile'; import { 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 ( {pubkey}
{user?.nip05?.toLowerCase() || user?.name || user?.display_name || shortenKey(pubkey)}
{createdAt}
{pubkey}
{user?.displayName || user?.name || (
)}
{user?.nip05 || shortenKey(pubkey)}

{user?.about}

View profile Message
); }