import { ImageOff } from 'lucide-react';
import { useAuthedFileUrl } from '../../lib/authedFile';
interface Props {
src: string;
alt?: string;
className?: string;
onClick?: () => void;
}
/**
* An `` for `/api/files/*` attachments. The file is fetched with the auth token
* (see `useAuthedFileUrl`) and rendered from a blob URL, because a native `
`
* request can't carry the Bearer token that `/api/files` now requires. While the fetch
* is in flight a subtle pulsing placeholder is shown in its place so the layout doesn't
* jump; if it failed (deleted / 401 / 5xx) a "broken image" fallback is shown instead.
*/
export default function AuthedImage({ src, alt, className, onClick }: Props) {
const { url: resolvedSrc, status } = useAuthedFileUrl(src);
if (status === 'error') {
return (