swadhinbiswas # Changelog · 1/21/2026
0c9b918
22 lines · 662 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";

interface UserAvatarProps {
    user: {
        username: string;
        displayName?: string | null;
        avatarUrl?: string | null;
    };
    className?: string;
}

export function UserAvatar({ user, className }: UserAvatarProps) {
    return (
        <Avatar className={className}>
            <AvatarImage src={user.avatarUrl || undefined} alt={user.username} />
            <AvatarFallback className="bg-gradient-to-br from-cyan-500 to-blue-600 text-white text-xl">
                {user.username[0].toUpperCase()}
            </AvatarFallback>
        </Avatar>
    );
}