Files
OpenHands/frontend/src/components/features/sidebar/user-avatar.tsx
sp.wack cd2d0ee9a5 feat(frontend): Organizational support (#9496)
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: Hiep Le <69354317+hieptl@users.noreply.github.com>
Co-authored-by: Abhay Mishra <grabhaymishra@gmail.com>
Co-authored-by: Hyun Han <62870362+smosco@users.noreply.github.com>
Co-authored-by: Nhan Nguyen <nhan13574@gmail.com>
Co-authored-by: Bharath A V <avbharath1221@gmail.com>
Co-authored-by: hieptl <hieptl.developer@gmail.com>
Co-authored-by: Chloe <chloe@openhands.com>
Co-authored-by: HeyItsChloe <54480367+HeyItsChloe@users.noreply.github.com>
2026-03-13 23:38:54 +07:00

38 lines
1.0 KiB
TypeScript

import { useTranslation } from "react-i18next";
import { I18nKey } from "#/i18n/declaration";
import { LoadingSpinner } from "#/components/shared/loading-spinner";
import ProfileIcon from "#/icons/profile.svg?react";
import { cn } from "#/utils/utils";
import { Avatar } from "./avatar";
interface UserAvatarProps {
avatarUrl?: string;
isLoading?: boolean;
}
export function UserAvatar({ avatarUrl, isLoading }: UserAvatarProps) {
const { t } = useTranslation();
return (
<button
type="button"
data-testid="user-avatar"
className={cn(
"w-8 h-8 rounded-full flex items-center justify-center cursor-pointer",
isLoading && "bg-transparent",
)}
>
{!isLoading && avatarUrl && <Avatar src={avatarUrl} />}
{!isLoading && !avatarUrl && (
<ProfileIcon
aria-label={t(I18nKey.USER$AVATAR_PLACEHOLDER)}
width={28}
height={28}
className="text-[#9099AC]"
/>
)}
{isLoading && <LoadingSpinner size="small" />}
</button>
);
}