import { ImageOff } from "lucide-react";
import { useEffect, useState } from "react";
type BubbleImageProps = {
src: string | undefined;
className?: string;
loading?: "lazy" | "eager";
};
/**
* Thumbnail for message bubbles. Renders with an empty alt (decorative)
* and, if the asset fails to load, falls back to a neutral placeholder instead
* of the browser's broken-image box — which would otherwise expose the raw
* file name via alt text.
*/
export function BubbleImage({ src, className, loading }: BubbleImageProps) {
const [failed, setFailed] = useState(false);
// Reset when the source changes so a reused element re-attempts the new src.
useEffect(() => {
setFailed(false);
}, [src]);
if (!src || failed) {
return (