From f057a7f2964f555f3960dabb93f9f110ac245408 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sat, 18 Oct 2025 04:43:55 +0000 Subject: [PATCH] Apply profile enhancements precisely cgen-0b31e2ae1451424ca79030f34e837c58 --- client/pages/ProfilePassport.tsx | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/client/pages/ProfilePassport.tsx b/client/pages/ProfilePassport.tsx index aa80ed12..d052220b 100644 --- a/client/pages/ProfilePassport.tsx +++ b/client/pages/ProfilePassport.tsx @@ -23,6 +23,7 @@ import { import { useAuth } from "@/contexts/AuthContext"; import FourOhFourPage from "@/pages/404"; import { Clock, Rocket, Target, ExternalLink, Award } from "lucide-react"; +import { aethexSocialService } from "@/lib/aethex-social-service"; interface ProjectPreview { id: string; @@ -57,6 +58,8 @@ const ProfilePassport = () => { (AethexUserProfile & { email?: string | null }) | null >(null); const [achievements, setAchievements] = useState([]); + const [followStats, setFollowStats] = useState<{ followers: number; following: number }>({ followers: 0, following: 0 }); + const [degree, setDegree] = useState(""); const [projects, setProjects] = useState([]); const [interests, setInterests] = useState([]); const [loading, setLoading] = useState(true); @@ -258,6 +261,33 @@ const ProfilePassport = () => { ); setNotFound(false); + try { + const [followingIds, followerIds] = await Promise.all([ + aethexSocialService.getFollowing(resolvedId), + aethexSocialService.getFollowers(resolvedId), + ]); + if (!cancelled) setFollowStats({ following: followingIds.length, followers: followerIds.length }); + } catch {} + try { + const me = user?.id || null; + if (me && resolvedId && me !== resolvedId) { + const myConns = await aethexSocialService.getConnections(me); + const first = new Set(myConns.map((c: any) => c.connection_id)); + if (first.has(resolvedId)) setDegree("1st"); + else { + const secondLists = await Promise.all( + Array.from(first).slice(0, 50).map((id) => aethexSocialService.getConnections(id)), + ); + const second = new Set(secondLists.flat().map((c: any) => c.connection_id)); + setDegree(second.has(resolvedId) ? "2nd" : "3rd+"); + } + } else if (me && resolvedId && me === resolvedId) { + setDegree("1st"); + } else { + setDegree(""); + } + } catch {} + lastLoadedKeyRef.current = targetKey ?? (resolvedProfile.username @@ -517,6 +547,15 @@ const ProfilePassport = () => { )}
+ + Followers: {followStats.followers} + + + Following: {followStats.following} + + {degree && ( + {degree} degree + )} {profile.github_url && (