import React, { ComponentProps, forwardRef } from 'react'; import { AvatarImage } from 'folds'; import { useAuthenticatedMediaUrl } from '../../hooks/useAuthenticatedMediaUrl'; import { useMediaAuthentication } from '../../hooks/useMediaAuthentication'; export type AuthenticatedAvatarImageProps = ComponentProps; /** * AvatarImage component that handles Matrix authenticated media. * Automatically fetches authenticated media URLs with the proper Authorization header * and renders them as blob URLs. */ export const AuthenticatedAvatarImage = forwardRef( ({ src, ...props }, ref) => { const useAuthentication = useMediaAuthentication(); const authenticatedSrc = useAuthenticatedMediaUrl(src, useAuthentication); return ; }, ); AuthenticatedAvatarImage.displayName = 'AuthenticatedAvatarImage';