From 57efc506e4dddbfa37f0ebbefbb0744e7f307d91 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sat, 18 Oct 2025 05:27:40 +0000 Subject: [PATCH] Add Network section to Connections tab with following/followers/connections and follow/unfollow actions cgen-c997ca199cef4c59bfc63c95d2657cbd --- client/pages/Dashboard.tsx | 147 +++++++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) diff --git a/client/pages/Dashboard.tsx b/client/pages/Dashboard.tsx index 30150261..0c16c7c8 100644 --- a/client/pages/Dashboard.tsx +++ b/client/pages/Dashboard.tsx @@ -86,6 +86,9 @@ export default function Dashboard() { const [achievements, setAchievements] = useState([]); // earned achievements const [allAchievements, setAllAchievements] = useState([]); const [achievementFilter, setAchievementFilter] = useState<"all" | "earned" | "locked">("earned"); + const [followingIds, setFollowingIds] = useState([]); + const [followerIds, setFollowerIds] = useState([]); + const [connectionsList, setConnectionsList] = useState([]); const [profileCompletion, setProfileCompletion] = useState(0); const [stats, setStats] = useState({ activeProjects: 0, @@ -362,6 +365,22 @@ export default function Dashboard() { setInvites([]); } + // Load network: following, followers, connections + try { + const [flw, fol, conns] = await Promise.all([ + aethexSocialService.getFollowing(user!.id), + aethexSocialService.getFollowers(user!.id), + aethexSocialService.getConnections(user!.id), + ]); + setFollowingIds(Array.isArray(flw) ? flw : []); + setFollowerIds(Array.isArray(fol) ? fol : []); + setConnectionsList(Array.isArray(conns) ? conns : []); + } catch (e) { + setFollowingIds([]); + setFollowerIds([]); + setConnectionsList([]); + } + // Load project applications (if table exists) try { const { data, error } = await supabase @@ -1121,6 +1140,134 @@ export default function Dashboard() { onLink={handleLinkProvider} onUnlink={handleUnlinkProvider} /> + + + +
+

+ Your network +

+

+ People you follow, your followers, and direct connections. +

+
+ +
+ + + Following + + {followingIds.length} people + + + + {followingIds.length === 0 ? ( +
You're not following anyone yet.
+ ) : ( + followingIds.slice(0, 6).map((id) => ( +
+
{id}
+ +
+ )) + )} +
+
+ + + + Followers + + {followerIds.length} people + + + + {followerIds.length === 0 ? ( +
No followers yet.
+ ) : ( + followerIds.slice(0, 6).map((id) => ( +
+
{id}
+ +
+ )) + )} +
+
+ + + + Connections + + {connectionsList.length} people + + + + {connectionsList.length === 0 ? ( +
No direct connections yet.
+ ) : ( + connectionsList.slice(0, 6).map((row: any) => { + const up = row.user_profiles || row.profile || null; + const label = up?.full_name || up?.username || row.connection_id || "User"; + const id = row.connection_id || up?.id; + const isFollowing = followingIds.includes(id); + return ( +
+
+ {label} + {id} +
+
+ +
+
+ ); + }) + )} +
+
+