File tree Expand file tree Collapse file tree 1 file changed +1
-7
lines changed
packages/webapp/src/components/shared Expand file tree Collapse file tree 1 file changed +1
-7
lines changed Original file line number Diff line number Diff line change 1- import { useState } from "react"
2-
31import { Avatar , AvatarFallback , AvatarImage } from "@/components/ui/avatar"
42import { cn } from "@/lib/utils"
53import { useConnectionStore } from "@/stores/connection"
@@ -34,23 +32,19 @@ interface DidAvatarProps {
3432
3533export function DidAvatar ( { did, avatarUrl, className } : DidAvatarProps ) {
3634 const nodeUrl = useConnectionStore ( ( state ) => state . nodeUrl )
37- const [ imgError , setImgError ] = useState ( false )
3835
3936 // Resolve relative paths (e.g. /api/v1/profile/avatar) against the node URL
4037 const resolvedUrl =
4138 avatarUrl && avatarUrl . startsWith ( "/" ) && nodeUrl
4239 ? `${ nodeUrl . replace ( / \/ $ / , "" ) } ${ avatarUrl } `
4340 : avatarUrl
4441
45- const showImage = Boolean ( resolvedUrl ) && ! imgError
46-
4742 return (
4843 < Avatar className = { cn ( "size-9" , className ) } >
49- { showImage && (
44+ { resolvedUrl && (
5045 < AvatarImage
5146 src = { resolvedUrl }
5247 alt = { did }
53- onError = { ( ) => setImgError ( true ) }
5448 />
5549 ) }
5650 < AvatarFallback style = { { backgroundColor : colorForDid ( did ) , color : "white" } } >
You can’t perform that action at this time.
0 commit comments