import type { ComponentProps } from 'react'; import { Icons } from '@/components/icons/icons'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import type { User } from '@/lib/auth-client'; import { cn } from '@/lib/utils'; export interface UserAvatarClassNames { base?: string; image?: string; fallback?: string; fallbackIcon?: string; } export interface UserAvatarProps { user?: User | null; classNames?: UserAvatarClassNames; } export function UserAvatar({ user, classNames, className, ...props }: UserAvatarProps & ComponentProps) { const name = user?.name || user?.email; const src = user?.image; return ( {firstTwoCharacters(name) ?? ( )} ); } const firstTwoCharacters = (name?: string | null) => name?.slice(0, 2);