"use client";

import Image from "next/image";

import styles from "./message-avatar.module.css";

export interface UserMessageAvatarProps {
  avatarUrl?: string | null;
}

export function UserMessageAvatar({ avatarUrl }: UserMessageAvatarProps) {
  if (avatarUrl && avatarUrl.length > 0) {
    return (
      <div className={styles.avatar} aria-label="User avatar">
        <Image src={avatarUrl} alt="" width={43} height={43} />
      </div>
    );
  }

  return (
    <div className={styles.avatar} aria-label="Guest avatar">
      <Image
        src="/images/chat/pic-chat-guest.png"
        alt="Guest"
        width={43}
        height={43}
      />
    </div>
  );
}
