diff --git a/thoughts-frontend/app/users/[username]/followers/page.tsx b/thoughts-frontend/app/users/[username]/followers/page.tsx index 02be5d6..5dda901 100644 --- a/thoughts-frontend/app/users/[username]/followers/page.tsx +++ b/thoughts-frontend/app/users/[username]/followers/page.tsx @@ -1,7 +1,8 @@ import { cookies } from "next/headers"; import { notFound } from "next/navigation"; -import { getFollowersList } from "@/lib/api"; +import { getFollowersList, getMe } from "@/lib/api"; import { UserListCard } from "@/components/user-list-card"; +import { RemoteFollowers } from "@/components/federation/remote-followers"; interface FollowersPageProps { params: Promise<{ username: string }>; @@ -11,22 +12,33 @@ export default async function FollowersPage({ params }: FollowersPageProps) { const { username } = await params; const token = (await cookies()).get("auth_token")?.value ?? null; - const followersData = await getFollowersList(username, token).catch( - () => null - ); + const [followersData, me] = await Promise.all([ + getFollowersList(username, token).catch(() => null), + token ? getMe(token).catch(() => null) : null, + ]); if (!followersData) { notFound(); } + const isOwnProfile = me?.username === username; + return (

Followers

Users following @{username}.

-
+
+ {isOwnProfile && ( +
+

+ Remote followers +

+ +
+ )}
); diff --git a/thoughts-frontend/app/users/[username]/following/page.tsx b/thoughts-frontend/app/users/[username]/following/page.tsx index 00a05ed..f6b4e72 100644 --- a/thoughts-frontend/app/users/[username]/following/page.tsx +++ b/thoughts-frontend/app/users/[username]/following/page.tsx @@ -1,7 +1,8 @@ import { cookies } from "next/headers"; import { notFound } from "next/navigation"; -import { getFollowingList } from "@/lib/api"; +import { getFollowingList, getMe } from "@/lib/api"; import { UserListCard } from "@/components/user-list-card"; +import { RemoteFollowing } from "@/components/federation/remote-following"; interface FollowingPageProps { params: Promise<{ username: string }>; @@ -11,22 +12,33 @@ export default async function FollowingPage({ params }: FollowingPageProps) { const { username } = await params; const token = (await cookies()).get("auth_token")?.value ?? null; - const followingData = await getFollowingList(username, token).catch( - () => null - ); + const [followingData, me] = await Promise.all([ + getFollowingList(username, token).catch(() => null), + token ? getMe(token).catch(() => null) : null, + ]); if (!followingData) { notFound(); } + const isOwnProfile = me?.username === username; + return (

Following

Users that @{username} follows.

-
+
+ {isOwnProfile && ( +
+

+ Remote following +

+ +
+ )}
); diff --git a/thoughts-frontend/app/users/[username]/page.tsx b/thoughts-frontend/app/users/[username]/page.tsx index 659e17b..25474f8 100644 --- a/thoughts-frontend/app/users/[username]/page.tsx +++ b/thoughts-frontend/app/users/[username]/page.tsx @@ -54,7 +54,7 @@ import { ThoughtThread } from "@/components/thought-thread"; import { Button } from "@/components/ui/button"; import Link from "next/link"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; -import { FederationPanel } from "@/components/federation/federation-panel"; +import { PendingRequests } from "@/components/federation/pending-requests"; interface ProfilePageProps { params: Promise<{ username: string }>; @@ -256,7 +256,7 @@ export default async function ProfilePage({ params }: ProfilePageProps) { Thoughts {isOwnProfile && ( - Federation + Requests )} @@ -281,7 +281,7 @@ export default async function ProfilePage({ params }: ProfilePageProps) { {isOwnProfile && ( - + )}