feat: implement avatar loading shimmers and restrict privacy settings visibility by user role
This commit is contained in:
@@ -92,10 +92,14 @@ function AvatarWithPlaceholder({ src, alt, size, name }: { src: string; alt: str
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Initials base layer - always rendered behind image */}
|
||||
<div className="absolute inset-0 rounded-full bg-[#c4d9d4] flex items-center justify-center">
|
||||
<span className="font-bold text-[#00293d]" style={{ fontSize: size * 0.4 }}>{initial}</span>
|
||||
</div>
|
||||
{/* Shimmer while loading, initials only on error/no image */}
|
||||
{imgError || isPlaceholder ? (
|
||||
<div className="absolute inset-0 rounded-full bg-[#c4d9d4] flex items-center justify-center">
|
||||
<span className="font-bold text-[#00293d]" style={{ fontSize: size * 0.4 }}>{initial}</span>
|
||||
</div>
|
||||
) : !loaded ? (
|
||||
<div className="absolute inset-0 rounded-full shimmer-loading" />
|
||||
) : null}
|
||||
{src && !isPlaceholder && !imgError && (
|
||||
<img
|
||||
ref={(el) => { if (el?.complete && el.naturalWidth > 0) setLoaded(true); }}
|
||||
|
||||
Reference in New Issue
Block a user