import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar' import { HoverCard, HoverCardContent, HoverCardTrigger } from '@/components/ui/hover-card' import { Skeleton } from '@/components/ui/skeleton' import { useFetchProfile } from '@/hooks' import { generateImageByPubkey } from '@/lib/pubkey' import { toProfile } from '@/lib/link' import { cn } from '@/lib/utils' import { SecondaryPageLink } from '@/PageManager' import ProfileCard from '../ProfileCard' import { useMemo } from 'react' const UserAvatarSizeCnMap = { large: 'w-24 h-24', big: 'w-16 h-16', normal: 'w-10 h-10', small: 'w-7 h-7', xSmall: 'w-5 h-5', tiny: 'w-4 h-4' } export default function UserAvatar({ userId, className, size = 'normal' }: { userId: string className?: string size?: 'large' | 'big' | 'normal' | 'small' | 'xSmall' | 'tiny' }) { const { profile } = useFetchProfile(userId) const defaultAvatar = useMemo( () => (profile?.pubkey ? generateImageByPubkey(profile.pubkey) : ''), [profile] ) if (!profile) { return } const { avatar, pubkey } = profile return ( e.stopPropagation()}> {pubkey} ) } export function SimpleUserAvatar({ userId, size = 'normal', className, onClick }: { userId: string size?: 'large' | 'big' | 'normal' | 'small' | 'tiny' className?: string onClick?: (e: React.MouseEvent) => void }) { const { profile } = useFetchProfile(userId) const defaultAvatar = useMemo( () => (profile?.pubkey ? generateImageByPubkey(profile.pubkey) : ''), [profile] ) if (!profile) { return } const { avatar, pubkey } = profile return ( {pubkey} ) }