diff --git a/src/app/(agent)/agent/network/component/ConnectionCard.tsx b/src/app/(agent)/agent/network/component/ConnectionCard.tsx index 5043b0e..9021aeb 100644 --- a/src/app/(agent)/agent/network/component/ConnectionCard.tsx +++ b/src/app/(agent)/agent/network/component/ConnectionCard.tsx @@ -37,19 +37,13 @@ export function ConnectionCard({
{(!avatar || !avatarLoaded || isPlaceholder) && ( - {name} +
)} {avatar && !isPlaceholder && ( {name} setAvatarLoaded(true)} /> )} diff --git a/src/app/(agent)/agent/network/component/InvitationCard.tsx b/src/app/(agent)/agent/network/component/InvitationCard.tsx index c7d532a..14a2dff 100644 --- a/src/app/(agent)/agent/network/component/InvitationCard.tsx +++ b/src/app/(agent)/agent/network/component/InvitationCard.tsx @@ -51,19 +51,13 @@ export function InvitationCard({
{(!avatar || !avatarLoaded || isPlaceholder) && ( - {name} +
)} {avatar && !isPlaceholder && ( {name} setAvatarLoaded(true)} /> )} diff --git a/src/app/(user)/user/profile/[id]/page.tsx b/src/app/(user)/user/profile/[id]/page.tsx index 350b940..4974b04 100644 --- a/src/app/(user)/user/profile/[id]/page.tsx +++ b/src/app/(user)/user/profile/[id]/page.tsx @@ -77,6 +77,7 @@ export default function AgentProfileView() { const [loading, setLoading] = useState(true); const [error, setError] = useState(null); const [imageError, setImageError] = useState(false); + const [imageLoaded, setImageLoaded] = useState(false); const [avatarUrl, setAvatarUrl] = useState(null); const [testimonials, setTestimonials] = useState<{ id: string; text: string; author: string; role: string; rating: number }[]>([]); @@ -284,13 +285,19 @@ export default function AgentProfileView() {
{getProfileImageUrl() ? ( - /* eslint-disable-next-line @next/next/no-img-element */ - Profile setImageError(true)} - /> + <> + {!imageLoaded && ( +
+ )} + {/* eslint-disable-next-line @next/next/no-img-element */} + Profile setImageLoaded(true)} + onError={() => setImageError(true)} + /> + ) : (
(src ? 'loading' : 'error'); + + useEffect(() => { + setStatus(src ? 'loading' : 'error'); + }, [src]); + + return ( +
+ {status === 'loading' && ( +
+ )} + {src && status !== 'error' ? ( + /* eslint-disable-next-line @next/next/no-img-element */ + {alt} setStatus('loaded')} + onError={() => setStatus('error')} + /> + ) : status === 'error' ? ( +
+ {alt} +
+ ) : null} +
+ ); +} + function ProfileCard({ profile, resolvedAvatarUrl }: ProfileCardProps) { const [showFullBio, setShowFullBio] = useState(false); const [showAllTags, setShowAllTags] = useState(false); @@ -235,30 +272,11 @@ function ProfileCard({ profile, resolvedAvatarUrl }: ProfileCardProps) {
{/* Profile Image & View Profile Button */}
-
- {getProfileImageUrl() ? ( - /* eslint-disable-next-line @next/next/no-img-element */ - {`${profile.firstName} { - const target = e.target as HTMLImageElement; - target.style.display = 'none'; - }} - /> - ) : ( -
- {`${profile.firstName} -
- )} -
+