import type { UsersResponse } from "../../types/pb_types";

type AvatarProps = {
  avatarUrl?: string;
  firstName: string;
  lastName: string;
}

export default function Avatar({avatarUrl, firstName, lastName}: AvatarProps) {
  if (avatarUrl !== undefined) {
    return (
      <img src={avatarUrl} alt={`${firstName} ${lastName}`} className="rounded-full border-2 border-gray-200 h-full" />
    )
  }

  const avatar = `https://api.dicebear.com/7.x/adventurer/svg?flip=true&seed=${firstName}+${lastName}`;

  return (
      <img src={avatar} alt="Profile" className="rounded-full border-2 border-gray-200 h-20" />
  )
}
